Skip to content

Commit e0cbf68

Browse files
committed
rename copy() to copyObject()
1 parent a4502c2 commit e0cbf68

File tree

6 files changed

+37
-28
lines changed

6 files changed

+37
-28
lines changed

ChangeLog

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66
* ChangeLog: Added entries for PRs 453 and 454
77
* inst/NEWS.Rd: Add two missing \item uses
88

9+
* R/Module.R: Rename copy to copyObject to avoid function name collisions
10+
* inst/unitTests/runit.Module.R: Ditto
11+
* man/copyObject.Rd: Ditto
12+
* inst/NEWS.Rd: Ditto
13+
* NAMESPACE: Ditto
14+
15+
* inst/unitTests/runit.environments.R: Skip test.environment.child test
16+
917
2016-03-31 Romain Francois <[email protected]>
1018

1119
* R/Modules.R: New top-level functions copy, destruct and is_destructed
@@ -31,7 +39,7 @@
3139

3240
2016-03-27 Qin Wenfeng <[email protected]>
3341

34-
* R/Attributes.R: Support R 3.3.0 Windows new toolchain
42+
* R/Attributes.R: Support new R 3.3.0 Windows toolchain
3543

3644
2016-03-26 Dirk Eddelbuettel <[email protected]>
3745

NAMESPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export(Module,
3232
cpp_object_initializer,
3333
cpp_object_dummy,
3434
Rcpp.plugin.maker,
35-
copy,
35+
copyObject,
3636
destruct,
3737
is_destructed
3838
)

R/Module.R

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616
# along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
1717

1818
internal_function <- function(pointer){
19-
f <- function(xp){
20-
force(xp)
21-
function(...){
22-
.External( InternalFunction_invoke, xp, ... )
23-
}
24-
}
25-
o <- new( "C++Function", f(pointer) )
26-
o@pointer <- pointer
27-
o
19+
f <- function(xp){
20+
force(xp)
21+
function(...){
22+
.External( InternalFunction_invoke, xp, ... )
23+
}
24+
}
25+
o <- new( "C++Function", f(pointer) )
26+
o@pointer <- pointer
27+
o
2828
}
2929

3030
setMethod("$", "C++Class", function(x, name) {
@@ -42,8 +42,8 @@ setMethod("$", "C++Class", function(x, name) {
4242
.getModulePointer <- function(module, mustStart = TRUE) {
4343
pointer <- get("pointer", envir = as.environment(module))
4444
if(is.null(pointer) && mustStart) {
45-
## should be (except for bug noted in identical())
46-
## if(identical(pointer, .badModulePointer) && mustStart) {
45+
## should be (except for bug noted in identical())
46+
## if(identical(pointer, .badModulePointer) && mustStart) {
4747
Module(module, mustStart = TRUE) # will either initialize pointer or throw error
4848
pointer <- get("pointer", envir = as.environment(module))
4949
}
@@ -438,15 +438,15 @@ cpp_fields <- function( CLASS, where){
438438
.CppClassName <- function(name)
439439
paste0("Rcpp_",name)
440440

441-
copy <- function( obj ){
442-
.Call(copy_constructor, obj$.cppclass, obj$.pointer )
441+
copyObject <- function( obj ){
442+
.Call(copy_constructor, obj$.cppclass, obj$.pointer )
443443
}
444444

445445
destruct <- function(obj){
446-
.Call(destructor, obj$.cppclass, obj$.pointer)
447-
invisible(NULL)
446+
.Call(destructor, obj$.cppclass, obj$.pointer)
447+
invisible(NULL)
448448
}
449449

450450
is_destructed <- function(obj){
451-
.Call(is_destructed_impl, obj$.pointer)
451+
.Call(is_destructed_impl, obj$.pointer)
452452
}

inst/NEWS.Rd

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,18 @@
1212
}
1313
\item Changes in Rcpp Attributes:
1414
\itemize{
15-
\item R 3.3.0 Windows with Rtools 3.3 is now supported (Qin Wenfeng in PR \ghpr{451}).
15+
\item R 3.3.0 Windows with Rtools 3.3 is now supported (Qin Wenfeng in PR
16+
\ghpr{451}).
1617
}
1718
\item Changes in Rcpp Modules:
1819
\itemize{
19-
\item New function \code{copy} to invoke the copy constructor of a
20-
C++ class that has been exposed by modules.
20+
\item New function \code{copyObject} to invoke the copy constructor of a
21+
C++ class that has been exposed by modules. (\ghpr{454})
2122
\item New function \code{destruct} to explicitely call the
2223
destructor of the underlying C++ object without waiting for the
23-
garbage collector.
24+
garbage collector. (\ghpr{454})
2425
\item New function \code{is\_destructed} to check if an object has been
25-
destructed (presumably by \code{destruct} )
26+
destructed (presumably by \code{destruct}) (Romain in \ghpr{454})
2627
}
2728
}
2829
}

inst/unitTests/runit.Module.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ if( .runThisTest && Rcpp:::capabilities()[["Rcpp modules"]] ) {
9696

9797
test.Module.copy.constructor <- function(){
9898
f <- new( ModuleCopyConstructor, 2L)
99-
g <- copy(f)
99+
g <- copyObject(f)
100100
checkEquals( f$x, g$x )
101101
checkTrue( !identical(f$.pointer, g$.pointer) )
102102
g$x <- 4L

man/copy.Rd renamed to man/copyObject.Rd

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
\name{copy}
2-
\alias{copy}
1+
\name{copyObject}
2+
\alias{copyObject}
33
\title{
44
Invokes the copy constructor of the C++ class
55
}
@@ -9,7 +9,7 @@
99
constructor.
1010
}
1111
\usage{
12-
copy(obj)
12+
copyObject(obj)
1313
}
1414
\arguments{
1515
\item{obj}{A C++ object from a class exposed by an Rcpp module}
@@ -42,7 +42,7 @@
4242
}
4343
')
4444
f <- new( Foo, 1 )
45-
g <- copy(f)
45+
g <- copyObject(f)
4646

4747
# f and g have the same value for the x field
4848
f$x == g$x

0 commit comments

Comments
 (0)