MCPcopy Create free account
hub / github.com/RcppCore/Rcpp / SlotProxy

Class SlotProxy

inst/include/Rcpp/proxy/SlotProxy.h:27–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25public:
26
27 class SlotProxy : public GenericProxy<SlotProxy>{
28 public:
29 SlotProxy( CLASS& v, const std::string& name) : parent(v), slot_name(Rf_install(name.c_str())) {
30 if( !R_has_slot( v, slot_name) ){
31 throw no_such_slot(name); // #nocov
32 }
33 }
34
35 SlotProxy& operator=(const SlotProxy& rhs){
36 set( rhs.get() ) ;
37 return *this ;
38 }
39
40 template <typename T> SlotProxy& operator=(const T& rhs);
41
42 template <typename T> operator T() const;
43 inline operator SEXP() const {
44 return get() ;
45 }
46
47 private:
48 CLASS& parent;
49 SEXP slot_name ;
50
51 SEXP get() const {
52 return R_do_slot( parent, slot_name ) ;
53 }
54 void set(SEXP x ) {
55 parent = R_do_slot_assign(parent, slot_name, x);
56 }
57 } ;
58
59 class const_SlotProxy : public GenericProxy<const_SlotProxy> {
60 public:

Callers 1

slotMethod · 0.70

Calls 2

getFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected