CXXR (C++ R) API
Public Member Functions | Friends
CXXR::StdFrame Class Reference

General-purpose implementation of CXXR::Frame. More...

#include <StdFrame.hpp>

Inheritance diagram for CXXR::StdFrame:
Inheritance graph
[legend]
Collaboration diagram for CXXR::StdFrame:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 StdFrame (std::size_t initial_capacity=15)
Bindingbinding (const Symbol *symbol)
 Access binding of an already-defined Symbol.
const Bindingbinding (const Symbol *symbol) const
 Access const binding of an already-defined Symbol.
BindingRange bindingRange () const
 Obtain a BindingRange for this Frame.
StdFrameclone () const
 Return pointer to a copy of this Frame.
void lockBindings ()
 Lock all Bindings in this Frame.
std::size_t size () const
 Number of Bindings in Frame.
- Public Member Functions inherited from CXXR::Frame
 Frame (const Frame &source)
 Copy constructor.
PairListasPairList () const
 Get contents as a PairList.
Bindingbind (const Symbol *symbol, RObject *value, Frame::Binding::Origin origin=Frame::Binding::EXPLICIT)
 Bind a Symbol to a specified value.
void clear ()
 Remove all symbols from the Frame.
void enableReadMonitoring (bool on) const
 Enable monitored reading of Symbol values.
void enableWriteMonitoring (bool on) const
 Enable monitored writing of Symbol values.
bool erase (const Symbol *symbol)
 Remove the Binding (if any) of a Symbol.
bool isLocked () const
 Is the Frame locked?
void lock (bool lock_bindings)
 Lock this Frame.
BindingobtainBinding (const Symbol *symbol)
 Get or create a Binding for a Symbol.
std::vector< const Symbol * > symbols (bool include_dotsymbols) const
 Symbols bound by this Frame.
void visitReferents (const_visitor *v) const
 Conduct a visitor to the nodes referred to by this one.
- Public Member Functions inherited from CXXR::GCNode
void expose () const
 Record that construction of a node is complete.
bool isExposed () const
 Has this node been exposed to garbage collection?

Friends

class boost::serialization::access

Additional Inherited Members

- Public Types inherited from CXXR::Frame
typedef boost::any_range
< const Binding,
boost::forward_traversal_tag,
const Binding
&, std::ptrdiff_t > 
BindingRange
 Allow iteration over a Frame object's Bindings.
typedef void(* monitor )(const Binding &)
 Function type for read and write monitors.
- Static Public Member Functions inherited from CXXR::Frame
static monitor setReadMonitor (monitor new_monitor)
 Define function to monitor reading of Symbol values.
static monitor setWriteMonitor (monitor new_monitor)
 Define function to monitor writing of Symbol values.
- Static Public Member Functions inherited from CXXR::GCNode
static void * operator new (size_t bytes)
 Allocate memory.
static void * operator new (size_t, void *where)
 Placement new for GCNode.
static void operator delete (void *p, size_t bytes)
 Deallocate memory.
static bool check ()
 Integrity check.
template<class T >
static T * expose (T *node)
 Record that construction of a node is complete.
static void gc ()
 Initiate a garbage collection.
static void gclite ()
 Lightweight garbage collection.
static void maybeCheckExposed (const GCNode *node)
 Subject to configuration, check that a GCNode is exposed.
static size_t numNodes ()
 Number of GCNode objects in existence.
- Protected Member Functions inherited from CXXR::Frame
void statusChanged (const Symbol *sym)
 Report change in the bound/unbound status of Symbol objects.
void detachReferents ()
 Null out all references from this node to other nodes.
- Protected Member Functions inherited from CXXR::GCNode
virtual ~GCNode ()

Detailed Description

General-purpose implementation of CXXR::Frame.


Constructor & Destructor Documentation

CXXR::StdFrame::StdFrame ( std::size_t  initial_capacity = 15)
explicit
Parameters:
initial_capacityA hint to the implementation that the constructed StdFrame should be configured to have capacity for at least initial_capacity Bindings. This does not impose an upper limit on the capacity of the StdFrame, but some reconfiguration (and consequent time penalty) may occur if it is exceeded.

Member Function Documentation

Binding* CXXR::StdFrame::binding ( const Symbol symbol)
virtual

Access binding of an already-defined Symbol.

This function provides a pointer to the Binding of a Symbol. In this variant the pointer is non-const, and consequently the calling code can use it to modify the Binding (provided the Binding is not locked).

Parameters:
symbolThe Symbol for which a mapping is sought.
Returns:
A pointer to the required binding, or a null pointer if it was not found.

Implements CXXR::Frame.

const Binding* CXXR::StdFrame::binding ( const Symbol symbol) const
virtual

Access const binding of an already-defined Symbol.

This function provides a pointer to a PairList element representing the binding of a symbol. In this variant the pointer is const, and consequently the calling code can use it only to examine the binding.

Parameters:
symbolThe Symbol for which a mapping is sought.
Returns:
A pointer to the required binding, or a null pointer if it was not found..

Implements CXXR::Frame.

BindingRange CXXR::StdFrame::bindingRange ( ) const
virtual

Obtain a BindingRange for this Frame.

Returns:
a BindingRange allowing read-only iteration over the Binding objects within this Frame.

Implements CXXR::Frame.

StdFrame* CXXR::StdFrame::clone ( ) const
virtual

Return pointer to a copy of this Frame.

This function creates a copy of this Frame, and returns a pointer to that copy. The copy will define the same mapping from Symbols to R objects as this Frame; neither the R objects, nor of course the Symbols, are copied as part of the cloning.

The created copy will be locked if this Frame is locked. However, it will not have a read or write monitor.

Returns:
a pointer to a clone of this Frame.
Note:
Derived classes should exploit the covariant return type facility to return a pointer to the type of object being cloned.

Implements CXXR::Frame.

void CXXR::StdFrame::lockBindings ( )
virtual

Lock all Bindings in this Frame.

This operation affects only Bindings currently existing. It does not prevent Bindings being added subsequently, and such Bindings will not be locked.

It is permitted to apply this function to a locked Frame.

Implements CXXR::Frame.

std::size_t CXXR::StdFrame::size ( ) const
virtual

Number of Bindings in Frame.

Returns:
the number of Symbols for which Bindings exist in this Frame.

Implements CXXR::Frame.


The documentation for this class was generated from the following file: