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

S4 object. More...

#include <S4Object.h>

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

List of all members.

Public Member Functions

 S4Object ()
 Default constructor.
 S4Object (const S4Object &pattern)
 Copy constructor.
S4Objectclone () const
 Return pointer to a copy of this object.
const char * typeName () const
 Name within R of this type of object.
- Public Member Functions inherited from CXXR::RObject
virtual const PairListattributes () const
 Get object attributes.
virtual void clearAttributes ()
 Remove all attributes.
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 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 const char * staticTypeName ()
 The name by which this type is known in R.
- 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.

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
- 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 ()

Detailed Description

S4 object.

This class is used to implement S4 classes that do not extend objects of another R type, and corresponds to the SEXPTYPE S4SXP.

Note:
The 'R Internals' document says that S4SXP objects have a tag field. This is not currently implemented in CXXR.

Constructor & Destructor Documentation

CXXR::S4Object::S4Object ( const S4Object pattern)
inline

Copy constructor.

Parameters:
patternS4Object to be copied.

Member Function Documentation

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

Return pointer to a copy of this object.

This function creates a copy of this object, and returns a pointer to that copy.

Generally this function (and the copy constructors it utilises) will attempt to create a 'deep' copy of the object; this follows standard practice within C++, and it is intended to extend this practice as CXXR development continues.

However, if the pattern object contains unclonable subobjects, then the created copy will at the relevant places simply contain pointers to those subobjects, i.e. to that extent the copy is 'shallow'. This is managed using the smart pointers defined by nested class RObject::Handle.

Returns:
a pointer to a clone of this object, or a null pointer if this object cannot be cloned.
Note:
Derived classes should exploit the covariant return type facility to return a pointer to the type of object being cloned.

Reimplemented from CXXR::RObject.

static const char* CXXR::S4Object::staticTypeName ( )
inlinestatic

The name by which this type is known in R.

Returns:
the name by which this type is known in R.
const char* CXXR::S4Object::typeName ( ) const
virtual

Name within R of this type of object.

Returns:
the name by which this type of object is known within R.

Reimplemented from CXXR::RObject.


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