($Id: RObject.h 1351 2013-03-08 15:12:28Z arr $)
Class CXXR::RObject and associated C interface functions.
More...
#include "R_ext/Boolean.h"
#include "CXXR/SEXPTYPE.h"
#include <boost/serialization/access.hpp>
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/nvp.hpp>
#include "CXXR/GCNode_PtrS11n.hpp"
#include "CXXR/RHandle.hpp"
#include "CXXR/uncxxr.h"
Go to the source code of this file.
Namespaces |
namespace | CXXR |
| Namespace for the CXXR project.
|
Functions |
SEXP | ATTRIB (SEXP x) |
| Get the attributes of a CXXR::RObject.
|
void | DUPLICATE_ATTRIB (SEXP to, SEXP from) |
| Replace the attributes of to by those of from.
|
Rboolean | IS_S4_OBJECT (SEXP x) |
| Is this an S4 object?
|
int | LEVELS (SEXP x) |
| (For use only in serialization.)
|
int | NAMED (SEXP x) |
| Get object copying status.
|
Rboolean | OBJECT (SEXP x) |
| Does an object have a class attribute?
|
int | SETLEVELS (SEXP x, int v) |
| (For use only in deserialization.)
|
void | SET_ATTRIB (SEXP x, SEXP v) |
| Replace an object's attributes.
|
void | SET_NAMED (SEXP x, int v) |
| Set object copying status.
|
void | SET_S4_OBJECT (SEXP x) |
SEXPTYPE | TYPEOF (SEXP x) |
| Get object's SEXPTYPE.
|
void | UNSET_S4_OBJECT (SEXP x) |
void | Rf_copyMostAttrib (SEXP inp, SEXP ans) |
| Copy attributes, with some exceptions.
|
SEXP | Rf_getAttrib (SEXP vec, SEXP name) |
| Access a named attribute.
|
Rboolean | Rf_isNull (SEXP s) |
| Is this the null object pointer?
|
Rboolean | Rf_isObject (SEXP s) |
| Does an object have a class attribute?
|
SEXP | Rf_setAttrib (SEXP vec, SEXP name, SEXP val) |
| Set or remove a named attribute.
|
void | maybeTraceMemory1 (SEXP dest, SEXP src) |
| C interface to RObject::traceMemory().
|
void | maybeTraceMemory2 (SEXP dest, SEXP src1, SEXP src2) |
| C interface to RObject::traceMemory().
|
const char * | Rf_type2char (SEXPTYPE st) |
| Name of type within R.
|
Detailed Description
Class CXXR::RObject and associated C interface functions.
Typedef Documentation
Pointer to an RObject.
In CR, almost all interpreter code could access R objects only via the opaque pointer SEXP. In CXXR, C code continues to see SEXP as an opaque pointer, but C++ code sees SEXP defined as 'pointer to RObject'.
- Note:
- This typedef is provided for compatibility with code inherited from CR. New CXXR code should write RObject* explicitly.
Function Documentation
Get the attributes of a CXXR::RObject.
- Parameters:
-
- Returns:
- Pointer to the attributes object of x , or 0 if x is a null pointer.
void DUPLICATE_ATTRIB |
( |
SEXP |
to, |
|
|
SEXP |
from |
|
) |
| |
Replace the attributes of to by those of from.
The status of to as an S4 Object is also copied from from .
- Parameters:
-
Rboolean IS_S4_OBJECT |
( |
SEXP |
x | ) |
|
|
inline |
Is this an S4 object?
- Parameters:
-
- Returns:
- true iff x is an S4 object. Returns false if x is 0.
void maybeTraceMemory1 |
( |
SEXP |
dest, |
|
|
SEXP |
src |
|
) |
| |
C interface to RObject::traceMemory().
This function provides a C language interface to dest->maybeTraceMemory(src)
: see the documentation of that method for details.
- Parameters:
-
dest | Non-null pointer to an RObject. |
src | Non-null pointer to an RObject. |
C interface to RObject::traceMemory().
This function provides a C language interface to dest->maybeTraceMemory(src1, src2)
: see the documentation of that method for details.
- Parameters:
-
dest | Non-null pointer to an RObject. |
src1 | Non-null pointer to an RObject. |
src2 | Non-null pointer to an RObject. |
Get object copying status.
- Parameters:
-
- Returns:
- Refer to 'R Internals' document. Returns 0 if x is a null pointer.
Rboolean OBJECT |
( |
SEXP |
x | ) |
|
|
inline |
Does an object have a class attribute?
- Parameters:
-
- Returns:
- true iff x has a class attribute. Returns false if x is 0.
void Rf_copyMostAttrib |
( |
SEXP |
inp, |
|
|
SEXP |
ans |
|
) |
| |
Copy attributes, with some exceptions.
This is called in the case of binary operations to copy most attributes from one of the input arguments to the output. Note that the Dim, Dimnames and Names attributes are not copied: these should have been assigned elsewhere. The function also copies the S4 object status.
- Parameters:
-
inp | Pointer to the CXXR::RObject from which attributes are to be copied. |
ans | Pointer to the CXXR::RObject to which attributes are to be copied. |
- Note:
- The above documentation is probably incomplete: refer to the source code for further details.
Access a named attribute.
- Parameters:
-
vec | Pointer to the CXXR::RObject whose attributes are to be accessed. |
name | Either a pointer to the symbol representing the required attribute, or a pointer to a CXXR::StringVector containing the required symbol name as element 0; in the latter case, as a side effect, the corresponding symbol is installed if necessary. |
- Returns:
- Pointer to the requested attribute, or a null pointer if there is no such attribute.
- Note:
- The above documentation is incomplete: refer to the source code for further details.
Rboolean Rf_isNull |
( |
SEXP |
s | ) |
|
|
inline |
Rboolean Rf_isObject |
( |
SEXP |
s | ) |
|
|
inline |
Does an object have a class attribute?
- Parameters:
-
- Returns:
- TRUE iff the CXXR::RObject pointed to by s has a class attribute.
Set or remove a named attribute.
- Parameters:
-
vec | Pointer to the CXXR::RObject whose attributes are to be modified. |
name | Either a pointer to the symbol representing the required attribute, or a pointer to a CXXR::StringVector containing the required symbol name as element 0; in the latter case, as a side effect, the corresponding symbol is installed if necessary. |
val | Either the value to which the attribute is to be set, or a null pointer. In the latter case the attribute (if present) is removed. |
- Returns:
- Refer to source code. (Sometimes vec, sometimes val, sometime a null pointer ...)
- Note:
- The above documentation is probably incomplete: refer to the source code for further details.
Name of type within R.
Translate a SEXPTYPE to the name by which it is known within R.
- Parameters:
-
- Returns:
- The SEXPTYPE's name within R.
Replace an object's attributes.
- Parameters:
-
x | Pointer to a CXXR::RObject. |
v | Pointer to a PairList giving the new attributes of x. x should be considered to assume ownership of the 'car' values in v ; they should therefore not be subsequently altered externally. |
- Note:
- Unlike CR, v isn't simply plugged into the attributes field of x : refer to the documentation for
RObject::setAttributes()
. In particular, do not attempt to modify the attributes by changing v after SET_ATTRIB has been called.
-
For compatibility with CR, garbage collection is inhibited within this function.
void SET_NAMED |
( |
SEXP |
x, |
|
|
int |
v |
|
) |
| |
|
inline |
Set object copying status.
- Parameters:
-
x | Pointer to CXXR::RObject. The function does nothing if x is a null pointer. |
v | Refer to 'R Internals' document. |
- Deprecated:
- Ought to be private.
void SET_S4_OBJECT |
( |
SEXP |
x | ) |
|
|
inline |
void UNSET_S4_OBJECT |
( |
SEXP |
x | ) |
|
|
inline |