| 25 | namespace Rcpp{ |
| 26 | |
| 27 | RCPP_API_CLASS(WeakReference_Impl) { |
| 28 | public: |
| 29 | RCPP_GENERATE_CTOR_ASSIGN(WeakReference_Impl) |
| 30 | |
| 31 | WeakReference_Impl(){} |
| 32 | |
| 33 | /** |
| 34 | * wraps a weak reference |
| 35 | * |
| 36 | * @param x presumably a SEXP of SEXTYPE WEAKREFSXP |
| 37 | * |
| 38 | * @throw not_compatible if x is not a weak reference |
| 39 | */ |
| 40 | WeakReference_Impl( SEXP x){ |
| 41 | if( TYPEOF(x) != WEAKREFSXP ) |
| 42 | throw not_compatible( "not a weak reference" ) ; |
| 43 | Storage::set__(x); |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * Retrieve the key |
| 48 | */ |
| 49 | SEXP key() const { |
| 50 | return R_WeakRefKey(Storage::get__()) ; |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * Retrieve the value |
| 55 | */ |
| 56 | SEXP value() const { |
| 57 | return R_WeakRefValue(Storage::get__()); |
| 58 | } |
| 59 | |
| 60 | void update(SEXP){} |
| 61 | |
| 62 | } ; |
| 63 | |
| 64 | typedef WeakReference_Impl<PreserveStorage> WeakReference ; |
| 65 | } |
nothing calls this directly
no outgoing calls
no test coverage detected