[Rcpp-commits] r2125 - in pkg/Rcpp: inst/include/Rcpp src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Sep 17 10:34:54 CEST 2010


Author: romain
Date: 2010-09-17 10:34:53 +0200 (Fri, 17 Sep 2010)
New Revision: 2125

Modified:
   pkg/Rcpp/inst/include/Rcpp/Module.h
   pkg/Rcpp/src/Module.cpp
Log:
only keeping the version of (get|set)Property that uses external pointers

Modified: pkg/Rcpp/inst/include/Rcpp/Module.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/Module.h	2010-09-17 08:28:20 UTC (rev 2124)
+++ pkg/Rcpp/inst/include/Rcpp/Module.h	2010-09-17 08:34:53 UTC (rev 2125)
@@ -77,22 +77,14 @@
 	virtual Rcpp::CharacterVector complete(){ return Rcpp::CharacterVector(0) ; }
 	virtual ~class_Base(){}
 	
-	virtual SEXP getProperty( const std::string&, SEXP ) {
+	virtual SEXP getProperty( SEXP, SEXP ) {
 		throw std::range_error( "cannot retrieve property" ) ;
 	}
-	virtual void setProperty( const std::string&, SEXP, SEXP) {
+	virtual void setProperty( SEXP, SEXP, SEXP) {
 		throw std::range_error( "cannot set property" ) ;
 	}
 	
 	
-	virtual SEXP getProperty__( SEXP, SEXP ) {
-		throw std::range_error( "cannot retrieve property" ) ;
-	}
-	virtual void setProperty__( SEXP, SEXP, SEXP) {
-		throw std::range_error( "cannot set property" ) ;
-	}
-	
-	
 	std::string name ;
 } ;
 
@@ -345,37 +337,14 @@
 		return out ;
 	}
 	
-	SEXP getProperty( const std::string& name_, SEXP object) {
+	SEXP getProperty( SEXP field_xp , SEXP object) {
 	BEGIN_RCPP
-		typename PROPERTY_MAP::iterator it = properties.find( name_ ) ;
-		if( it == properties.end() ){
-			throw std::range_error( "no such property" ) ; 
-		}
-		prop_class* prop =  it->second ;
-		return prop->get( XP(object) ); 
-	END_RCPP
-	}
-	
-	void setProperty( const std::string& name_, SEXP object, SEXP value)  {
-	BEGIN_RCPP
-		typename PROPERTY_MAP::iterator it = properties.find( name_ ) ;
-		if( it == properties.end() ){
-			throw std::range_error( "no such property" ) ; 
-		}
-		prop_class* prop =  it->second ;
-		return prop->set( XP(object), value ); 
-	VOID_END_RCPP
-	}
-	
-	
-	SEXP getProperty__( SEXP field_xp , SEXP object) {
-	BEGIN_RCPP
 		prop_class* prop = reinterpret_cast< prop_class* >( EXTPTR_PTR( field_xp ) ) ;
 	    return prop->get( XP(object) ); 
 	END_RCPP
 	}
 	
-	void setProperty__( SEXP field_xp, SEXP object, SEXP value)  {
+	void setProperty( SEXP field_xp, SEXP object, SEXP value)  {
 	BEGIN_RCPP
 		prop_class* prop = reinterpret_cast< prop_class* >( EXTPTR_PTR( field_xp ) ) ;
 	    return prop->set( XP(object), value ); 

Modified: pkg/Rcpp/src/Module.cpp
===================================================================
--- pkg/Rcpp/src/Module.cpp	2010-09-17 08:28:20 UTC (rev 2124)
+++ pkg/Rcpp/src/Module.cpp	2010-09-17 08:34:53 UTC (rev 2125)
@@ -92,22 +92,13 @@
 	return cl->complete(); 
 }
 
-// that needs to eventually disappear as we will use the ones below
-RCPP_FUNCTION_3(SEXP, CppClass__get, XP_Class cl, SEXP obj, std::string name){
-	return cl->getProperty( name, obj ) ;
-}
-RCPP_FUNCTION_4(SEXP, CppClass__set, XP_Class cl, SEXP obj, std::string name, SEXP value){
-	cl->setProperty( name, obj, value ) ;
-	return R_NilValue ;
-}
-
 // these operate directly on the external pointers, rather than 
 // looking up the property in the map
 RCPP_FUNCTION_3(SEXP, CppField__get, XP_Class cl, SEXP field_xp, SEXP obj){
-	return cl->getProperty__( field_xp, obj ) ;
+	return cl->getProperty( field_xp, obj ) ;
 }
 RCPP_FUNCTION_4(SEXP, CppField__set, XP_Class cl, SEXP field_xp, SEXP obj, SEXP value){
-	cl->setProperty__( field_xp, obj, value ) ;
+	cl->setProperty( field_xp, obj, value ) ;
 	return R_NilValue ;
 }
 



More information about the Rcpp-commits mailing list