[Rcpp-commits] r1123 - in pkg/Rcpp/inst: . include/Rcpp

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Apr 26 11:30:45 CEST 2010


Author: romain
Date: 2010-04-26 11:30:44 +0200 (Mon, 26 Apr 2010)
New Revision: 1123

Modified:
   pkg/Rcpp/inst/ChangeLog
   pkg/Rcpp/inst/include/Rcpp/preprocessor.h
Log:
added RCPP_XP_FIELD macro

Modified: pkg/Rcpp/inst/ChangeLog
===================================================================
--- pkg/Rcpp/inst/ChangeLog	2010-04-26 08:42:28 UTC (rev 1122)
+++ pkg/Rcpp/inst/ChangeLog	2010-04-26 09:30:44 UTC (rev 1123)
@@ -1,6 +1,8 @@
 2010-04-26	Romain Francois <romain at r-enthusiasts.com>
 
 	* inst/include/Rcpp/DataFrame_*.h: new class Rcpp::DataFrame
+	
+	* inst/include/Rcpp/preprocessor.h: added RCPP_XP_FIELD macro
 
 2010-04-16  Dirk Eddelbuettel  <edd at debian.org>
 

Modified: pkg/Rcpp/inst/include/Rcpp/preprocessor.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/preprocessor.h	2010-04-26 08:42:28 UTC (rev 1122)
+++ pkg/Rcpp/inst/include/Rcpp/preprocessor.h	2010-04-26 09:30:44 UTC (rev 1123)
@@ -57,4 +57,15 @@
 
 #include <Rcpp/preprocessor_generated.h>
 
+#define RCPP_XP_FIELD(__NAME__,__CLASS__,__FIELD__)          \
+extern "C" SEXP __NAME__( SEXP xp ){                         \
+	SEXP res = R_NilValue ;                                  \
+	BEGIN_RCPP                                               \
+		::Rcpp::XPtr<__CLASS__> ptr(xp) ;                    \
+		res = ::Rcpp::wrap( ptr->__FIELD__ ) ;               \
+	END_RCPP                                                 \
+	return res ;                                             \
+}
+
+
 #endif



More information about the Rcpp-commits mailing list