Skip to content

Commit 0dd0fb6

Browse files
committed
Merge pull request #464 from RcppCore/bugfix/revert-pr454
reverting PR 454 for copyObject and underlying copy constructor
2 parents 3c096d7 + e1766bb commit 0dd0fb6

File tree

16 files changed

+47
-295
lines changed

16 files changed

+47
-295
lines changed

DESCRIPTION

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
Package: Rcpp
22
Title: Seamless R and C++ Integration
3-
Version: 0.12.4.4
4-
Date: 2016-04-13
3+
Version: 0.12.4.5
4+
Date: 2016-04-15
55
Author: Dirk Eddelbuettel, Romain Francois, JJ Allaire, Kevin Ushey,
66
Qiang Kou, Douglas Bates and John Chambers
77
Maintainer: Dirk Eddelbuettel <[email protected]>
88
Description: The 'Rcpp' package provides R functions as well as C++ classes which
99
offer a seamless integration of R and C++. Many R data types and objects can be
1010
mapped back and forth to C++ equivalents which facilitates both writing of new
11-
code as well as easier integration of third-party libraries. Documentation
12-
about 'Rcpp' is provided by several vignettes included in this package, via the
13-
'Rcpp Gallery' site at <http://gallery.rcpp.org>, the paper by Eddelbuettel and
14-
Francois (2011, JSS), and the book by Eddelbuettel (2013, Springer); see
11+
code as well as easier integration of third-party libraries. Documentation
12+
about 'Rcpp' is provided by several vignettes included in this package, via the
13+
'Rcpp Gallery' site at <http://gallery.rcpp.org>, the paper by Eddelbuettel and
14+
Francois (2011, JSS), and the book by Eddelbuettel (2013, Springer); see
1515
'citation("Rcpp")' for details on these last two.
1616
Depends: R (>= 3.0.0)
1717
Imports: methods, utils

NAMESPACE

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,10 @@ export(Module,
3030
demangle,
3131
sizeof,
3232
cpp_object_initializer,
33-
cpp_object_dummy,
34-
Rcpp.plugin.maker,
35-
copyObject,
36-
destruct,
37-
is_destructed
33+
cpp_object_dummy,
34+
Rcpp.plugin.maker
3835
)
3936
S3method( print, bytes )
4037
exportClass(RcppClass)
38+
39+

R/Module.R

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (C) 2010 - 2016 John Chambers, Dirk Eddelbuettel and Romain Francois
1+
# Copyright (C) 2010 - 2014 John Chambers, Dirk Eddelbuettel and Romain Francois
22
#
33
# This file is part of Rcpp.
44
#
@@ -128,6 +128,7 @@ new_CppObject_xp <- function(module, pointer, ...) {
128128
new_dummyObject <- function(...)
129129
.External( class__dummyInstance, ...)
130130

131+
131132
# class method for $initialize
132133
cpp_object_initializer <- function(.self, .refClassDef, ..., .object_pointer){
133134
selfEnv <- as.environment(.self)
@@ -435,18 +436,6 @@ cpp_fields <- function( CLASS, where){
435436
sapply( CLASS@fields, binding_maker, where = where )
436437
}
437438

438-
.CppClassName <- function(name)
439+
.CppClassName <- function(name) {
439440
paste0("Rcpp_",name)
440-
441-
copyObject <- function( obj ){
442-
.Call(copy_constructor, obj$.cppclass, obj$.pointer )
443-
}
444-
445-
destruct <- function(obj){
446-
.Call(destructor, obj$.cppclass, obj$.pointer)
447-
invisible(NULL)
448-
}
449-
450-
is_destructed <- function(obj){
451-
.Call(is_destructed_impl, obj$.pointer)
452441
}

inst/NEWS.Rd

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,12 @@
1818
}
1919
\item Changes in Rcpp Modules:
2020
\itemize{
21-
\item New function \code{copyObject} to invoke the copy constructor of a
22-
C++ class that has been exposed by modules. (\ghpr{454})
23-
\item New function \code{destruct} to explicitely call the
24-
destructor of the underlying C++ object without waiting for the
25-
garbage collector. (\ghpr{454})
26-
\item New function \code{is\_destructed} to check if an object has been
27-
destructed (presumably by \code{destruct}) (Romain in \ghpr{454})
2821
\item An apparent race condition in Module loading seen with R 3.3.0 was
2922
fixed (Ben Goodrich in \ghpr{461} fixing \ghit{458}).
3023
}
3124
}
3225
}
33-
26+
3427
\section{Changes in Rcpp version 0.12.4 (2016-03-22)}{
3528
\itemize{
3629
\item Changes in Rcpp API:
@@ -79,13 +72,13 @@
7972
\ghpr{406} by Qiang fixing \ghit{365}).
8073
\item A missing \code{std::hash} function interface for
8174
\code{Rcpp::String} has been addded (PR \ghpr{408} by Qiang fixing
82-
\ghit{84}).
75+
\ghit{84}).
8376
}
8477
\item Changes in Rcpp Attributes:
8578
\itemize{
8679
\item Avoid invalid function names when generating C++ interfaces (PR
8780
\ghpr{403} by JJ fixing \ghit{402}).
88-
\item Insert additional space around \code{&} in function interface (PR
81+
\item Insert additional space around \code{&} in function interface (PR
8982
\ghpr{400} by Kazuki Fukui fixing \ghit{278}).
9083
}
9184
\item Changes in Rcpp Modules:
@@ -109,7 +102,7 @@
109102
by Florian)
110103
\item Before creating a single String object from a \code{SEXP}, ensure
111104
that it is from a vector of length one (PR \ghpr{376} by Dirk, fixing
112-
\ghit{375}).
105+
\ghit{375}).
113106
\item No longer use \code{STRING_ELT} as a left-hand side, thanks to a
114107
heads-up by Luke Tierney (PR \ghpr{378} by Dirk, fixing \ghit{377}).
115108
\item Rcpp Module objects are now checked more carefully (PR \ghpr{381}
@@ -121,7 +114,7 @@
121114
\item \code{operator<<()} now always shows decimal points (PR \ghpr{396}
122115
by Dan)
123116
\item Matrix classes now have a \code{transpose()} function (PR \ghpr{397}
124-
by Dirk fixing \ghit{383})
117+
by Dirk fixing \ghit{383})
125118
\item \code{operator<<()} for complex types was added (PRs \ghpr{398} by
126119
Qiang and \ghpr{399} by Dirk, fixing \ghit{187})
127120
}
@@ -139,20 +132,20 @@
139132
\item Changes in Rcpp Documentation:
140133
\itemize{
141134
\item The \code{NEWS} file now links to GitHub issue tickets and pull
142-
requests.
135+
requests.
143136
\item The \code{Rcpp.bib} file with bibliographic references was updated.
144137
}
145138
}
146139
}
147-
140+
148141
\section{Changes in Rcpp version 0.12.1 (2015-09-10)}{
149142
\itemize{
150143
\item Changes in Rcpp API:
151144
\itemize{
152-
\item Correct use of WIN32 instead of _WIN32 to please Windows 10
145+
\item Correct use of WIN32 instead of _WIN32 to please Windows 10
153146
\item Add an assignment operator to \code{DimNameProxy} (PR \ghpr{339} by Florian)
154147
\item Add vector and matrix accessors \code{.at()} with bounds checking
155-
(PR \ghpr{342} by Florian)
148+
(PR \ghpr{342} by Florian)
156149
\item Correct character vector conversion from single char (PR \ghpr{344} by
157150
Florian fixing issue \ghit{343})
158151
\item Correct on use of \code{R_xlen_t} back to \code{size_t} (PR \ghpr{348} by
@@ -200,13 +193,13 @@
200193
R expressions; this should resolve errors where calling handlers (e.g.
201194
through \code{suppressMessages()}) were not properly respected.
202195
\item All internal length variables have been changed from \code{R_len_t}
203-
to \code{R_xlen_t} to support vectors longer than 2^31-1 elements (via
196+
to \code{R_xlen_t} to support vectors longer than 2^31-1 elements (via
204197
PR \ghpr{303} by Qiang Kou).
205198
\item The sugar function \code{sapply} now supports lambda functions
206199
(addressing \ghit{213} thanks to Matt Dziubinski)
207200
\item The \code{var} sugar function now uses a more robust two-pass
208201
method, supports complex numbers, with new unit tests added (via PR
209-
\ghpr{320} by Matt Dziubinski)
202+
\ghpr{320} by Matt Dziubinski)
210203
\item \code{String} constructors now allow encodings (via PR \ghpr{310}
211204
by Qiang Kou)
212205
\item \code{String} objects are preserving the underlying \code{SEXP}
@@ -215,7 +208,7 @@
215208
\item DataFrame constructors are now a little more careful (via PR
216209
\ghpr{301} by Romain Francois)
217210
\item For R 3.2.0 or newer, \code{Rf_installChar()} is used instead of
218-
\code{Rf_install(CHAR())} (via PR \ghpr{332}).
211+
\code{Rf_install(CHAR())} (via PR \ghpr{332}).
219212
}
220213
\item Changes in Rcpp Attributes:
221214
\itemize{
@@ -247,7 +240,7 @@
247240
matrices (via a pull request by Dmitrii Meleshko).
248241
\item A new \code{empty()} string constructor was added (via another pull
249242
request).
250-
\item Better support for Vectors with a storage policy different from the
243+
\item Better support for Vectors with a storage policy different from the
251244
default, i.e. \code{NoProtectStorage}, was added.
252245
}
253246
\item Changes in Rcpp Attributes:
@@ -272,16 +265,16 @@
272265
\item The \code{Rcpp::Environment} constructor can now use a supplied
273266
parent environment.
274267
\item The \code{Rcpp::Function} constructor can now use a supplied
275-
environment or namespace.
268+
environment or namespace.
276269
\item The \code{attributes_hidden} macro from R is used to shield internal
277270
functions; the \code{R_ext/Visibility.h} header is now included as well.
278-
\item A \code{Rcpp::print} function was added as a wrapper around \code{Rf_PrintValue}.
271+
\item A \code{Rcpp::print} function was added as a wrapper around \code{Rf_PrintValue}.
279272
}
280273
\item Changes in Rcpp Attributes:
281274
\itemize{
282275
\item The \code{pkg_types.h} file is now included in \code{RcppExports.cpp}
283-
if it is present in either the \code{inst/include} or \code{src}.
284-
\item \code{sourceCpp} was modified to allow includes of local files
276+
if it is present in either the \code{inst/include} or \code{src}.
277+
\item \code{sourceCpp} was modified to allow includes of local files
285278
(e.g. \code{#include "foo.hpp"}). Implementation files (*.cc; *.cpp) corresponding
286279
to local includes are also automatically built if they exist.
287280
\item The generated attributes code was simplified with respect to

inst/include/Rcpp/config.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#define RCPP_VERSION Rcpp_Version(0,12,4)
3131

3232
// the current source snapshot
33-
#define RCPP_DEV_VERSION RcppDevVersion(0,12,4,3)
33+
#define RCPP_DEV_VERSION RcppDevVersion(0,12,4,5)
3434

3535
#endif
36+

inst/include/Rcpp/module/class.h

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// class.h: Rcpp R/C++ interface class library -- Rcpp modules
44
//
5-
// Copyright (C) 2012 - 2016 Dirk Eddelbuettel and Romain Francois
5+
// Copyright (C) 2012 - 2013 Dirk Eddelbuettel and Romain Francois
66
//
77
// This file is part of Rcpp.
88
//
@@ -22,21 +22,6 @@
2222
#ifndef Rcpp_Module_CLASS_h
2323
#define Rcpp_Module_CLASS_h
2424

25-
template <typename Class, bool ok>
26-
struct CopyConstructor {
27-
static Class* get( Class* obj ){
28-
return new Class(*obj) ;
29-
}
30-
} ;
31-
32-
template <typename Class>
33-
struct CopyConstructor<Class,false> {
34-
static Class* get( Class* obj){
35-
stop("no copy constructor available") ;
36-
return obj ;
37-
}
38-
} ;
39-
4025
template <typename Class>
4126
class class_ : public class_Base {
4227
public:
@@ -161,22 +146,7 @@
161146

162147
throw std::range_error( "no valid constructor available for the argument list" ) ;
163148
END_RCPP
164-
}
165-
166-
SEXP invoke_copy_constructor( SEXP object ){
167-
BEGIN_RCPP
168-
XP xp(object) ;
169-
return internal::make_new_object<Class>( CopyConstructor< Class, traits::has_copy_constructor<Class>::value >::get(xp) ) ;
170-
END_RCPP
171-
}
172-
173-
SEXP invoke_destructor(SEXP object) {
174-
BEGIN_RCPP
175-
run_finalizer(object);
176-
XP(object).release() ;
177-
return R_NilValue ;
178-
END_RCPP
179-
}
149+
}
180150

181151
bool has_default_constructor(){
182152
int n = constructors.size() ;
@@ -507,6 +477,7 @@
507477
self* class_pointer ;
508478
std::string typeinfo_name ;
509479

480+
510481
class_( ) : class_Base(), vec_methods(), properties(), specials(0), constructors(), factories() {};
511482

512483

inst/include/Rcpp/module/class_Base.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// class_Base.h: Rcpp R/C++ interface class library -- Rcpp modules
44
//
5-
// Copyright (C) 2012 - 2016 Dirk Eddelbuettel and Romain Francois
5+
// Copyright (C) 2012 - 2013 Dirk Eddelbuettel and Romain Francois
66
//
77
// This file is part of Rcpp.
88
//
@@ -37,8 +37,6 @@ class class_Base {
3737

3838
virtual void run_finalizer(SEXP){ }
3939

40-
virtual SEXP invoke_copy_constructor(SEXP) = 0 ;
41-
virtual SEXP invoke_destructor(SEXP) = 0 ;
4240
virtual bool has_default_constructor(){ return false ; }
4341
virtual bool has_method( const std::string& ){
4442
return false ;
@@ -82,7 +80,7 @@ class class_Base {
8280
}
8381
void add_enum( const std::string& enum_name, const std::map<std::string, int>& value ){
8482
enums.insert( ENUM_MAP_PAIR( enum_name, value ) ) ;
85-
}
83+
}
8684

8785
std::string name ;
8886
std::string docstring ;

inst/include/Rcpp/traits/has_copy_constructor.h

Lines changed: 0 additions & 41 deletions
This file was deleted.

inst/include/Rcpp/traits/traits.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//
44
// traits.h: Rcpp R/C++ interface class library -- traits to help wrap
55
//
6-
// Copyright (C) 2012 - 2016 Dirk Eddelbuettel and Romain Francois
6+
// Copyright (C) 2012 - 2013 Dirk Eddelbuettel and Romain Francois
77
//
88
// This file is part of Rcpp.
99
//
@@ -44,7 +44,6 @@ struct int2type { enum { value = I }; };
4444
#include <Rcpp/traits/named_object.h>
4545
#include <Rcpp/traits/is_convertible.h>
4646
#include <Rcpp/traits/has_iterator.h>
47-
#include <Rcpp/traits/has_copy_constructor.h>
4847
#include <Rcpp/traits/expands_to_logical.h>
4948
#include <Rcpp/traits/matrix_interface.h>
5049
#include <Rcpp/traits/is_sugar_expression.h>
@@ -78,3 +77,4 @@ struct int2type { enum { value = I }; };
7877
#include <Rcpp/traits/is_primitive.h>
7978

8079
#endif
80+

0 commit comments

Comments
 (0)