Skip to content

Commit 8740cb1

Browse files
committed
a number of smaller cosmetic changes (incl NAMESPACE additions and a new
internal manual page) to make (R-devel's) R CMD check happy
1 parent 4ab36d5 commit 8740cb1

File tree

6 files changed

+62
-21
lines changed

6 files changed

+62
-21
lines changed

ChangeLog

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
2013-09-20 Dirk Eddelbuettel <edd@debian.org>
2+
3+
* R/Module.R: More ':::' cleanups to make R CMD check happy
4+
* R/RcppClass.R: Ditto
5+
6+
* NAMESPACE: Some new exports related to this
7+
8+
* man/setRcppClass.Rd: Document loadRcppClass()
9+
* man/Rcpp-internal.Rd: Added in order to document
10+
cpp_object_initializer() and cpp_object_dummy()
11+
112
2013-09-19 Dirk Eddelbuettel <edd@debian.org>
213

314
* inst/include/Rcpp/longlong.h: Unbreak long long by making it (as

NAMESPACE

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,18 @@ export(Module,
1818
populate,
1919
loadRcppModules,
2020
setRcppClass,
21+
loadRcppClass,
2122
loadModule,
2223
cppFunction,
2324
evalCpp,
2425
sourceCpp,
2526
compileAttributes,
2627
registerPlugin,
27-
RcppLdFlags,
28-
demangle, sizeof
28+
RcppLdFlags,
29+
demangle,
30+
sizeof,
31+
cpp_object_initializer,
32+
cpp_object_dummy
2933
)
3034
S3method( print, bytes )
3135
exportClass(RcppClass)

R/Module.R

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ cpp_object_dummy <- function(.self, .refClassDef) {
155155
}
156156

157157
cpp_object_maker <- function(typeid, pointer){
158-
Class <- Rcpp:::.classes_map[[ typeid ]]
158+
Class <- .classes_map[[ typeid ]]
159159
new( Class, .object_pointer = pointer )
160160
}
161161

@@ -230,11 +230,11 @@ Module <- function( module, PACKAGE = methods::getPackageName(where), where = to
230230
.self <- .refClassDef <- NULL
231231
generator$methods(initialize =
232232
if(cpp_hasDefaultConstructor(CLASS))
233-
function(...) Rcpp:::cpp_object_initializer(.self,.refClassDef, ...)
233+
function(...) cpp_object_initializer(.self,.refClassDef, ...)
234234
else
235235
function(...) {
236-
if(nargs()) Rcpp:::cpp_object_initializer(.self,.refClassDef, ...)
237-
else Rcpp:::cpp_object_dummy(.self, .refClassDef)
236+
if(nargs()) cpp_object_initializer(.self,.refClassDef, ...)
237+
else cpp_object_dummy(.self, .refClassDef)
238238
}
239239
)
240240
rm( .self, .refClassDef )
@@ -264,12 +264,12 @@ Module <- function( module, PACKAGE = methods::getPackageName(where), where = to
264264
} , where = where )
265265
}
266266
}
267-
267+
268268
# promoting show to S4
269269
if( any( grepl( "show", names(CLASS@methods) ) ) ){
270270
setMethod( "show", clname, function(object) object$show(), where = where )
271271
}
272-
272+
273273
}
274274
if(length(classes)) {
275275
module$refClassGenerators <- generators
@@ -280,24 +280,24 @@ Module <- function( module, PACKAGE = methods::getPackageName(where), where = to
280280
clname <- as.character(CLASS)
281281
demangled_name <- sub( "^Rcpp_", "", clname )
282282
.classes_map[[ CLASS@typeid ]] <- storage[[ demangled_name ]] <- .get_Module_Class( module, demangled_name, xp )
283-
284-
# exposing enums values as CLASS.VALUE
283+
284+
# exposing enums values as CLASS.VALUE
285285
# (should really be CLASS$value but I don't know how to do it)
286286
if( length( CLASS@enums ) ){
287287
for( enum in CLASS@enums ){
288288
for( i in 1:length(enum) ){
289-
storage[[ paste( demangled_name, ".", names(enum)[i], sep = "" ) ]] <- enum[i]
289+
storage[[ paste( demangled_name, ".", names(enum)[i], sep = "" ) ]] <- enum[i]
290290
}
291291
}
292292
}
293-
293+
294294
}
295295

296296
# functions
297297
functions <- .Call( Module__functions_names, xp )
298298
for( fun in functions ){
299299
storage[[ fun ]] <- .get_Module_function( module, fun, xp )
300-
300+
301301
# register as(FROM, TO) methods
302302
converter_rx <- "^[.]___converter___(.*)___(.*)$"
303303
if( length( matches <- grep( converter_rx, functions ) ) ){
@@ -306,13 +306,13 @@ Module <- function( module, PACKAGE = methods::getPackageName(where), where = to
306306
from <- sub( converter_rx, "\\1", fun )
307307
to <- sub( converter_rx, "\\2", fun )
308308
converter <- function( from ){}
309-
body( converter ) <- substitute( { CONVERT(from) },
309+
body( converter ) <- substitute( { CONVERT(from) },
310310
list( CONVERT = storage[[fun]] )
311311
)
312312
setAs( from, to, converter, where = where )
313313
}
314314
}
315-
315+
316316
}
317317

318318
assign( "storage", storage, envir = as.environment(module) )
@@ -322,7 +322,7 @@ Module <- function( module, PACKAGE = methods::getPackageName(where), where = to
322322
dealWith <- function( x ) if(isTRUE(x[[1]])) invisible(NULL) else x[[2]]
323323

324324
method_wrapper <- function( METHOD, where ){
325-
noargs <- all( METHOD$nargs == 0 )
325+
noargs <- all( METHOD$nargs == 0 )
326326
stuff <- list(
327327
class_pointer = METHOD$class_pointer,
328328
pointer = METHOD$pointer,
@@ -335,9 +335,9 @@ method_wrapper <- function( METHOD, where ){
335335
f <- function(...) NULL
336336
if( noargs ){
337337
formals(f) <- NULL
338-
}
339-
340-
extCall <- if( noargs ) {
338+
}
339+
340+
extCall <- if( noargs ) {
341341
if( all( METHOD$void ) ){
342342
# all methods are void, so we know we want to return invisible(NULL)
343343
substitute(

R/RcppClass.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ setRcppClass <- function(Class, CppClass,
2525
where = topenv(parent.frame()),
2626
...) {
2727
myCall <- match.call()
28-
myCall[[1]] <- quote(Rcpp:::loadRcppClass)
28+
myCall[[1]] <- quote(Rcpp::loadRcppClass)
2929
if(!missing(module) && moduleIsLoaded(module, where)) # eval now
3030
eval.parent(myCall)
3131
else {

man/Rcpp-internal.Rd

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
\name{Rcpp-internal}
2+
\alias{Rcpp-internal}
3+
\alias{cpp_object_initializer}
4+
\alias{cpp_object_dummy}
5+
\title{Rcpp internal functions}
6+
\description{The \pkg{Rcpp} utilizes several internal functions which
7+
need to visible within its namespace, yet are not user-facing. This
8+
page provides basic documentation for them.
9+
}
10+
\usage{
11+
cpp_object_initializer(.self, .refClassDef, ..., .object_pointer)
12+
cpp_object_dummy(.self, .refClassDef)
13+
}
14+
\arguments{
15+
\item{.self}{A reference to the object being modified}
16+
\item{.refClassDef}{The definition of a reference class}
17+
\item{...}{Further arguments}
18+
\item{.object_pointer}{Optional external pointer}
19+
}
20+
\keyword{programming}
21+
\keyword{interface}
22+
\keyword{internal}

man/setRcppClass.Rd

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
\name{setRcppClass}
22
\alias{setRcppClass}
3+
\alias{loadRcppClass}
34
\alias{RcppClass-class}
45
\title{
56
Create a Class Extending a C++ Class
@@ -13,6 +14,9 @@ C++ class.
1314
\usage{
1415
setRcppClass(Class, CppClass, module, fields = list(), contains = ,
1516
methods = , saveAs = Class, where = , ...)
17+
loadRcppClass(Class, CppClass, module, fields = character(),
18+
contains = character(),
19+
methods = , saveAs = Class, where = , ...)
1620
}
1721
%- maybe also 'usage' for other objects documented here.
1822
\arguments{
@@ -50,7 +54,7 @@ Arguments, if any, to pass on to \code{\link{setRefClass}()}.
5054
}
5155
}
5256
\details{
53-
The call to this function normally appears in the source code for a
57+
The call to these functions normally appears in the source code for a
5458
package.
5559
It generates a load action that loads the specified module and
5660
extracts the C++ class definition specified.

0 commit comments

Comments
 (0)