[Rcpp-commits] r1372 - in pkg/Rcpp: . R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun May 30 08:57:47 CEST 2010
Author: romain
Date: 2010-05-30 08:57:46 +0200 (Sun, 30 May 2010)
New Revision: 1372
Added:
pkg/Rcpp/man/CppObjectS3-class.Rd
Removed:
pkg/Rcpp/man/completion.Rd
Modified:
pkg/Rcpp/NAMESPACE
pkg/Rcpp/R/Module.R
pkg/Rcpp/R/zzz.R
pkg/Rcpp/man/CppObject-class.Rd
Log:
apply John Chambers workaround
Modified: pkg/Rcpp/NAMESPACE
===================================================================
--- pkg/Rcpp/NAMESPACE 2010-05-29 20:33:02 UTC (rev 1371)
+++ pkg/Rcpp/NAMESPACE 2010-05-30 06:57:46 UTC (rev 1372)
@@ -5,10 +5,10 @@
importFrom( utils, capture.output, assignInNamespace )
-exportClasses( Module, "C++Class", "C++Object" )
+exportClasses( Module, "C++Class", "C++Object", "C++ObjectS3" )
export( Module )
exportMethods( new )
importFrom( utils, .DollarNames )
-exportMethods( .DollarNames )
+S3method( .DollarNames, "C++ObjectS3" )
Modified: pkg/Rcpp/R/Module.R
===================================================================
--- pkg/Rcpp/R/Module.R 2010-05-29 20:33:02 UTC (rev 1371)
+++ pkg/Rcpp/R/Module.R 2010-05-30 06:57:46 UTC (rev 1372)
@@ -17,11 +17,16 @@
setGeneric( "new" )
-internal.classes <- environment()
-
+setOldClass( "C++ObjectS3" )
setClass( "Module", representation( pointer = "externalptr" ) )
setClass( "C++Class", representation( pointer = "externalptr", module = "externalptr" ) )
-setClass( "C++Object", representation( module = "externalptr", cppclass = "externalptr", pointer = "externalptr" ) )
+setClass( "C++Object",
+ representation(
+ module = "externalptr",
+ cppclass = "externalptr",
+ pointer = "externalptr"
+ ),
+ contains = "C++ObjectS3" )
setMethod( "$", "Module", function(x, name){
if( .Call( "Module__has_function", x at pointer, name, PACKAGE = "Rcpp" ) ){
@@ -126,8 +131,13 @@
new( "Module", pointer = xp )
}
-setGeneric( ".DollarNames" )
-setMethod( ".DollarNames", signature( x = "C++Object", pattern = "character" ), function(x, pattern ){
- grep( pattern, .Call( "CppClass__methods" , x at cppclass, PACKAGE = "Rcpp" ), value = TRUE )
+
+setGeneric( "complete", function(x) standardGeneric("complete") )
+setMethod( "complete", "C++Object", function(x){
+ .Call( "CppClass__methods" , x at cppclass, PACKAGE = "Rcpp" )
} )
+".DollarNames.C++ObjectS3" <- function( x, pattern ){
+ grep( pattern, complete(x) , value = TRUE )
+}
+
Modified: pkg/Rcpp/R/zzz.R
===================================================================
--- pkg/Rcpp/R/zzz.R 2010-05-29 20:33:02 UTC (rev 1371)
+++ pkg/Rcpp/R/zzz.R 2010-05-30 06:57:46 UTC (rev 1372)
@@ -15,12 +15,5 @@
# You should have received a copy of the GNU General Public License
# along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
-.onLoad <- function(libname, pkgname){
- # FIXME: there ought to be a better way to do this without
- # highjacking utils::.DollarNames
- utils <- asNamespace( "utils" )
- unlockBinding( ".DollarNames", utils )
- assignInNamespace( ".DollarNames", .DollarNames, utils )
- lockBinding( ".DollarNames", utils )
-}
+.onLoad <- function(libname, pkgname){}
Modified: pkg/Rcpp/man/CppObject-class.Rd
===================================================================
--- pkg/Rcpp/man/CppObject-class.Rd 2010-05-29 20:33:02 UTC (rev 1371)
+++ pkg/Rcpp/man/CppObject-class.Rd 2010-05-30 06:57:46 UTC (rev 1372)
@@ -12,6 +12,11 @@
Objects can be created by the \code{new} method of the
\linkS4class{"C++Class"} class.
}
+\section{Extends}{
+ Class \code{"\linkS4class{C++ObjectS3}"}, directly.
+ Class \code{"\linkS4class{oldClass}"}, by class "C++ObjectS3", distance 2.
+}
+
\section{Slots}{
\describe{
\item{\code{module}:}{external pointer to the module}
Added: pkg/Rcpp/man/CppObjectS3-class.Rd
===================================================================
--- pkg/Rcpp/man/CppObjectS3-class.Rd (rev 0)
+++ pkg/Rcpp/man/CppObjectS3-class.Rd 2010-05-30 06:57:46 UTC (rev 1372)
@@ -0,0 +1,23 @@
+\name{C++ObjectS3-class}
+\Rdversion{1.1}
+\docType{class}
+\alias{C++ObjectS3-class}
+
+\title{Class "C++ObjectS3"}
+\description{
+ This class is used to allow S3 dispatch of \code{\link[utils]{.DollarNames}}
+ which is an S3 generic. Rcpp defines an S3 method for the
+ \code{"C++ObjectS3"} which dispatches internally to the appropriate method.
+}
+\section{Objects from the Class}{A virtual Class: No objects may be created from it.}
+\section{Extends}{
+Class \code{"\linkS4class{oldClass}"}, directly.
+}
+\section{Methods}{
+No methods defined with class "C++ObjectS3" in the signature.
+}
+\references{
+R-devel thread and workaround from John Chambers:
+\url{http://permalink.gmane.org/gmane.comp.lang.r.devel/24524}
+}
+\keyword{classes}
Deleted: pkg/Rcpp/man/completion.Rd
===================================================================
--- pkg/Rcpp/man/completion.Rd 2010-05-29 20:33:02 UTC (rev 1371)
+++ pkg/Rcpp/man/completion.Rd 2010-05-30 06:57:46 UTC (rev 1372)
@@ -1,22 +0,0 @@
-\name{.DollarNames-methods}
-\docType{methods}
-\alias{.DollarNames-methods}
-\alias{.DollarNames,ANY,ANY-method}
-\alias{.DollarNames,C++Object,character-method}
-\title{Completion for C++ objects}
-\description{
-Completion for C++ objects
-}
-\section{Methods}{
-\describe{
-
-\item{\code{signature(x = "ANY", pattern = "ANY")}}{
-Standard method (from utils)
-}
-
-\item{\code{signature(x = "C++Object", pattern = "character")}}{
- Method for \linkS4class{"C++Object"} objects.
-}
-}}
-\keyword{methods}
-
More information about the Rcpp-commits
mailing list