CXXR (C++ R) API
|
Untemplated base class for GCStackRoot. More...
#include <GCStackRoot.h>
Static Public Member Functions | |
static void | ppsRestoreSize (size_t new_size) |
Restore PPS to a previous size. | |
static size_t | ppsSize () |
Current size of PPS. | |
static unsigned int | protect (RObject *node) |
Push a node pointer onto the PPS. | |
static void | reprotect (RObject *node, unsigned int index) |
Change the target of a pointer on the PPS. | |
static void | unprotect (unsigned int count=1) |
Pop pointers from the PPS. | |
static void | unprotectPtr (RObject *node) |
static void | visitRoots (GCNode::const_visitor *v) |
Conduct a const visitor to all 'root' GCNode objects. | |
static void | visitRoots (GCNode::const_visitor *v) |
Conduct a const visitor to protected objects. |
Protected Member Functions | |
GCStackRootBase (const GCNode *node) | |
GCStackRootBase (const GCStackRootBase &source) | |
GCStackRootBase & | operator= (const GCStackRootBase &source) |
void | redirect (const GCNode *node) |
Change the node protected by this GCStackRootBase. | |
const GCNode * | ptr () const |
Access the encapsulated pointer. | |
GCStackRootBase (const GCNode *node) | |
Primary constructor. | |
GCStackRootBase (const GCStackRootBase &source) | |
Copy constructor. | |
GCStackRootBase & | operator= (const GCStackRootBase &source) |
void | retarget (const GCNode *node) |
Change the node protected by this GCStackRootBase. | |
const GCNode * | ptr () const |
Access the encapsulated pointer. |
Friends | |
class | GCNode |
Untemplated base class for GCStackRoot.
The preferred method for C++ code to protect a GCNode from the garbage collector is to use the templated class GCStackRoot, of which this is the untemplated base class, or class GCRoot.
However, GCStackRoot is not usable by C code, which should continue to use PROTECT(), UNPROTECT() etc. as in CR. However, these functions have been reimplemented to manipulate a C pointer protection stack (as we shall call it, despite the fact that it's implemented in C++) encapsulated as a static member within GCStackRootBase.
The preferred method for C++ code to protect a GCNode from the garbage collector is to use the templated class GCStackRoot, of which this is the untemplated base class, or class GCRoot.
However, GCStackRoot is not usable by C code, which should continue to use PROTECT(), UNPROTECT() etc. as in CR, which are implemented in CXXR via class ProtectStack.
|
inlineprotected |
Primary constructor.
node | Pointer to be encapsulated by the GCStackRootBase. |
|
inlineprotected |
Copy constructor.
source | Pattern for the copy. |
|
static |
Restore PPS to a previous size.
Restore the C pointer protection stack to a previous size by popping elements off the top.
new_size | The size to which the stack is to be restored. Must not be greater than the current size. |
|
inlinestatic |
Current size of PPS.
|
static |
Push a node pointer onto the PPS.
Push a node pointer onto the C pointer protection stack.
node | Pointer to the node to be protected from the garbage collector. |
|
inlineprotected |
Access the encapsulated pointer.
|
inlineprotected |
Access the encapsulated pointer.
|
inlineprotected |
Change the node protected by this GCStackRootBase.
node | Pointer to the node now to be protected, or a null pointer. |
|
static |
Change the target of a pointer on the PPS.
Change the node that a particular cell in the C pointer protection stack protects. As a consistency check, it is required that the reprotect takes place within the same Context as the corresponding protect. (CR does not apply this check.)
node | Pointer to the node now to be protected from the garbage collector by the designated stack cell. (Not necessarily a different node from the one currently protected.) |
index | Index (as returned by protect() ) of the stack cell to be retargeted to node. Must be less than the current size of the C pointer protection stack (checked). |
|
inlineprotected |
Change the node protected by this GCStackRootBase.
node | Pointer to the node now to be protected, or a null pointer. |
|
static |
Pop pointers from the PPS.
Pop cells from the C pointer protection stack. As a consistency check, it is required that the unprotect takes place within the same Context as the corresponding protect. (CR does not apply this check.)
count | Number of cells to be popped. Must not be larger than the current size of the C pointer protection stack. |
|
static |
Removes from the C pointer protection stack the uppermost stack cell containing a pointer to a specified node, and drops all the stack cells above it by one place.
node | Pointer to the node whose cell is to be removed from the C pointer protection stack. |
|
static |
Conduct a const visitor to protected objects.
Conduct a GCNode::const_visitor object to each node pointed to by a GCStackRootBase.
v | Pointer to the const_visitor object. |
|
static |
Conduct a const visitor to all 'root' GCNode objects.
Conduct a GCNode::const_visitor object to each root GCNode and each node on the C pointer protection stack.
v | Pointer to the const_visitor object. |