Rcpp Version 0.9.10
Rcpp::RObject Class Reference

#include <RObject.h>

Inheritance diagram for Rcpp::RObject:

List of all members.

Classes

class  AttributeProxy
class  SlotProxy

Public Member Functions

 RObject ()
 RObject (SEXP x)
 RObject (const RObject &other)
RObjectoperator= (const RObject &other)
RObjectoperator= (SEXP other)
virtual ~RObject ()
 operator SEXP () const
bool inherits (const char *clazz) const
std::vector< std::string > attributeNames () const
bool hasAttribute (const std::string &attr) const
AttributeProxy attr (const std::string &name) const
bool isNULL () const
int sexp_type () const
SEXP asSexp () const
bool isObject () const
bool isS4 () const
bool hasSlot (const std::string &name) const
SlotProxy slot (const std::string &name) const

Protected Member Functions

void setSEXP (SEXP x)

Protected Attributes

SEXP m_sexp

Private Member Functions

void preserve ()
void release ()
virtual void update ()

Friends

class SlotProxy

Detailed Description

Examples:

RcppInline/RObject.r.

Definition at line 48 of file RObject.h.


Constructor & Destructor Documentation

Rcpp::RObject::RObject ( ) [inline]

default constructor. uses R_NilValue

Definition at line 54 of file RObject.h.

Rcpp::RObject::RObject ( SEXP  x) [inline]

wraps a SEXP. The SEXP is automatically protected from garbage collection by this object and the protection vanishes when this object is destroyed

Definition at line 61 of file RObject.h.

References setSEXP().

Here is the call graph for this function:

Rcpp::RObject::RObject ( const RObject other)

Copy constructor. set this SEXP to the SEXP of the copied object

Definition at line 85 of file RObject.cpp.

References asSexp(), setSEXP(), and x.

Here is the call graph for this function:

Rcpp::RObject::~RObject ( ) [virtual]

Removes the protection. The enclosed SEXP becomes subject to garbage collection, if not otherwise protected

Definition at line 101 of file RObject.cpp.

References logTxt, and release().

Here is the call graph for this function:


Member Function Documentation

RObject::AttributeProxy Rcpp::RObject::attr ( const std::string &  name) const

extract or set the given attribute

Parameters:
namename of the attribute to get/set
Returns:
this returns a proxy to the given attribute. Depending on whether the proxy is used as a lhs or a rhs the attribute is either set (if the proxy is used on the lhs) or extracted (if the proxy is used on the rhs).

RObject y = x.attr("foo") ; // rhs : get the attribute x.attr( "bar" ) = 10 ; // lhs : set the attribute.

wrap is called on the right side of the assignment it can be anything wrap can handle.

Examples:
RcppInline/RObject.r.

Definition at line 181 of file RObject.cpp.

Referenced by Rcpp::S4::is().

std::vector< std::string > Rcpp::RObject::attributeNames ( ) const

extracts the names of the attributes of the wrapped SEXP

Examples:
RcppInline/RObject.r.

Definition at line 106 of file RObject.cpp.

References m_sexp, R_NilValue, and v.

bool Rcpp::RObject::hasAttribute ( const std::string &  attr) const

Identifies if the SEXP has the given attribute

Examples:
RcppInline/RObject.r.

Definition at line 118 of file RObject.cpp.

References m_sexp, and R_NilValue.

bool Rcpp::RObject::hasSlot ( const std::string &  name) const

Indicates if this S4 object has the given slot

Exceptions:
not_s4if the object is not an S4 object

Definition at line 187 of file RObject.cpp.

References m_sexp.

bool Rcpp::RObject::inherits ( const char *  clazz) const [inline]

Does this object inherit from a given class

Definition at line 92 of file RObject.h.

References m_sexp.

bool Rcpp::RObject::isNULL ( ) const [inline]

is this object NULL

Examples:
RcppInline/RObject.r.

Definition at line 234 of file RObject.h.

References m_sexp.

Referenced by Rcpp::DottedPair::insert(), and Rcpp::DottedPair::push_back().

bool Rcpp::RObject::isObject ( ) const [inline]

Tests if the SEXP has the object bit set

Definition at line 249 of file RObject.h.

References m_sexp.

bool Rcpp::RObject::isS4 ( ) const [inline]

Tests if the SEXP is an S4 object

Definition at line 254 of file RObject.h.

References m_sexp.

Rcpp::RObject::operator SEXP ( ) const [inline]

implicit conversion to SEXP.

Definition at line 87 of file RObject.h.

References m_sexp.

RObject & Rcpp::RObject::operator= ( SEXP  other)

Assignement operator. Set this SEXP to the given SEXP

Reimplemented in Rcpp::Reference, and Rcpp::S4.

Definition at line 96 of file RObject.cpp.

References setSEXP().

Here is the call graph for this function:

RObject & Rcpp::RObject::operator= ( const RObject other)

Assignment operator. set this SEXP to the SEXP of the copied object

Definition at line 90 of file RObject.cpp.

References asSexp(), setSEXP(), and x.

Here is the call graph for this function:

void Rcpp::RObject::preserve ( ) [inline, private]

Definition at line 291 of file RObject.h.

References m_sexp, and R_NilValue.

Referenced by setSEXP().

void Rcpp::RObject::release ( ) [inline, private]

Definition at line 292 of file RObject.h.

References m_sexp, and R_NilValue.

Referenced by setSEXP(), and ~RObject().

int Rcpp::RObject::sexp_type ( ) const [inline]

The SEXP typeof, calls TYPEOF on the underlying SEXP

Definition at line 239 of file RObject.h.

References m_sexp.

RObject::SlotProxy Rcpp::RObject::slot ( const std::string &  name) const

Retrieves the given slot

Exceptions:
not_s4if this is not an S4 object

Definition at line 192 of file RObject.cpp.

References m_sexp, and SlotProxy.

Referenced by Rcpp::CppClass::CppClass(), and Rcpp::CppObject::CppObject().

virtual void Rcpp::RObject::update ( ) [inline, private, virtual]

Reimplemented in Rcpp::Language.

Definition at line 294 of file RObject.h.

References m_sexp, and RCPP_DEBUG_1.

Referenced by setSEXP().


Friends And Related Function Documentation

friend class SlotProxy [friend]

Definition at line 211 of file RObject.h.

Referenced by slot().


Member Data Documentation

SEXP Rcpp::RObject::m_sexp [protected]

The SEXP this is wrapping. This has to be considered read only. to change it, use setSEXP

Definition at line 283 of file RObject.h.

Referenced by asSexp(), Rcpp::Environment::assign(), attributeNames(), Rcpp::Environment::bindingIsActive(), Rcpp::Environment::bindingIsLocked(), Rcpp::Function::body(), Rcpp::Symbol::c_str(), Rcpp::Promise::environment(), Rcpp::Function::environment(), Rcpp::Language::eval(), Rcpp::Environment::exists(), Rcpp::Promise::expression(), Rcpp::Environment::find(), Rcpp::Environment::get(), hasAttribute(), hasSlot(), inherits(), Rcpp::DottedPair::insert(), Rcpp::Environment::is_user_database(), Rcpp::Environment::isLocked(), isNULL(), isObject(), isS4(), Rcpp::WeakReference::key(), Rcpp::DottedPair::length(), Rcpp::Environment::lock(), Rcpp::Environment::lockBinding(), Rcpp::Environment::ls(), Rcpp::Environment::new_child(), operator SEXP(), Rcpp::XPtr< T, Finalizer >::operator T *(), Rcpp::Function::operator()(), Rcpp::XPtr< T, Finalizer >::operator*(), Rcpp::XPtr< T, Finalizer >::operator->(), Rcpp::Environment::parent(), preserve(), Rcpp::DottedPair::push_back(), Rcpp::DottedPair::push_front(), release(), Rcpp::Environment::remove(), Rcpp::DottedPair::remove(), Rcpp::DottedPair::replace(), Rcpp::Promise::seen(), Rcpp::XPtr< T, Finalizer >::setDeleteFinalizer(), Rcpp::Language::setFunction(), setSEXP(), Rcpp::Language::setSymbol(), sexp_type(), Rcpp::DottedPair::size(), slot(), Rcpp::Environment::unlockBinding(), Rcpp::Language::update(), update(), Rcpp::WeakReference::value(), Rcpp::Promise::value(), and Rcpp::Promise::was_evaluated().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Defines