[Rcpp-commits] r2480 - in pkg: Rcpp/inst/include/Rcpp Rcpp/inst/include/Rcpp/module RcppModels/src wls/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Nov 21 23:23:58 CET 2010


Author: romain
Date: 2010-11-21 23:23:57 +0100 (Sun, 21 Nov 2010)
New Revision: 2480

Modified:
   pkg/Rcpp/inst/include/Rcpp/Module.h
   pkg/Rcpp/inst/include/Rcpp/module/Module_generated_Constructor.h
   pkg/Rcpp/inst/include/Rcpp/module/Module_generated_class_constructor.h
   pkg/RcppModels/src/Module.cpp
   pkg/wls/src/wls.cpp
Log:
new style .constructor<>

Modified: pkg/Rcpp/inst/include/Rcpp/Module.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/Module.h	2010-11-21 18:01:09 UTC (rev 2479)
+++ pkg/Rcpp/inst/include/Rcpp/Module.h	2010-11-21 22:23:57 UTC (rev 2480)
@@ -322,7 +322,7 @@
 	}
 	
 	self& default_constructor( ValidConstructor valid = &yes_arity<0> ){
-	    return constructor( init_0(), valid ) ;  
+	    return constructor( valid ) ;  
 	}
 		
 #include <Rcpp/module/Module_generated_class_constructor.h>

Modified: pkg/Rcpp/inst/include/Rcpp/module/Module_generated_Constructor.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/module/Module_generated_Constructor.h	2010-11-21 18:01:09 UTC (rev 2479)
+++ pkg/Rcpp/inst/include/Rcpp/module/Module_generated_Constructor.h	2010-11-21 22:23:57 UTC (rev 2480)
@@ -105,12 +105,4 @@
     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-21 18:01:09 UTC (rev 2479)
+++ pkg/Rcpp/inst/include/Rcpp/module/Module_generated_class_constructor.h	2010-11-21 22:23:57 UTC (rev 2480)
@@ -21,49 +21,7 @@
 
 #ifndef Rcpp_Module_generated_class_constructor_h
 #define Rcpp_Module_generated_class_constructor_h
-    
-    self& constructor( init_0, ValidConstructor valid = &yes ){
-        AddConstructor( new Constructor_0<Class>, valid ) ;
-        return *this ;
-    }
 
-    template <typename U0>
-    self& constructor( init_1<U0>, ValidConstructor valid = &yes_arity<1> ){
-        AddConstructor( new Constructor_1<Class,U0>, valid) ;
-        return *this ;
-    }
-
-    template <typename U0, typename U1>
-    self& constructor( init_2<U0,U1>, ValidConstructor valid = &yes_arity<2> ){
-        AddConstructor( new Constructor_2<Class,U0,U1>, valid ) ;
-        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 ;
-}
-
     template <
         typename U0, 
         typename U1, 
@@ -72,7 +30,7 @@
         typename U4, 
         typename U5
     > 
-    self& ctor( ValidConstructor valid = &yes_arity<6> ){
+    self& constructor( ValidConstructor valid = &yes_arity<6> ){
         AddConstructor( new Constructor_6<Class,U0,U1,U2,U3,U4,U5> , valid ) ;
         return *this ;   
     }
@@ -84,7 +42,7 @@
         typename U3, 
         typename U4
     > 
-    self& ctor( ValidConstructor valid = &yes_arity<5>){
+    self& constructor( ValidConstructor valid = &yes_arity<5>){
         AddConstructor( new Constructor_5<Class,U0,U1,U2,U3,U4> , valid ) ;
         return *this ;   
     }
@@ -95,7 +53,7 @@
         typename U2, 
         typename U3
     > 
-    self& ctor( ValidConstructor valid = &yes_arity<4>){
+    self& constructor( ValidConstructor valid = &yes_arity<4>){
         AddConstructor( new Constructor_4<Class,U0,U1,U2,U3> , valid ) ;
         return *this ;   
     }
@@ -106,7 +64,7 @@
         typename U1, 
         typename U2
     > 
-    self& ctor( ValidConstructor valid = &yes_arity<3>){
+    self& constructor( ValidConstructor valid = &yes_arity<3>){
         AddConstructor( new Constructor_3<Class,U0,U1,U2> , valid ) ;
         return *this ;   
     }
@@ -115,7 +73,7 @@
         typename U0, 
         typename U1
     > 
-    self& ctor( ValidConstructor valid = &yes_arity<2>){
+    self& constructor( ValidConstructor valid = &yes_arity<2>){
         AddConstructor( new Constructor_2<Class,U0,U1> , valid ) ;
         return *this ;   
     }
@@ -123,12 +81,12 @@
     template <
         typename U0
     > 
-    self& ctor( ValidConstructor valid = &yes_arity<1>){
+    self& constructor( ValidConstructor valid = &yes_arity<1>){
         AddConstructor( new Constructor_1<Class,U0> , valid ) ;
         return *this ;   
     }
     
-    self& ctor( ValidConstructor valid = &yes ){
+    self& constructor( ValidConstructor valid = &yes ){
         AddConstructor( new Constructor_0<Class>, valid ) ;
         return *this ;
     }

Modified: pkg/RcppModels/src/Module.cpp
===================================================================
--- pkg/RcppModels/src/Module.cpp	2010-11-21 18:01:09 UTC (rev 2479)
+++ pkg/RcppModels/src/Module.cpp	2010-11-21 22:23:57 UTC (rev 2480)
@@ -7,8 +7,8 @@
 
 class_<Irwls>( "Irwls" )
 
-    .default_constructor()
-    .constructor(init_2<NumericMatrix,NumericVector>())
+    .constructor()
+    .constructor<NumericMatrix,NumericVector>()
 
     .field_readonly("x", &Irwls::x)
     .field_readonly("y", &Irwls::y)
@@ -20,8 +20,8 @@
     
 class_<glmFamily>("glmFamily")
 
-    .default_constructor()
-    .constructor(init_1<List>())
+    .constructor()
+    .constructor<List>()
 
     .method("linkFun",  &glmFamily::linkFun)
     .method("linkInv",  &glmFamily::linkInv)
@@ -32,10 +32,10 @@
 
 class_<lmResp>("lmResp")
 
-    .default_constructor()
-    .constructor(init_1<NumericVector>())
-    .constructor(init_2<NumericVector,NumericVector>())
-    .constructor(init_3<NumericVector,NumericVector,NumericVector>())
+    .constructor()
+    .constructor<NumericVector>()
+    .constructor<NumericVector,NumericVector>()
+    .constructor<NumericVector,NumericVector,NumericVector>()
 
     .property("mu",      &lmResp::mu)
     .property("offset",  &lmResp::offset)
@@ -52,11 +52,11 @@
 
 class_<glmResp>("glmResp")
 
-    .default_constructor()
-    .constructor(init_2<List,NumericVector>())
-    .constructor(init_3<List,NumericVector,NumericVector>())
-    .constructor(init_4<List,NumericVector,NumericVector,NumericVector>())
-    .constructor(init_5<List,NumericVector,NumericVector,NumericVector,NumericVector>())
+    .constructor()
+    .constructor<List,NumericVector>()
+    .constructor<List,NumericVector,NumericVector>()
+    .constructor<List,NumericVector,NumericVector,NumericVector>()
+    .constructor<List,NumericVector,NumericVector,NumericVector,NumericVector>()
  
     .property("eta",         &glmResp::eta)   
     .property("mu",          &glmResp::mu)
@@ -78,9 +78,9 @@
 
 class_<predMod>("predMod")
 
-    .default_constructor()
-    .constructor(init_1<int>())
-    .constructor(init_1<NumericVector>())
+    .constructor()
+    .constructor<int>()
+    .constructor<NumericVector>()
  
 // For some reason this doesn't work.
 //    .property("coef0", &predMod::coef0, &predMod::setCoef0)   
@@ -89,9 +89,9 @@
 
 class_<densePred>("densePred")
 
-    .default_constructor()
-    .constructor(init_1<NumericMatrix>())
-    .constructor(init_2<NumericMatrix, NumericVector>())
+    .constructor()
+    .constructor<NumericMatrix>()
+    .constructor<NumericMatrix, NumericVector>()
 
     .property("coef0", &densePred::coef0)
     .property("delta", &densePred::delta)

Modified: pkg/wls/src/wls.cpp
===================================================================
--- pkg/wls/src/wls.cpp	2010-11-21 18:01:09 UTC (rev 2479)
+++ pkg/wls/src/wls.cpp	2010-11-21 22:23:57 UTC (rev 2480)
@@ -60,7 +60,7 @@
 
 class_<Wls>( "cppWls" )
     // .default_constructor()
-    .constructor(init_2<NumericMatrix,NumericVector>())
+    .constructor<NumericMatrix,NumericVector>()
     .method("fit", &Wls::fit)
     ;
 



More information about the Rcpp-commits mailing list