[Rcpp-commits] r2111 - pkg/Rcpp/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Sep 15 12:03:14 CEST 2010
Author: romain
Date: 2010-09-15 12:03:13 +0200 (Wed, 15 Sep 2010)
New Revision: 2111
Modified:
pkg/Rcpp/R/Module.R
Log:
using class ANY seems to work
Modified: pkg/Rcpp/R/Module.R
===================================================================
--- pkg/Rcpp/R/Module.R 2010-09-15 09:46:51 UTC (rev 2110)
+++ pkg/Rcpp/R/Module.R 2010-09-15 10:03:13 UTC (rev 2111)
@@ -252,16 +252,17 @@
class_names <- names( fc )
fieldClasses <- fieldPrototypes <- fc
for( f in class_names ){
- fieldClasses[[ f ]] <- sprintf( "C++Property__%s__%s", clname, fc[[f]] )
- if( is.null( getClassDef( fieldClasses[[ f ]] ) ) ){
- setClass( fieldClasses[[ f ]], contains = "C++Property", where = where )
- }
- fieldPrototypes[[ f ]] <- new( fieldClasses[[ f ]] )
+ # fieldClasses[[ f ]] <- sprintf( "C++Property__%s__%s", clname, fc[[f]] )
+ # if( is.null( getClassDef( fieldClasses[[ f ]] ) ) ){
+ # setClass( fieldClasses[[ f ]], contains = "C++Property", where = where )
+ # }
+ # fieldPrototypes[[ f ]] <- new( fieldClasses[[ f ]] )
+ fieldPrototypes[[ f ]] <- NA
+ fieldClasses[[ f ]] <- "ANY"
}
- dummy <- list() ; names(dummy) <- character(0)
setRefClass( clname,
- # fieldClasses = fieldClasses,
- fieldPrototypes = dummy ,
+ fieldClasses = fieldClasses,
+ fieldPrototypes = fieldPrototypes ,
contains = "C++Object",
interfaceClasses = classRep,
where = where
@@ -277,6 +278,8 @@
assign( ".self", .Object, envir = selfEnv )
# <hack>
+ # we replace the prototypes by active bindings that
+ # call the internal accessors
try( rm( list = names(fieldClasses), envir = selfEnv ), silent = TRUE )
for( prop in names(fieldClasses) ){
caps <- methods:::firstCap( prop )
More information about the Rcpp-commits
mailing list