[Rcpp-commits] r2444 - scripts

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Nov 18 21:17:05 CET 2010


Author: romain
Date: 2010-11-18 21:17:03 +0100 (Thu, 18 Nov 2010)
New Revision: 2444

Modified:
   scripts/generator_Module_method.R
Log:
pass down the validator

Modified: scripts/generator_Module_method.R
===================================================================
--- scripts/generator_Module_method.R	2010-11-18 19:31:06 UTC (rev 2443)
+++ scripts/generator_Module_method.R	2010-11-18 20:17:03 UTC (rev 2444)
@@ -13,48 +13,52 @@
 txt <- sprintf( '
 
 	template <typename OUT, %s>
-	self& method( const char* name_, OUT (Class::*fun)(%s) ){
-		AddMethod( name_, new CppMethod%d<Class,OUT,%s>( fun ) ) ;
+	self& method( const char* name_, OUT (Class::*fun)(%s), ValidMethod valid = &yes_arity<%d> ){
+		AddMethod( name_, new CppMethod%d<Class,OUT,%s>( fun ), valid ) ;
   		return *this ;
 	}
 	
 	template <typename OUT, %s>
-	self& method( const char* name_, OUT (Class::*fun)(%s) const ){
-		AddMethod( name_, new const_CppMethod%d<Class,OUT,%s>( fun ) ) ;
+	self& method( const char* name_, OUT (Class::*fun)(%s) const, ValidMethod valid = &yes_arity<%d> ){
+		AddMethod( name_, new const_CppMethod%d<Class,OUT,%s>( fun ), valid ) ;
   		return *this ;
 	}
 
 	template <typename OUT, %s>
-	self& nonconst_method( const char* name_, OUT (Class::*fun)(%s) ){
-		AddMethod( name_, new CppMethod%d<Class,OUT,%s>( fun ) ) ;
+	self& nonconst_method( const char* name_, OUT (Class::*fun)(%s), ValidMethod valid = &yes_arity<%d> ){
+		AddMethod( name_, new CppMethod%d<Class,OUT,%s>( fun ), valid ) ;
   		return *this ;
 	}
 	
 	template <typename OUT, %s>
-	self& const_method( const char* name_, OUT (Class::*fun)(%s) const ){
-		AddMethod( name_, new const_CppMethod%d<Class,OUT,%s>( fun ) ) ;
+	self& const_method( const char* name_, OUT (Class::*fun)(%s) const , ValidMethod valid = &yes_arity<%d>){
+		AddMethod( name_, new const_CppMethod%d<Class,OUT,%s>( fun ), valid ) ;
   		return *this ;
 	}
 
 ',
 typenames,   # typename U0, ...
 u,           # U0 u0, ...
+i, 
 i,
 U,           # U0, ...
 
 typenames,   # typename U0, ...
 u,           # U0 u0, ...
+i, 
 i,
 U,            # U0, ...
 
 typenames,   # typename U0, ...
 u,           # U0 u0, ...
 i,
+i,
 U,           # U0, ...
 
 typenames,   # typename U0, ...
 u,           # U0 u0, ...
 i,
+i,
 U            # U0, ...
 
 )   
@@ -87,25 +91,25 @@
 #define Rcpp_Module_generated_method_h
 
 	template <typename OUT>
-	self& method( const char* name_, OUT (Class::*fun)(void) ){
+	self& method( const char* name_, OUT (Class::*fun)(void), ValidMethod valid = &yes ){
 		AddMethod( name_, new CppMethod0<Class,OUT>( fun ) ) ;
   		return *this ;
 	}
 	
 	template <typename OUT>
-	self& method( const char* name_, OUT (Class::*fun)(void) const ){
+	self& method( const char* name_, OUT (Class::*fun)(void) const, ValidMethod valid = &yes ){
 		AddMethod( name_, new const_CppMethod0<Class,OUT>( fun ) ) ;
   		return *this ;
 	}
 
 	
 	template <typename OUT>
-	self& nonconst_method( const char* name_, OUT (Class::*fun)(void) ){
+	self& nonconst_method( const char* name_, OUT (Class::*fun)(void), ValidMethod valid = &yes ){
 		AddMethod( name_, new CppMethod0<Class,OUT>( fun ) ) ;
   		return *this ;
 	}
 	template <typename OUT>
-	self& const_method( const char* name_, OUT (Class::*fun)(void) const ){
+	self& const_method( const char* name_, OUT (Class::*fun)(void) const, ValidMethod valid = &yes ){
 		AddMethod( name_, new const_CppMethod0<Class,OUT>( fun ) ) ;
   		return *this ;
 	}



More information about the Rcpp-commits mailing list