CXXR (C++ R)
Public Types | Public Member Functions | Friends
CXXR::CommandChronicle Class Reference

Record of bindings read by top-level command. More...

#include <CommandChronicle.hpp>

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

List of all members.

Public Types

typedef std::vector< GCEdge
< const Provenance > > 
ParentVector
 Vector type used to record bindings read.

Public Member Functions

 CommandChronicle (const RObject *command_arg)
 Constructor.
const ParentVectorbindingsRead () const
 Vector of bindings read.
void close ()
 Close the CommandChronicle to new entries.
const RObjectcommand () const
 The top-level command.
void readBinding (const Provenance *bdgprov)
 Report reading of a provenance-tracked binding.
void writeBinding (const Provenance *bdgprov)
 Report writing of a provenance-tracked binding.
void detachReferents ()
 Null out all references from this node to other nodes.
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
class Provenance

Additional Inherited Members

- 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::GCNode
virtual ~GCNode ()

Detailed Description

Record of bindings read by top-level command.

This class maintains a record of the provenances of any provenance-tracked bindings read in the course of evaluating a top-level command. The record includes only binding states which were in existence before evaluation of the top-level command started: i.e. the record ignores binding states which are created and subsequently read back in the course of evaluating the top-level command.

The record is in the form of a vector, ordered according to the time when a particular binding state is first read during the evaluation of the top-level command.


Member Typedef Documentation

Vector type used to record bindings read.

This is the type of vector used to record the provenances of the binding states read during the evaluation of a top-level command.


Constructor & Destructor Documentation

CXXR::CommandChronicle::CommandChronicle ( const RObject command_arg)
inline

Constructor.

Parameters:
command_argPointer to the top-level command to which this Chronicle relates. This will usually, but not necessarily, be an Expression.

Member Function Documentation

const ParentVector& CXXR::CommandChronicle::bindingsRead ( ) const
inline

Vector of bindings read.

Returns:
a reference to the vector of the provenances of provenance-tracked binding states read during the evaluation of the top-level command.
void CXXR::CommandChronicle::close ( )
inline

Close the CommandChronicle to new entries.

This function is to be called to signify that evaluation of the top-level command is complete, and that there will therefore be no further calls to readBinding() in respect of this object. This is a cue to release housekeeping data structures.

Note:
The class does not check that there are no further calls to readBinding() in respect of this object, but such calls would result in erroneous behaviour.
const RObject* CXXR::CommandChronicle::command ( ) const
inline

The top-level command.

Returns:
pointer to the top-level command to which this CommandChronicle object relates.
void CommandChronicle::detachReferents ( )
virtual

Null out all references from this node to other nodes.

The referents of this node are those objects (derived from GCNode) designated by a GCEdge within this object. This function changes all GCEdges within this object to encapsulate a null pointer. It is used during the sweep phase of a mark-sweep garbage collection to break up unreachable subgraphs, and in particular to remove reference loops from them. After the application of this method, the GCNode should be regarded as a 'zombie', kept in existence only so other nodes can detach their references to it cleanly (using decRefCount()).

Note:
If this method is reimplemented in a derived class, the reimplemented version must remember to invoke detachReferents() for the immediate base class of the derived class, to ensure that all referents of the object get detached.

Reimplemented from CXXR::GCNode.

void CommandChronicle::readBinding ( const Provenance bdgprov)

Report reading of a provenance-tracked binding.

This function should be called whenever the top-level command reads a Frame::Binding with non-null Provenance.

Parameters:
bdgprovNon-null pointer to the Provenance of a Frame::Binding read by the top-level command.
void CommandChronicle::visitReferents ( const_visitor v) const
virtual

Conduct a visitor to the nodes referred to by this one.

The referents of this node are those objects (derived from GCNode) designated by a GCEdge within this object.

Parameters:
vPointer to the visitor object.
Note:
If this method is reimplemented in a derived class, the reimplemented version must remember to invoke visitReferents() for the immediate base class of the derived class, to ensure that all referents of the object get visited. It is suggested that implementations set up stack-based pointers to all the referents of a node before visiting any of them; in that case, if the (recursive) visiting pushes the node out of the processor cache, there is no need to fetch it back in.

Reimplemented from CXXR::GCNode.

void CommandChronicle::writeBinding ( const Provenance bdgprov)

Report writing of a provenance-tracked binding.

This function should be called whenever the top-level command creates or changes the state of a Frame::Binding with non-null Provenance.

Parameters:
bdgprovNon-null pointer to the Provenance of a Frame::Binding created or modified by the top-level command.

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