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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Nov 25 13:11:50 CET 2010


Author: romain
Date: 2010-11-25 13:11:49 +0100 (Thu, 25 Nov 2010)
New Revision: 2520

Modified:
   pkg/Rcpp/R/Module.R
Log:
retrieve functions and classes from the cache rather than each time

Modified: pkg/Rcpp/R/Module.R
===================================================================
--- pkg/Rcpp/R/Module.R	2010-11-25 12:07:21 UTC (rev 2519)
+++ pkg/Rcpp/R/Module.R	2010-11-25 12:11:49 UTC (rev 2520)
@@ -101,13 +101,8 @@
           
 setMethod( "$", "Module", function(x, name){
     pointer <- .getModulePointer(x)
-	if( .Call( Module__has_function, pointer, name ) ){
-		.get_Module_function( x, name, pointer )
-	} else if( .Call( Module__has_class, pointer, name ) ){
-	    .get_Module_Class( x, name, pointer )
-	} else{
-		stop( "no such method or class in module" )
-	}
+    storage <- get( "storage", envir = as.environment(x) )
+    storage[[ name ]] 
 } )
 
 new_CppObject_xp <- function(module, pointer, ...) {



More information about the Rcpp-commits mailing list