[Rcpp-commits] r2957 - pkg/Rcpp/inst/include/Rcpp

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Apr 5 18:58:25 CEST 2011


Author: romain
Date: 2011-04-05 18:58:25 +0200 (Tue, 05 Apr 2011)
New Revision: 2957

Modified:
   pkg/Rcpp/inst/include/Rcpp/Module.h
Log:
attacking the module bug, first pass

Modified: pkg/Rcpp/inst/include/Rcpp/Module.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/Module.h	2011-04-05 16:00:28 UTC (rev 2956)
+++ pkg/Rcpp/inst/include/Rcpp/Module.h	2011-04-05 16:58:25 UTC (rev 2957)
@@ -343,14 +343,16 @@
 	    properties(), 
 	    finalizer_pointer(0), 
 	    specials(0), 
-	    constructors()
+	    constructors(), 
+	    singleton(0)
 	{
-		if( !singleton ){
+	    Rcpp::Module* module = getCurrentScope() ;
+		if( ! module->has_class(name_) ){
 			singleton = new self ;
 			singleton->name = name_ ;
 			singleton->docstring = std::string( doc == 0 ? "" : doc );
 			singleton->finalizer_pointer = new finalizer_class ;
-			getCurrentScope()->AddClass( name_, singleton ) ;
+			module->AddClass( name_, singleton ) ;
 		}
 	}
          
@@ -695,18 +697,16 @@
     
 	map_vec_signed_method vec_methods ;
 	PROPERTY_MAP properties ;
-	static self* singleton ;
+	
 	finalizer_class* finalizer_pointer ;
 	int specials ;
 	vec_signed_constructor constructors ;
-   
+    self* singleton ;
+	
 	class_( ) : class_Base(), vec_methods(), properties(), specials(0) {}; 
 	
 } ;   
 
-template <typename Class> 
-class_<Class>* class_<Class>::singleton ;
-
 // function factories
 #include <Rcpp/module/Module_generated_function.h>
 



More information about the Rcpp-commits mailing list