Rcpp Version 1.0.9
r_type_traits.h
Go to the documentation of this file.
1 // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
2 /* :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1: */
3 //
4 // r_type_traits.h: Rcpp R/C++ interface class library -- traits to help wrap
5 //
6 // Copyright (C) 2010 - 2013 Dirk Eddelbuettel and Romain Francois
7 //
8 // This file is part of Rcpp.
9 //
10 // Rcpp is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 2 of the License, or
13 // (at your option) any later version.
14 //
15 // Rcpp is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
22 
23 #ifndef Rcpp__traits__r_type_traits__h
24 #define Rcpp__traits__r_type_traits__h
25 
26 namespace Rcpp{
27 namespace traits{
28 
34 
40 
45 
51 
56 
61 
66 struct r_type_pair_tag{} ;
67 
72 
77 
83 
88 
93 
97 struct r_type_enum_tag{} ;
98 
100 
104 template <typename T> struct r_type_traits { typedef r_type_generic_tag r_category ; } ;
105 
109 template <typename T> struct r_type_traits< Rcpp::object<T> >{ typedef r_type_module_object_pointer_tag r_category ; } ;
110 
111 
112 template <typename KEY, typename VALUE>
113 struct r_type_traits< std::pair<const KEY,VALUE> > {
115 } ;
116 
120 template <typename T> struct r_type_traits< std::pair<const std::string,T> > { typedef r_type_pairstring_generic_tag r_category ; } ;
121 template<> struct r_type_traits< std::pair<const std::string,int> >{ typedef r_type_pairstring_primitive_tag r_category ; } ;
122 template<> struct r_type_traits< std::pair<const std::string,const int> >{ typedef r_type_pairstring_primitive_tag r_category ; } ;
123 template<> struct r_type_traits< std::pair<const std::string,double> >{ typedef r_type_pairstring_primitive_tag r_category ; } ;
124 template<> struct r_type_traits< std::pair<const std::string,Rbyte> >{ typedef r_type_pairstring_primitive_tag r_category ; } ;
125 template<> struct r_type_traits< std::pair<const std::string,Rcomplex> >{ typedef r_type_pairstring_primitive_tag r_category ; } ;
126 template<> struct r_type_traits< std::pair<const std::string,bool> >{ typedef r_type_pairstring_primitive_tag r_category ; } ;
127 template<> struct r_type_traits< std::pair<const std::string,std::string> >{ typedef r_type_pairstring_string_tag r_category ; } ;
128 template<> struct r_type_traits< std::pair<const std::string,std::wstring> >{ typedef r_type_pairstring_string_tag r_category ; } ;
129 template<> struct r_type_traits< std::pair<const std::string,char> >{ typedef r_type_pairstring_string_tag r_category ; } ;
130 template<> struct r_type_traits< std::pair<const std::string,wchar_t> >{ typedef r_type_pairstring_string_tag r_category ; } ;
131 
132 template<> struct r_type_traits< std::pair<const std::string,unsigned int> >{ typedef r_type_pairstring_primitive_tag r_category ; } ;
133 template<> struct r_type_traits< std::pair<const std::string,float> >{ typedef r_type_pairstring_primitive_tag r_category ; } ;
134 
135 template<> struct r_type_traits<int>{ typedef r_type_primitive_tag r_category ; } ;
136 template<> struct r_type_traits<const int>{ typedef r_type_primitive_tag r_category ; } ;
137 template<> struct r_type_traits<double>{ typedef r_type_primitive_tag r_category ; } ;
138 template<> struct r_type_traits<const double>{ typedef r_type_primitive_tag r_category ; } ;
139 template<> struct r_type_traits<Rbyte>{ typedef r_type_primitive_tag r_category ; } ;
140 template<> struct r_type_traits<Rcomplex>{ typedef r_type_primitive_tag r_category ; } ;
141 template<> struct r_type_traits<bool>{ typedef r_type_primitive_tag r_category ; } ;
142 template<> struct r_type_traits<std::string>{ typedef r_type_string_tag r_category ; } ;
143 template<> struct r_type_traits<std::wstring>{ typedef r_type_string_tag r_category ; } ;
144 template<> struct r_type_traits<char>{ typedef r_type_string_tag r_category ; } ;
145 template<> struct r_type_traits<wchar_t>{ typedef r_type_string_tag r_category ; } ;
146 
147 template<> struct r_type_traits<unsigned int>{ typedef r_type_primitive_tag r_category ; } ;
148 template<> struct r_type_traits<float>{ typedef r_type_primitive_tag r_category ; } ;
149 template<> struct r_type_traits<const char*>{ typedef r_type_string_tag r_category ; } ;
150 template<> struct r_type_traits<const wchar_t*>{ typedef r_type_string_tag r_category ; } ;
151 
152 /* long */
153 template<> struct r_type_traits<long>{ typedef r_type_primitive_tag r_category ; } ;
154 template<> struct r_type_traits< std::pair<const std::string,long> >{ typedef r_type_primitive_tag r_category ; } ;
155 
156 /* unsigned long */
157 template<> struct r_type_traits<unsigned long>{ typedef r_type_primitive_tag r_category ; } ;
158 template<> struct r_type_traits< std::pair<const std::string,unsigned long> >{ typedef r_type_primitive_tag r_category ; } ;
159 
160 /* long double */
161 template<> struct r_type_traits<long double>{ typedef r_type_primitive_tag r_category ; } ;
162 template<> struct r_type_traits< std::pair<const std::string,long double> >{ typedef r_type_primitive_tag r_category ; } ;
163 
164 /* short */
165 template<> struct r_type_traits<short>{ typedef r_type_primitive_tag r_category ; } ;
166 template<> struct r_type_traits< std::pair<const std::string,short> >{ typedef r_type_primitive_tag r_category ; } ;
167 
168 /* unsigned short */
169 template<> struct r_type_traits<unsigned short>{ typedef r_type_primitive_tag r_category ; } ;
170 template<> struct r_type_traits< std::pair<const std::string,unsigned short> >{ typedef r_type_primitive_tag r_category ; } ;
171 
172 /* std::complex<double> */
173 template<> struct r_type_traits< std::complex<double> >{ typedef r_type_primitive_tag r_category ; } ;
174 template<> struct r_type_traits< std::pair<const std::string,std::complex<double> > >{ typedef r_type_primitive_tag r_category ; } ;
175 
176 /* std::complex<float> */
177 template<> struct r_type_traits< std::complex<float> >{ typedef r_type_primitive_tag r_category ; } ;
178 template<> struct r_type_traits< std::pair<const std::string,std::complex<float> > >{ typedef r_type_primitive_tag r_category ; } ;
179 
180 } // traits
181 } // Rcpp
182 
183 #endif
Rcpp API.
Definition: algo.h:28
Definition: swap.h:25
r_type_module_object_pointer_tag r_category
r_type_generic_tag r_category