[Rcpp-commits] r2534 - in pkg/Rcpp: R inst/skeleton
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Nov 26 13:46:15 CET 2010
Author: romain
Date: 2010-11-26 13:46:14 +0100 (Fri, 26 Nov 2010)
New Revision: 2534
Modified:
pkg/Rcpp/R/Rcpp.package.skeleton.R
pkg/Rcpp/inst/skeleton/rcpp_module.cpp
Log:
update the module part of Rcpp.package.skeleton
Modified: pkg/Rcpp/R/Rcpp.package.skeleton.R
===================================================================
--- pkg/Rcpp/R/Rcpp.package.skeleton.R 2010-11-26 12:41:25 UTC (rev 2533)
+++ pkg/Rcpp/R/Rcpp.package.skeleton.R 2010-11-26 12:46:14 UTC (rev 2534)
@@ -94,7 +94,7 @@
}
if(isTRUE(module)){
- writeLines( 'importClassesFrom( Rcpp, "C++Object", "C++Class", "Module" )', ns )
+ writeLines( 'import( Rcpp )', ns )
}
close( ns )
}
Modified: pkg/Rcpp/inst/skeleton/rcpp_module.cpp
===================================================================
--- pkg/Rcpp/inst/skeleton/rcpp_module.cpp 2010-11-26 12:41:25 UTC (rev 2533)
+++ pkg/Rcpp/inst/skeleton/rcpp_module.cpp 2010-11-26 12:46:14 UTC (rev 2534)
@@ -39,16 +39,26 @@
RCPP_MODULE(yada){
using namespace Rcpp ;
- function( "hello" , &hello ) ;
- function( "bar" , &bar ) ;
- function( "foo" , &foo ) ;
- function( "bla" , &bla ) ;
- function( "bla1" , &bla1 ) ;
- function( "bla2" , &bla2 ) ;
+ function( "hello" , &hello , "documentation for hello " ) ;
+ function( "bla" , &bla , "documentation for bla " ) ;
+ function( "bla1" , &bla1 , "documentation for bla1 " ) ;
+ function( "bla2" , &bla2 , "documentation for bla2 " ) ;
+ // with formal arguments specification
+ function( "bar" , &bar ,
+ List::create( _["x"] = 0.0 ),
+ "documentation for bar " ) ;
+ function( "foo" , &foo ,
+ List::create( _["x"] = 1, _["y"] = 1.0 ),
+ "documentation for foo " ) ;
+
class_<World>( "World" )
- .method( "greet", &World::greet )
- .method( "set", &World::set )
+
+ // expose the default constructor
+ .constructor()
+
+ .method( "greet", &World::greet , "get the message" )
+ .method( "set", &World::set , "set the message" )
;
}
More information about the Rcpp-commits
mailing list