Rcpp Version 1.0.14
Loading...
Searching...
No Matches
module.h
Go to the documentation of this file.
1// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
2//
3// macros.h: Rcpp R/C++ interface class library -- helper macros for Rcpp modules
4//
5// Copyright (C) 2012-2013 Dirk Eddelbuettel and Romain Francois
6//
7// This file is part of Rcpp.
8//
9// Rcpp is free software: you can redistribute it and/or modify it
10// under the terms of the GNU General Public License as published by
11// the Free Software Foundation, either version 2 of the License, or
12// (at your option) any later version.
13//
14// Rcpp is distributed in the hope that it will be useful, but
15// WITHOUT ANY WARRANTY; without even the implied warranty of
16// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17// GNU General Public License for more details.
18//
19// You should have received a copy of the GNU General Public License
20// along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
21
22#ifndef RCPP_MODULE_MACROS_H
23#define RCPP_MODULE_MACROS_H
24
29#define RCPP_EXPOSED_AS(CLASS) \
30 namespace Rcpp{ namespace traits{ \
31 template<> struct r_type_traits< CLASS* >{ \
32 typedef r_type_module_object_pointer_tag r_category ; \
33 } ; \
34 template<> struct r_type_traits< const CLASS* >{ \
35 typedef r_type_module_object_const_pointer_tag r_category ; \
36 } ; \
37 template<> struct r_type_traits< CLASS >{ \
38 typedef r_type_module_object_tag r_category ; \
39 } ; \
40 template<> struct r_type_traits< CLASS& >{ \
41 typedef r_type_module_object_reference_tag r_category ; \
42 } ; \
43 template<> struct r_type_traits< const CLASS& >{ \
44 typedef r_type_module_object_const_reference_tag r_category ; \
45 } ; \
46 template<> struct input_parameter< CLASS* >{ \
47 typedef Rcpp::InputParameter<CLASS*> type ; \
48 } ; \
49 template<> struct input_parameter< const CLASS* >{ \
50 typedef Rcpp::InputParameter<const CLASS*> type ; \
51 } ; \
52 template<> struct input_parameter< CLASS >{ \
53 typedef Rcpp::InputParameter<CLASS> type ; \
54 } ; \
55 template<> struct input_parameter< CLASS& >{ \
56 typedef Rcpp::InputParameter<CLASS&> type ; \
57 } ; \
58 template<> struct input_parameter< const CLASS& >{ \
59 typedef Rcpp::InputParameter<const CLASS&> type ; \
60 } ; \
61 }}
62
63#define RCPP_EXPOSED_WRAP(CLASS) namespace Rcpp{ namespace traits{ template<> struct wrap_type_traits< CLASS >{typedef wrap_type_module_object_tag wrap_category ; } ; }}
64
65#define RCPP_EXPOSED_CLASS_NODECL(CLASS) \
66 RCPP_EXPOSED_AS(CLASS) \
67 RCPP_EXPOSED_WRAP(CLASS)
68
69#define RCPP_EXPOSED_CLASS(CLASS) \
70 class CLASS; \
71 RCPP_EXPOSED_CLASS_NODECL(CLASS)
72
76#define RCPP_EXPOSED_ENUM_AS(CLASS) namespace Rcpp{ namespace traits{ template<> struct r_type_traits< CLASS >{ typedef r_type_enum_tag r_category ; } ; }}
77#define RCPP_EXPOSED_ENUM_WRAP(CLASS) namespace Rcpp{ namespace traits{ template<> struct wrap_type_traits< CLASS >{typedef wrap_type_enum_tag wrap_category ; } ; }}
78
79#define RCPP_EXPOSED_ENUM_NODECL(CLASS) \
80 RCPP_EXPOSED_ENUM_AS(CLASS) \
81 RCPP_EXPOSED_ENUM_WRAP(CLASS)
82
83#define RCPP_EXPOSED_ENUM(CLASS) \
84 class CLASS; \
85 RCPP_EXPOSED_ENUM_NODECL(CLASS)
86
87
88#endif