[Rcpp-commits] r3817 - scripts
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Oct 23 16:09:04 CEST 2012
Author: romain
Date: 2012-10-23 16:09:04 +0200 (Tue, 23 Oct 2012)
New Revision: 3817
Modified:
scripts/generator_Module_CppMethod.R
Log:
simpler version (removes 35% of the code generated by this script)
Modified: scripts/generator_Module_CppMethod.R
===================================================================
--- scripts/generator_Module_CppMethod.R 2012-10-23 14:00:06 UTC (rev 3816)
+++ scripts/generator_Module_CppMethod.R 2012-10-23 14:09:04 UTC (rev 3817)
@@ -29,28 +29,7 @@
private:
Method met ;
} ;
-
- template < typename Class, typename T, %s >
- class CppMethod%d <Class, result<T>, %s> : public CppMethod<Class> {
- public:
- typedef result<T> (Class::*Method)(%s) ;
- typedef CppMethod<Class> method_class ;
-
- CppMethod%d(Method m) : method_class(), met(m) {}
- SEXP operator()( Class* object, SEXP* args){
- T* ptr = (object->*met)( %s ) ;
- return internal::make_new_object<T>(ptr) ;
- }
- inline int nargs(){ return %d ; }
- inline bool is_void(){ return false ; }
- inline bool is_const(){ return false ; }
- inline void signature(std::string& s, const char* name ){ Rcpp::signature<result<T>,%s>(s, name) ; }
-
- private:
- Method met ;
- } ;
-
-
+
template < typename Class, %s > class CppMethod%d<Class,void,%s> : public CppMethod<Class> {
public:
typedef void (Class::*Method)(%s) ;
@@ -90,27 +69,7 @@
private:
Method met ;
} ;
-
- template < typename Class, typename T, %s >
- class const_CppMethod%d <Class, result<T>, %s> : public CppMethod<Class> {
- public:
- typedef result<T> (Class::*Method)(%s) const ;
- typedef CppMethod<Class> method_class ;
- const_CppMethod%d(Method m) : method_class(), met(m){}
- SEXP operator()( Class* object, SEXP* args){
- T* ptr = (object->*met)( %s ) ;
- return internal::make_new_object<T>(ptr) ;
- }
- inline int nargs(){ return %d ; }
- inline bool is_void(){ return false ; }
- inline bool is_const(){ return true ; }
- inline void signature(std::string& s, const char* name ){ Rcpp::signature<result<T>,%s>(s, name) ; }
-
- private:
- Method met ;
- } ;
-
template < typename Class, %s > class const_CppMethod%d<Class,void,%s> : public CppMethod<Class> {
public:
typedef void (Class::*Method)(%s) const ;
@@ -140,16 +99,7 @@
U,
typenames, # typename U0, ...
-i,
-U,
-u, # U0 u0, ...
i,
-as, # Rcpp::as<U0>( args[0] ) , ...
-i,
-U,
-
-typenames, # typename U0, ...
-i,
U, # U0, ...
u, # U0 u0, ...
i,
@@ -167,16 +117,7 @@
U,
typenames, # typename U0, ...
-i,
-U,
-u, # U0 u0, ...
i,
-as, # Rcpp::as<U0>( args[0] ) , ...
-i,
-U,
-
-typenames, # typename U0, ...
-i,
U, # U0, ...
u, # U0 u0, ...
i,
@@ -248,28 +189,6 @@
Method met ;
} ;
- template <typename Class, typename T>
- class CppMethod0< Class, result<T> > : public CppMethod<Class> {
- public:
- typedef result<T> (Class::*Method)(void) ;
- typedef CppMethod<Class> method_class ;
- typedef XPtr<T> XP ;
- CppMethod0( Method m) : method_class(), met(m){}
- SEXP operator()( Class* object, SEXP* ){
- T* ptr = (object->*met)( ) ;
- return internal::make_new_object<T>(ptr) ;
- }
- inline int nargs(){ return 0 ; }
- inline bool is_void(){ return false ; }
- inline bool is_const(){ return false ; }
- inline void signature(std::string& s, const char* name){ Rcpp::signature< result<T> >(s, name) ; }
-
- private:
- Method met ;
- } ;
-
-
-
template <typename Class, typename OUT> class const_CppMethod0 : public CppMethod<Class> {
public:
typedef OUT (Class::*Method)(void) const ;
@@ -305,27 +224,6 @@
Method met ;
} ;
- template <typename Class, typename T>
- class const_CppMethod0< Class, result<T> > : public CppMethod<Class> {
- public:
- typedef result<T> (Class::*Method)(void) const ;
- typedef CppMethod<Class> method_class ;
- typedef XPtr<T> XP ;
- const_CppMethod0( Method m) : method_class(), met(m){}
- SEXP operator()( Class* object, SEXP* ){
- T* ptr = (object->*met)( ) ;
- return internal::make_new_object<T>(ptr) ;
- }
- inline int nargs(){ return 0 ; }
- inline bool is_void(){ return false ; }
- inline bool is_const(){ return false ; }
- inline void signature(std::string& s, const char* name){ Rcpp::signature< result<T> >(s, name) ; }
-
- private:
- Method met ;
- } ;
-
-
%s
#endif
More information about the Rcpp-commits
mailing list