File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2121
2222namespace Rcpp {
2323
24- class WeakReference :
25- RCPP_POLICIES (WeakReference)
26- {
24+ RCPP_API_CLASS (WeakReference_Impl) {
2725 public:
2826
29- RCPP_GENERATE_CTOR_ASSIGN (WeakReference )
27+ RCPP_GENERATE_CTOR_ASSIGN__ (WeakReference_Impl )
3028
3129 /* *
3230 * wraps a weak reference
@@ -35,17 +33,25 @@ namespace Rcpp{
3533 *
3634 * @throw not_compatible if x is not a weak reference
3735 */
38- WeakReference ( SEXP x) ;
36+ WeakReference_Impl ( SEXP x){
37+ if ( TYPEOF (x) != WEAKREFSXP )
38+ throw not_compatible ( " not a weak reference" ) ;
39+ Storage::set__ (x) ;
40+ }
3941
4042 /* *
4143 * Retrieve the key
4244 */
43- SEXP key () ;
45+ SEXP key () {
46+ return R_WeakRefKey (Storage::get__ ()) ;
47+ }
4448
4549 /* *
4650 * Retrieve the value
4751 */
48- SEXP value () ;
52+ SEXP value (){
53+ return R_WeakRefValue (Storage::get__ ());
54+ }
4955
5056 void update (SEXP){}
5157 } ;
Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ namespace Rcpp{
9797 RCPP_API_CLASS_DECL (Pairlist) ;
9898 RCPP_API_CLASS_DECL (Environment) ;
9999 RCPP_API_CLASS_DECL (Promise) ;
100- class WeakReference ;
100+ RCPP_API_CLASS_DECL ( WeakReference) ;
101101 class Reference ;
102102 class S4 ;
103103 class Formula ;
Original file line number Diff line number Diff line change @@ -262,20 +262,6 @@ namespace Rcpp {
262262 }
263263 }
264264
265- // {{{ WeakReference
266- WeakReference::WeakReference ( SEXP x) {
267- if ( TYPEOF (x) != WEAKREFSXP )
268- throw not_compatible ( " not a weak reference" ) ;
269- set__ (x) ;
270- }
271-
272- SEXP WeakReference::key () {
273- return R_WeakRefKey (get__ ()) ;
274- }
275-
276- SEXP WeakReference::value () {
277- return R_WeakRefValue (get__ ());
278- }
279265 // }}}
280266
281267 // {{{ Symbol
You can’t perform that action at this time.
0 commit comments