[Rcpp-commits] r2117 - pkg/Rcpp/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Sep 16 17:29:28 CEST 2010


Author: romain
Date: 2010-09-16 17:29:28 +0200 (Thu, 16 Sep 2010)
New Revision: 2117

Modified:
   pkg/Rcpp/src/Reference.cpp
Log:
impl of Reference::FieldProxy::get using a callback to R $ operator, set will follow later 

Modified: pkg/Rcpp/src/Reference.cpp
===================================================================
--- pkg/Rcpp/src/Reference.cpp	2010-09-16 14:51:31 UTC (rev 2116)
+++ pkg/Rcpp/src/Reference.cpp	2010-09-16 15:29:28 UTC (rev 2117)
@@ -81,9 +81,17 @@
     
     
     SEXP Reference::FieldProxy::get() const {
-    	// TODO: get the field
-        return R_NilValue ;
-        // return R_do_slot( parent, Rf_install( slot_name.c_str() ) ) ;	
+    	// TODO: get the field  
+    	
+    	SEXP call = ::Rf_lcons( 
+    	    R_DollarSymbol, 
+    	    Rf_cons( asSexp(), 
+    	        Rf_cons( 
+    	            Rf_mkString( field_name.c_str() ),
+    	            R_NilValue 
+    	            ) ) ) ;
+    	
+    	return Rcpp::internal::try_catch( call ) ;
     }
     
     void Reference::FieldProxy::set( SEXP x) const {



More information about the Rcpp-commits mailing list