[Rcpp-commits] r2450 - pkg/Rcpp/inst/include/Rcpp/module

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Nov 18 22:12:32 CET 2010


Author: dmbates
Date: 2010-11-18 22:12:30 +0100 (Thu, 18 Nov 2010)
New Revision: 2450

Modified:
   pkg/Rcpp/inst/include/Rcpp/module/Module_generated_Constructor.h
   pkg/Rcpp/inst/include/Rcpp/module/Module_generated_class_constructor.h
Log:
allow more arguments to .constructor

Modified: pkg/Rcpp/inst/include/Rcpp/module/Module_generated_Constructor.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/module/Module_generated_Constructor.h	2010-11-18 20:25:28 UTC (rev 2449)
+++ pkg/Rcpp/inst/include/Rcpp/module/Module_generated_Constructor.h	2010-11-18 21:12:30 UTC (rev 2450)
@@ -54,9 +54,63 @@
     }
     virtual int nargs(){ return 2 ; }
 } ;
+template <typename Class, typename U0, typename U1, typename U2>
+class Constructor_3 : public Constructor_Base<Class>{
+    virtual Class* get_new( SEXP* args, int nargs ){
+        return new Class( 
+            as<U0>(args[0]), 
+            as<U1>(args[1]), 
+            as<U2>(args[2]) 
+            ) ;
+    }
+    virtual int nargs(){ return 3 ; }
+} ;
+template <typename Class, typename U0, typename U1, typename U2, typename U3>
+class Constructor_4 : public Constructor_Base<Class>{
+    virtual Class* get_new( SEXP* args, int nargs ){
+        return new Class( 
+            as<U0>(args[0]), 
+            as<U1>(args[1]), 
+            as<U2>(args[2]), 
+            as<U3>(args[3]) 
+            ) ;
+    }
+    virtual int nargs(){ return 4 ; }
+} ;
+template <typename Class, typename U0, typename U1, typename U2, typename U3, typename U4>
+class Constructor_5 : public Constructor_Base<Class>{
+    virtual Class* get_new( SEXP* args, int nargs ){
+        return new Class( 
+            as<U0>(args[0]), 
+            as<U1>(args[1]), 
+            as<U2>(args[2]), 
+            as<U3>(args[3]), 
+            as<U4>(args[4]) 
+            ) ;
+    }
+    virtual int nargs(){ return 5 ; }
+} ;
+template <typename Class, typename U0, typename U1, typename U2, typename U3, typename U4, typename U5>
+class Constructor_6 : public Constructor_Base<Class>{
+    virtual Class* get_new( SEXP* args, int nargs ){
+        return new Class( 
+            as<U0>(args[0]), 
+            as<U1>(args[1]), 
+            as<U2>(args[2]), 
+            as<U3>(args[3]), 
+            as<U4>(args[4]),
+            as<U5>(args[5]) 
+            ) ;
+    }
+    virtual int nargs(){ return 6 ; }
+} ;
 
 struct init_0 {};
 template <typename U0> struct init_1{} ;
 template <typename U0, typename U1> struct init_2{} ;
+template <typename U0, typename U1, typename U2> struct init_3{} ;
+template <typename U0, typename U1, typename U2, typename U3> struct init_4{} ;
+template <typename U0, typename U1, typename U2, typename U3, typename U4> struct init_5{} ;
+template <typename U0, typename U1, typename U2, typename U3, typename U4, typename U5> struct init_6{} ;
 
 #endif

Modified: pkg/Rcpp/inst/include/Rcpp/module/Module_generated_class_constructor.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/module/Module_generated_class_constructor.h	2010-11-18 20:25:28 UTC (rev 2449)
+++ pkg/Rcpp/inst/include/Rcpp/module/Module_generated_class_constructor.h	2010-11-18 21:12:30 UTC (rev 2450)
@@ -39,4 +39,29 @@
         return *this ;
     }
 
+template <typename U0, typename U1, typename U2>
+self& constructor( init_3<U0,U1,U2>, ValidConstructor valid = &yes_arity<3> ){
+    AddConstructor( new Constructor_3<Class,U0,U1,U2>, valid ) ;
+    return *this ;
+}
+
+template <typename U0, typename U1, typename U2, typename U3>
+self& constructor( init_4<U0,U1,U2,U3>, ValidConstructor valid = &yes_arity<4> ){
+    AddConstructor( new Constructor_4<Class,U0,U1,U2,U3>, valid ) ;
+    return *this ;
+}
+
+template <typename U0, typename U1, typename U2, typename U3, typename U4>
+self& constructor( init_5<U0,U1,U2,U3,U4>, ValidConstructor valid = &yes_arity<5> ){
+    AddConstructor( new Constructor_5<Class,U0,U1,U2,U3,U4>, valid ) ;
+    return *this ;
+}
+
+
+template <typename U0, typename U1, typename U2, typename U3, typename U4, typename U5>
+self& constructor( init_6<U0,U1,U2,U3,U4,U5>, ValidConstructor valid = &yes_arity<6> ){
+    AddConstructor( new Constructor_6<Class,U0,U1,U2,U3,U4,U5>, valid ) ;
+    return *this ;
+}
+
 #endif



More information about the Rcpp-commits mailing list