CXXR (C++ R)
Public Member Functions | Protected Member Functions
CXXR::LoopBailout Class Reference

Bailout class for R commands 'break' and 'next'. More...

#include <LoopBailout.hpp>

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

List of all members.

Public Member Functions

 LoopBailout (Environment *the_environment, bool next_iteration)
 Constructor.
Environmentenvironment () const
 Target Environment of this LoopBailout.
bool next () const
 Continue with next iteration of the loop (if any)?
void throwException ()
 Throw the corresponding C++ exception.
void visitReferents (const_visitor *v) const
 Conduct a visitor to the nodes referred to by this one.
- Public Member Functions inherited from CXXR::Bailout
 Bailout ()
 Default constructor.
- Public Member Functions inherited from CXXR::RObject
virtual const PairListattributes () const
 Get object attributes.
virtual void clearAttributes ()
 Remove all attributes.
virtual RObjectclone () const
 Return pointer to a copy of this object.
void copyAttribute (const Symbol *name, const RObject *source)
 Copy an attribute from one RObject to another.
void copyAttributes (const RObject *source, bool copyS4)
 Copy attributes from one RObject to another.
virtual RObjectevaluate (Environment *env)
 Evaluate object in a specified Environment.
virtual RObjectgetAttribute (const Symbol *name) const
 Get the value a particular attribute.
virtual bool hasAttributes () const
 Has this object any attributes?
bool hasClass () const
 Has this object the class attribute?
bool isS4Object () const
 Is this an S4 object?
void maybeTraceMemory (const RObject *src)
 Carry out memory tracing.
void maybeTraceMemory (const RObject *src1, const RObject *src2)
 Carry out memory tracing.
void maybeTraceMemory (const RObject *src1, const RObject *src2, const RObject *src3)
 Carry out memory tracing.
bool memoryTraced () const
 Is copying etc. of this object being traced?
virtual unsigned int packGPBits () const
 Reproduce the gp bits field used in CR.
virtual void setAttribute (const Symbol *name, RObject *value)
 Set or remove an attribute.
void setAttributes (const PairList *new_attributes)
 Replace the attributes of an object.
void setMemoryTracing (bool on)
 Enable/disable tracing of copying etc.
void setS4Object (bool on)
 Set the status of this RObject as an S4 object.
SEXPTYPE sexptype () const
 Get an object's SEXPTYPE.
virtual const char * typeName () const
 Name within R of this type of object.
virtual void unpackGPBits (unsigned int gpbits)
 Interpret the gp bits field used in CR.
- 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?

Protected Member Functions

void detachReferents ()
 Null out all references from this node to other nodes.

Detailed Description

Bailout class for R commands 'break' and 'next'.

A Bailout of this class conveys a value back to a computation (typically a Closure application) operating within a specified working Environment, and is used for example to implement the R return command.


Constructor & Destructor Documentation

CXXR::LoopBailout::LoopBailout ( Environment the_environment,
bool  next_iteration 
)
inline

Constructor.

Parameters:
the_environmentPointer to the working Environment of the computational context in which the relevant loop is executing.
next_iterationtrue for 'next'; false for 'break'.

Member Function Documentation

void LoopBailout::detachReferents ( )
protectedvirtual

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::RObject.

Environment* CXXR::LoopBailout::environment ( ) const
inline

Target Environment of this LoopBailout.

Returns:
pointer to the Environment within which this LoopBailout should be caught.
bool CXXR::LoopBailout::next ( ) const
inline

Continue with next iteration of the loop (if any)?

Returns:
true if this LoopException arose from the R 'next' command; false if it arose from 'break'.
void LoopBailout::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::RObject.


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