[Rcpp-commits] r2113 - in pkg/Rcpp: inst/include/Rcpp src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Sep 15 21:51:25 CEST 2010
Author: romain
Date: 2010-09-15 21:51:25 +0200 (Wed, 15 Sep 2010)
New Revision: 2113
Modified:
pkg/Rcpp/inst/include/Rcpp/Module.h
pkg/Rcpp/src/Module.cpp
Log:
(commented) additional code to get information about classes fields
Modified: pkg/Rcpp/inst/include/Rcpp/Module.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/Module.h 2010-09-15 10:16:57 UTC (rev 2112)
+++ pkg/Rcpp/inst/include/Rcpp/Module.h 2010-09-15 19:51:25 UTC (rev 2113)
@@ -53,6 +53,7 @@
class_Base() :name(){} ;
class_Base(const char* name_) : name(name_){} ;
+ virtual Rcpp::List fields(){ return Rcpp::List(0); }
virtual bool has_method( const std::string& ){
return false ;
}
@@ -163,6 +164,17 @@
virtual std::string get_class(){ return ""; }
} ;
+//// template <typename Class>
+//// class S4_field : public Rcpp::S4 {
+//// public:
+//// S4_field( CppProperty<Class>* p ) : S4( "C++Field" ){
+//// slot( "read_only" ) = p->is_readonly() ;
+//// slot( "cpp_class" ) = p->get_class();
+//// slot( "pointer" ) = Rcpp::XPtr< CppProperty<Class> >( p, false ) ;
+//// }
+//// } ;
+
+
#include <Rcpp/module/Module_Property.h>
template <typename Class>
@@ -344,6 +356,19 @@
return prop->set( XP(object), value );
VOID_END_RCPP
}
+
+ //// Rcpp::List fields( ){
+ //// int n = properties.size() ;
+ //// Rcpp::CharacterVector pnames(n) ;
+ //// Rcpp::List out(n) ;
+ //// typename PROPERTY_MAP::iterator it = properties.begin( ) ;
+ //// for( int i=0; i<n; i++, ++it){
+ //// pnames[i] = it->first ;
+ //// out[i] = S4_field<Class>( it->second ) ;
+ //// }
+ //// out.names() = pnames ;
+ //// return out ;
+ //// }
#include <Rcpp/module/Module_Field.h>
Modified: pkg/Rcpp/src/Module.cpp
===================================================================
--- pkg/Rcpp/src/Module.cpp 2010-09-15 10:16:57 UTC (rev 2112)
+++ pkg/Rcpp/src/Module.cpp 2010-09-15 19:51:25 UTC (rev 2113)
@@ -272,6 +272,9 @@
mangled_name += "_" ;
mangled_name += cl->name ;
slot( ".Data" ) = mangled_name ;
+
+ //// slot( "fields" ) = cl->fields() ;
+
}
CppObject::CppObject( Module* p, class_Base* clazz, SEXP xp ) : S4("C++Object") {
More information about the Rcpp-commits
mailing list