Skip to content

Commit e1766bb

Browse files
committed
reverting PR 454 for copyObject and underlying copy constructor
1 parent 06ed671 commit e1766bb

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
@@ -17,19 +17,12 @@
1717
}
1818
\item Changes in Rcpp Modules:
1919
\itemize{
20-
\item New function \code{copyObject} to invoke the copy constructor of a
21-
C++ class that has been exposed by modules. (\ghpr{454})
22-
\item New function \code{destruct} to explicitely call the
23-
destructor of the underlying C++ object without waiting for the
24-
garbage collector. (\ghpr{454})
25-
\item New function \code{is\_destructed} to check if an object has been
26-
destructed (presumably by \code{destruct}) (Romain in \ghpr{454})
2720
\item An apparent race condition in Module loading seen with R 3.3.0 was
2821
fixed (Ben Goodrich in \ghpr{461} fixing \ghit{458}).
2922
}
3023
}
3124
}
32-
25+
3326
\section{Changes in Rcpp version 0.12.4 (2016-03-22)}{
3427
\itemize{
3528
\item Changes in Rcpp API:
@@ -78,13 +71,13 @@
7871
\ghpr{406} by Qiang fixing \ghit{365}).
7972
\item A missing \code{std::hash} function interface for
8073
\code{Rcpp::String} has been addded (PR \ghpr{408} by Qiang fixing
81-
\ghit{84}).
74+
\ghit{84}).
8275
}
8376
\item Changes in Rcpp Attributes:
8477
\itemize{
8578
\item Avoid invalid function names when generating C++ interfaces (PR
8679
\ghpr{403} by JJ fixing \ghit{402}).
87-
\item Insert additional space around \code{&} in function interface (PR
80+
\item Insert additional space around \code{&} in function interface (PR
8881
\ghpr{400} by Kazuki Fukui fixing \ghit{278}).
8982
}
9083
\item Changes in Rcpp Modules:
@@ -108,7 +101,7 @@
108101
by Florian)
109102
\item Before creating a single String object from a \code{SEXP}, ensure
110103
that it is from a vector of length one (PR \ghpr{376} by Dirk, fixing
111-
\ghit{375}).
104+
\ghit{375}).
112105
\item No longer use \code{STRING_ELT} as a left-hand side, thanks to a
113106
heads-up by Luke Tierney (PR \ghpr{378} by Dirk, fixing \ghit{377}).
114107
\item Rcpp Module objects are now checked more carefully (PR \ghpr{381}
@@ -120,7 +113,7 @@
120113
\item \code{operator<<()} now always shows decimal points (PR \ghpr{396}
121114
by Dan)
122115
\item Matrix classes now have a \code{transpose()} function (PR \ghpr{397}
123-
by Dirk fixing \ghit{383})
116+
by Dirk fixing \ghit{383})
124117
\item \code{operator<<()} for complex types was added (PRs \ghpr{398} by
125118
Qiang and \ghpr{399} by Dirk, fixing \ghit{187})
126119
}
@@ -138,20 +131,20 @@
138131
\item Changes in Rcpp Documentation:
139132
\itemize{
140133
\item The \code{NEWS} file now links to GitHub issue tickets and pull
141-
requests.
134+
requests.
142135
\item The \code{Rcpp.bib} file with bibliographic references was updated.
143136
}
144137
}
145138
}
146-
139+
147140
\section{Changes in Rcpp version 0.12.1 (2015-09-10)}{
148141
\itemize{
149142
\item Changes in Rcpp API:
150143
\itemize{
151-
\item Correct use of WIN32 instead of _WIN32 to please Windows 10
144+
\item Correct use of WIN32 instead of _WIN32 to please Windows 10
152145
\item Add an assignment operator to \code{DimNameProxy} (PR \ghpr{339} by Florian)
153146
\item Add vector and matrix accessors \code{.at()} with bounds checking
154-
(PR \ghpr{342} by Florian)
147+
(PR \ghpr{342} by Florian)
155148
\item Correct character vector conversion from single char (PR \ghpr{344} by
156149
Florian fixing issue \ghit{343})
157150
\item Correct on use of \code{R_xlen_t} back to \code{size_t} (PR \ghpr{348} by
@@ -199,13 +192,13 @@
199192
R expressions; this should resolve errors where calling handlers (e.g.
200193
through \code{suppressMessages()}) were not properly respected.
201194
\item All internal length variables have been changed from \code{R_len_t}
202-
to \code{R_xlen_t} to support vectors longer than 2^31-1 elements (via
195+
to \code{R_xlen_t} to support vectors longer than 2^31-1 elements (via
203196
PR \ghpr{303} by Qiang Kou).
204197
\item The sugar function \code{sapply} now supports lambda functions
205198
(addressing \ghit{213} thanks to Matt Dziubinski)
206199
\item The \code{var} sugar function now uses a more robust two-pass
207200
method, supports complex numbers, with new unit tests added (via PR
208-
\ghpr{320} by Matt Dziubinski)
201+
\ghpr{320} by Matt Dziubinski)
209202
\item \code{String} constructors now allow encodings (via PR \ghpr{310}
210203
by Qiang Kou)
211204
\item \code{String} objects are preserving the underlying \code{SEXP}
@@ -214,7 +207,7 @@
214207
\item DataFrame constructors are now a little more careful (via PR
215208
\ghpr{301} by Romain Francois)
216209
\item For R 3.2.0 or newer, \code{Rf_installChar()} is used instead of
217-
\code{Rf_install(CHAR())} (via PR \ghpr{332}).
210+
\code{Rf_install(CHAR())} (via PR \ghpr{332}).
218211
}
219212
\item Changes in Rcpp Attributes:
220213
\itemize{
@@ -246,7 +239,7 @@
246239
matrices (via a pull request by Dmitrii Meleshko).
247240
\item A new \code{empty()} string constructor was added (via another pull
248241
request).
249-
\item Better support for Vectors with a storage policy different from the
242+
\item Better support for Vectors with a storage policy different from the
250243
default, i.e. \code{NoProtectStorage}, was added.
251244
}
252245
\item Changes in Rcpp Attributes:
@@ -271,16 +264,16 @@
271264
\item The \code{Rcpp::Environment} constructor can now use a supplied
272265
parent environment.
273266
\item The \code{Rcpp::Function} constructor can now use a supplied
274-
environment or namespace.
267+
environment or namespace.
275268
\item The \code{attributes_hidden} macro from R is used to shield internal
276269
functions; the \code{R_ext/Visibility.h} header is now included as well.
277-
\item A \code{Rcpp::print} function was added as a wrapper around \code{Rf_PrintValue}.
270+
\item A \code{Rcpp::print} function was added as a wrapper around \code{Rf_PrintValue}.
278271
}
279272
\item Changes in Rcpp Attributes:
280273
\itemize{
281274
\item The \code{pkg_types.h} file is now included in \code{RcppExports.cpp}
282-
if it is present in either the \code{inst/include} or \code{src}.
283-
\item \code{sourceCpp} was modified to allow includes of local files
275+
if it is present in either the \code{inst/include} or \code{src}.
276+
\item \code{sourceCpp} was modified to allow includes of local files
284277
(e.g. \code{#include "foo.hpp"}). Implementation files (*.cc; *.cpp) corresponding
285278
to local includes are also automatically built if they exist.
286279
\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)