Rcpp Version 0.9.10
Rcpp::Environment::Binding Class Reference

#include <Environment.h>

Collaboration diagram for Rcpp::Environment::Binding:

List of all members.

Public Member Functions

 Binding (Environment &env, const std::string &name)
bool active () const
bool locked () const
bool exists () const
void lock ()
void unlock ()
Bindingoperator= (const Binding &rhs)
Bindingoperator= (SEXP rhs)
template<typename WRAPPABLE >
Bindingoperator= (const WRAPPABLE &rhs)
template<typename T >
 operator T () const

Private Attributes

Environmentenv
std::string name

Detailed Description

proxy class to allow read and write access to a binding in an environment

Definition at line 42 of file Environment.h.


Constructor & Destructor Documentation

Rcpp::Environment::Binding::Binding ( Environment env,
const std::string &  name 
)

Creates a binding

Parameters:
envenvironment in which the binding is
namename of the binding

Definition at line 225 of file Environment.cpp.


Member Function Documentation

bool Rcpp::Environment::Binding::active ( ) const

Is the binding an active binding

Definition at line 228 of file Environment.cpp.

bool Rcpp::Environment::Binding::exists ( ) const

Is the binding defined

Definition at line 232 of file Environment.cpp.

void Rcpp::Environment::Binding::lock ( )

lock the binding

Definition at line 240 of file Environment.cpp.

bool Rcpp::Environment::Binding::locked ( ) const

Is the binding locked

Definition at line 236 of file Environment.cpp.

template<typename T >
Rcpp::Environment::Binding::operator T ( ) const [inline]

Retrieves the value of the binding as a T object

The requirement on the T type is that as<T> makes sense which can either mean that a specialization exists or that T has a T(SEXP) constructor

Definition at line 136 of file Environment.h.

References Rcpp::Environment::get(), and x.

Here is the call graph for this function:

Environment::Binding & Rcpp::Environment::Binding::operator= ( SEXP  rhs)

Assign the rhs to the binding

For example: Environment e= ... ; // get some environment e["foo"] = SclalarInteger( 10 ) ;

after this e will contain the variable "foo" with the value 10L

Definition at line 248 of file Environment.cpp.

References Rcpp::Environment::assign().

Here is the call graph for this function:

template<typename WRAPPABLE >
Binding& Rcpp::Environment::Binding::operator= ( const WRAPPABLE &  rhs) [inline]

templated assignement. The rhs if first wrapped using one of the forms of "wrap" and then the wrapped value is assigned to the binding

For example: Environment e = ... ; e[ "foo" ] = 10 ; e[ "bar"] = "foobar" ;

vector<int> v; v.push_back(10); v.push_back(20 ); e[ "foo" ] = v ;

with GCC4.4 : e["bla" ] = { 1,2,3};

Definition at line 122 of file Environment.h.

References Rcpp::Environment::assign().

Here is the call graph for this function:

Environment::Binding & Rcpp::Environment::Binding::operator= ( const Binding rhs)

Assigning another binding to this has the effect of assigning the rhs to the environment.

For example : Environment e = ... // get an environment somehow Environment f = ... // get an environment somehow e["x"] = f["y"] ;

after this, the variable x in the environment e will contain the same variable as "y" in the environment "f"

Definition at line 253 of file Environment.cpp.

References Rcpp::Environment::assign(), env, Rcpp::Environment::get(), and name.

Here is the call graph for this function:

void Rcpp::Environment::Binding::unlock ( )

unlock the binding

Definition at line 244 of file Environment.cpp.


Member Data Documentation

Reference to the environment if the binding

Definition at line 146 of file Environment.h.

Referenced by operator=().

std::string Rcpp::Environment::Binding::name [private]

name of the binding

Definition at line 151 of file Environment.h.

Referenced by operator=().


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