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

Class FieldProxy

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

Source from the content-addressed store, hash-verified

25public:
26
27 class FieldProxy : public GenericProxy<FieldProxy> {
28 public:
29 FieldProxy( CLASS& v, const std::string& name) :
30 parent(v), field_name(name) {}
31
32 FieldProxy& operator=(const FieldProxy& rhs);
33
34 template <typename T> FieldProxy& operator=(const T& rhs);
35
36 template <typename T> operator T() const;
37 inline operator SEXP() const { return get(); }
38
39 private:
40 CLASS& parent;
41 const std::string& field_name ;
42
43 SEXP get() const {
44 Shield<SEXP> str(Rf_mkString(field_name.c_str()));
45 Shield<SEXP> call(Rf_lang3(R_DollarSymbol, parent, str));
46 return Rcpp_fast_eval( call, R_GlobalEnv ) ;
47 }
48 void set(SEXP x ) {
49 SEXP dollarGetsSym = Rf_install( "$<-");
50 Shield<SEXP> str(Rf_mkString(field_name.c_str()));
51 Shield<SEXP> call(Rf_lang4(dollarGetsSym, parent, str, x));
52 parent.set__( Rcpp_fast_eval( call, R_GlobalEnv ) );
53 }
54 } ;
55
56 class const_FieldProxy : public GenericProxy<const_FieldProxy> {
57 public:

Callers 1

fieldMethod · 0.85

Calls 1

getFunction · 0.85

Tested by

no test coverage detected