18 #ifndef Rcpp_proxy_SlotProxy_h
19 #define Rcpp_proxy_SlotProxy_h
23 template <
typename CLASS>
31 throw no_such_slot(name);
42 template <
typename T>
operator T()
const;
43 inline operator SEXP()
const {
63 throw no_such_slot(name);
67 template <
typename T>
operator T()
const {
68 return as<T>(
get() );
70 inline operator SEXP()
const {
84 SEXP x =
static_cast<CLASS&
>(*this) ;
85 if( !Rf_isS4(x) )
throw not_s4() ;
86 return SlotProxy(
static_cast<CLASS&
>(*
this) , name ) ;
89 SEXP x =
static_cast<const CLASS&
>(*this) ;
90 if( !Rf_isS4(x) )
throw not_s4() ;
94 bool hasSlot(
const std::string& name)
const{
95 SEXP x =
static_cast<const CLASS&
>(*this).get__() ;
96 if( !Rf_isS4(x) )
throw not_s4() ;
97 return R_has_slot( x, Rf_mkString(name.c_str()) ) ;
SlotProxy & operator=(const T &rhs)
SlotProxy(CLASS &v, const std::string &name)
SlotProxy & operator=(const SlotProxy &rhs)
const_SlotProxy(const CLASS &v, const std::string &name)
SlotProxy slot(const std::string &name)
bool hasSlot(const std::string &name) const
const_SlotProxy slot(const std::string &name) const