[Rcpp-commits] r3828 - pkg/Rcpp/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Oct 24 08:51:53 CEST 2012


Author: romain
Date: 2012-10-24 08:51:53 +0200 (Wed, 24 Oct 2012)
New Revision: 3828

Modified:
   pkg/Rcpp/R/Module.R
Log:
expose enum values as CLASS.VALUE (should be CLASS, but I don't how to to do it)

Modified: pkg/Rcpp/R/Module.R
===================================================================
--- pkg/Rcpp/R/Module.R	2012-10-23 18:36:13 UTC (rev 3827)
+++ pkg/Rcpp/R/Module.R	2012-10-24 06:51:53 UTC (rev 3828)
@@ -221,7 +221,6 @@
                      else Rcpp:::cpp_object_dummy(.self, .refClassDef)
                  }
                           )
-
         rm( .self, .refClassDef )
 
         classDef <- methods:::getClass(clname)
@@ -261,6 +260,17 @@
         clname <- as.character(CLASS)
         demangled_name <- sub( "^Rcpp_", "", clname )
         .classes_map[[ CLASS at typeid ]] <- storage[[ demangled_name ]] <- .get_Module_Class( module, demangled_name, xp )
+        
+        # exposing enums values as CLASS.VALUE 
+        # (should really be CLASS$value but I don't know how to do it)
+        if( length( CLASS at enums ) ){
+            for( enum in CLASS at enums ){
+                for( i in 1:length(enum) ){
+                    storage[[ paste( demangled_name, ".", names(enum)[i], sep = "" ) ]] <- enum[i]  
+                }
+            }
+        }
+        
     }
 
     # functions



More information about the Rcpp-commits mailing list