CXXR (C++ R)
Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends
CXXR::FunctionBase Class Reference

Base class for function types. More...

#include <FunctionBase.h>

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

List of all members.

Public Member Functions

virtual RObjectapply (ArgList *arglist, Environment *env, const Expression *call) const =0
 Apply the function.
void maybeTrace (const Expression *call) const
 Produce a tracing report if appropriate.
void setTracing (bool on)
 Set tracing status.
bool traced () const
 Is this function being traced?
- 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.
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?

Static Public Member Functions

static void enableTracing (bool on)
 Enable/disable function tracing.
static bool isA (const RObject *obj)
 Is an RObject a FunctionBase?
static const char * staticTypeName ()
 The name by which this type is known in R.
static bool tracingEnabled ()
 If function tracing currently enabled?
- Static Public Member Functions inherited from CXXR::RObject
template<class T >
static T * clone (const T *pattern)
 Return a pointer to a copy of an object.
- 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

 FunctionBase (SEXPTYPE stype)
 FunctionBase (const FunctionBase &pattern)
 Copy constructor.
- Protected Member Functions inherited from CXXR::RObject
 RObject (SEXPTYPE stype=CXXSXP)
 RObject (const RObject &pattern)
 Copy constructor.
- Protected Member Functions inherited from CXXR::GCNode
virtual ~GCNode ()

Friends

class boost::serialization::access

Additional Inherited Members

- Public Attributes inherited from CXXR::RObject
unsigned char m_named
unsigned m_missing: 2
unsigned m_argused: 2
bool m_active_binding: 1
bool m_binding_locked: 1

Detailed Description

Base class for function types.


Constructor & Destructor Documentation

CXXR::FunctionBase::FunctionBase ( SEXPTYPE  stype)
inlineexplicitprotected
Parameters:
stypeRequired type of the FunctionBase.
CXXR::FunctionBase::FunctionBase ( const FunctionBase pattern)
inlineprotected

Copy constructor.

Parameters:
patternFunctionBase to be copied.

Member Function Documentation

virtual RObject* CXXR::FunctionBase::apply ( ArgList arglist,
Environment env,
const Expression call 
) const
pure virtual

Apply the function.

Parameters:
arglistNon-null pointer to the ArgList containing the list of arguments with which the function is to be invoked.
envPointer to the Environment in which the function is to be evaluated.
callPointer to the Expression calling the function.
Returns:
The result of applying the function.

Implemented in CXXR::BuiltInFunction, and CXXR::Closure.

static void CXXR::FunctionBase::enableTracing ( bool  on)
inlinestatic

Enable/disable function tracing.

Parameters:
onTrue iff function tracing is to be enabled.
static bool CXXR::FunctionBase::isA ( const RObject obj)
inlinestatic

Is an RObject a FunctionBase?

Parameters:
objPointer to RObject to be tested. This may be a null pointer, in which case the function returns false.
Returns:
true iff obj is a FunctionBase.
void CXXR::FunctionBase::maybeTrace ( const Expression call) const
inline

Produce a tracing report if appropriate.

A tracing report is generated if this function is set to be traced and tracing in general is enabled.

Parameters:
callThe call to this function to be reported.
void CXXR::FunctionBase::setTracing ( bool  on)
inline

Set tracing status.

Parameters:
onTrue iff it is required to monitor calls to this function object.
static const char* CXXR::FunctionBase::staticTypeName ( )
inlinestatic

The name by which this type is known in R.

Returns:
the name by which this type is known in R.

Reimplemented in CXXR::BuiltInFunction, and CXXR::Closure.

bool CXXR::FunctionBase::traced ( ) const
inline

Is this function being traced?

Returns:
true if this function object is currently being traced.
static bool CXXR::FunctionBase::tracingEnabled ( )
inlinestatic

If function tracing currently enabled?

Returns:
true iff function tracing is currently enabled.

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