[Rcpp-commits] r1429 - pkg/Rcpp/inst/doc/Rcpp-modules
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Jun 5 07:17:06 CEST 2010
Author: romain
Date: 2010-06-05 07:17:05 +0200 (Sat, 05 Jun 2010)
New Revision: 1429
Modified:
pkg/Rcpp/inst/doc/Rcpp-modules/Rcpp-modules.Rnw
Log:
minor formatting changes
Modified: pkg/Rcpp/inst/doc/Rcpp-modules/Rcpp-modules.Rnw
===================================================================
--- pkg/Rcpp/inst/doc/Rcpp-modules/Rcpp-modules.Rnw 2010-06-04 23:12:56 UTC (rev 1428)
+++ pkg/Rcpp/inst/doc/Rcpp-modules/Rcpp-modules.Rnw 2010-06-05 05:17:05 UTC (rev 1429)
@@ -267,14 +267,14 @@
<<lang=cpp>>=
RCPP_MODULE(yada){
- using namespace Rcpp ;
+ using namespace Rcpp ;
- function( "hello" , &hello ) ;
- function( "bar" , &bar ) ;
- function( "foo" , &foo ) ;
- function( "bla" , &bla ) ;
- function( "bla1" , &bla1 ) ;
- function( "bla2" , &bla2 ) ;
+ function( "hello" , &hello ) ;
+ function( "bar" , &bar ) ;
+ function( "foo" , &foo ) ;
+ function( "bla" , &bla ) ;
+ function( "bla1" , &bla1 ) ;
+ function( "bla2" , &bla2 ) ;
}
@
@@ -460,7 +460,7 @@
setter (\texttt{setX}) so that we can read and write the property at the R level
with the dollar operator.
-The\texttt{y} property only exposes a getter (\texttt{getY}) so attempting to
+The \texttt{y} property only exposes a getter (\texttt{getY}) so attempting to
set the property from R will generate an error.
<<eval=FALSE>>=
@@ -514,37 +514,37 @@
}
RCPP_MODULE(yada){
- using namespace Rcpp ;
+ using namespace Rcpp ;
+
+ // we expose the class std::vector<double> as "vec" on the R side
+ class_<vec>( "vec")
- // we expose the class std::vector<double> as "vec" on the R side
- class_<vec>( "vec")
+ // exposing member functions
+ .method( "size", &vec::size)
+ .method( "max_size", &vec::max_size)
+ .method( "resize", &vec::resize)
+ .method( "capacity", &vec::capacity)
+ .method( "empty", &vec::empty)
+ .method( "reserve", &vec::reserve)
+ .method( "push_back", &vec::push_back )
+ .method( "pop_back", &vec::pop_back )
+ .method( "clear", &vec::clear )
+
+ // specifically exposing const member functions
+ .const_method( "back", &vec::back )
+ .const_method( "front", &vec::front )
+ .const_method( "at", &vec::at )
+
+ // exposing free functions taking a std::vector<double>*
+ // as their first argument
+ .method( "assign", &vec_assign )
+ .method( "insert", &vec_insert )
+ .method( "as.vector", &vec_asR )
+
+ // special methods for indexing
+ .const_method( "[[", &vec::at )
+ .method( "[[<-", &vec_set )
- // exposing member functions
- .method( "size", &vec::size)
- .method( "max_size", &vec::max_size)
- .method( "resize", &vec::resize)
- .method( "capacity", &vec::capacity)
- .method( "empty", &vec::empty)
- .method( "reserve", &vec::reserve)
- .method( "push_back", &vec::push_back )
- .method( "pop_back", &vec::pop_back )
- .method( "clear", &vec::clear )
-
- // specifically exposing const member functions
- .const_method( "back", &vec::back )
- .const_method( "front", &vec::front )
- .const_method( "at", &vec::at )
-
- // exposing free functions taking a std::vector<double>*
- // as their first argument
- .method( "assign", &vec_assign )
- .method( "insert", &vec_insert )
- .method( "as.vector", &vec_asR )
-
- // special methods for indexing
- .const_method( "[[", &vec::at )
- .method( "[[<-", &vec_set )
-
;
}
@
@@ -607,7 +607,7 @@
@
\section{Future extensions}
-
+
\texttt{Boost.Python} has many more features that we would like to port
to Rcpp modules : class inheritance, overloading, default arguments, enum
types, ...
More information about the Rcpp-commits
mailing list