Public Member Functions |
| FixedVector (std::size_t sz) |
| Create a vector, leaving its contents uninitialized (for POD types) or default constructed.
|
template<typename U > |
| FixedVector (std::size_t sz, const U &fill_value) |
| Create a vector, and fill with a specified initial value.
|
template<typename V > |
| FixedVector (const V &source, size_t index) |
| Pick a single element from a vector.
|
| FixedVector (const FixedVector< T, ST, Initializer > &pattern) |
| Copy constructor.
|
template<typename FwdIter > |
| FixedVector (FwdIter from, FwdIter to) |
| Constructor from range.
|
T & | operator[] (unsigned int index) |
| Element access.
|
const T & | operator[] (unsigned int index) const |
| Read-only element access.
|
iterator | begin () |
| Iterator designating first element.
|
const_iterator | begin () const |
| Const iterator designating first element.
|
iterator | end () |
| One-past-the-end iterator.
|
const_iterator | end () const |
| One-past-the-end const_iterator.
|
void | setSize (std::size_t new_size) |
| Adjust the number of elements in the vector.
|
FixedVector< T, ST, Initializer > * | clone () const |
| Return pointer to a copy of this object.
|
const char * | typeName () const |
| Name within R of this type of object.
|
void | visitReferents (const_visitor *v) const |
| Conduct a visitor to the nodes referred to by this one.
|
template<> |
const char * | staticTypeName () |
| The name by which this type is known in R.
|
template<> |
const char * | staticTypeName () |
| The name by which this type is known in R.
|
template<> |
const char * | staticTypeName () |
| The name by which this type is known in R.
|
template<> |
const char * | staticTypeName () |
| The name by which this type is known in R.
|
template<> |
const char * | staticTypeName () |
| The name by which this type is known in R.
|
template<> |
const char * | staticTypeName () |
| The name by which this type is known in R.
|
template<> |
const char * | staticTypeName () |
| The name by which this type is known in R.
|
template<> |
const char * | staticTypeName () |
| The name by which this type is known in R.
|
| VectorBase (SEXPTYPE stype, std::size_t sz) |
| VectorBase (const VectorBase &pattern) |
| Copy constructor.
|
const ListVector * | dimensionNames () const |
| Names associated with the rows, columns or other dimensions of an R matrix or array.
|
const StringVector * | dimensionNames (unsigned int d) const |
| Names associated with a particular dimension of an R matrix or array.
|
const IntVector * | dimensions () const |
| Dimensions of R matrix or array.
|
const StringVector * | names () const |
| Names of vector elements.
|
void | setDimensionNames (ListVector *names) |
| Associate names with the rows, columns or other dimensions of an R matrix or array.
|
void | setDimensionNames (unsigned int d, StringVector *names) |
| Associate names with a particular dimension of an R matrix or array.
|
void | setDimensions (IntVector *dims) |
| Define the dimensions of R matrix or array.
|
void | setNames (StringVector *names) |
| Associate names with the elements of a VectorBase.
|
std::size_t | size () const |
| Number of elements in the vector.
|
virtual const PairList * | attributes () 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 RObject * | evaluate (Environment *env) |
| Evaluate object in a specified Environment.
|
virtual RObject * | getAttribute (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 | expose () const |
| Record that construction of a node is complete.
|
bool | isExposed () const |
| Has this node been exposed to garbage collection?
|
| Link () |
| Default constructor.
|
| Link (HeterogeneousListBase *list) |
| Appending constructor.
|
void | freeLink () |
| Detach Link from any list.
|
Static Public Member Functions |
static const char * | staticTypeName () |
| Name by which this type is known in R.
|
template<class V > |
static V * | resize (const V *pattern, std::size_t new_size) |
| Create an extended or shrunken copy of an R vector.
|
static PairList * | resizeAttributes (const PairList *attributes, std::size_t new_size) |
| Adjust attributes for a resized vector.
|
template<class T > |
static T * | clone (const T *pattern) |
| Return a pointer to a copy of an object.
|
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.
|
template<typename T, SEXPTYPE ST, typename Initializer>
class CXXR::FixedVector< T, ST, Initializer >
R data vector primarily intended for fixed-size use.
This is a general-purpose class template to represent an R data vector, and is intended particularly for the case where the size of the vector is fixed when it is constructed.
Having said that, the template does implement setSize(), primarily to service CR code's occasional use of SETLENGTH(); however, the implementation of this is rather inefficient.
CXXR implements all of CR's built-in vector types using this template.
- Template Parameters:
-
T | The type of the elements of the vector. |
ST | The required SEXPTYPE of the vector. |
Initializer | (optional). Class of function object defining a static member function initialize(RObject*) . (Any return value is discarded.) When a FixedVector object is constructed, this member function is applied to it. This can be used, for example, to apply an R class attribute etc. The default is to do nothing. |
template<typename T , SEXPTYPE ST, typename Initr >
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::VectorBase.