Class implementing CR's 'pointer protection stack'.
More...
#include <ProtectStack.h>
List of all members.
Static Public Member Functions |
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 | restoreSize (size_t new_size) |
| Restore PPS to a previous size.
|
static size_t | size () |
| Current size of 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 protected objects.
|
Detailed Description
Class implementing CR's 'pointer protection stack'.
All members of this class are static.
Member Function Documentation
static unsigned int CXXR::ProtectStack::protect |
( |
RObject * |
node | ) |
|
|
inlinestatic |
Push a node pointer onto the PPS.
Push a node pointer onto the C pointer protection stack.
- Parameters:
-
node | Pointer to the node to be protected from the garbage collector. |
- Returns:
- Index of the stack cell thus created, for subsequent use with reprotect().
static void CXXR::ProtectStack::reprotect |
( |
RObject * |
node, |
|
|
unsigned int |
index |
|
) |
| |
|
inlinestatic |
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 ProtectStack::Scope as the corresponding protect.
- Parameters:
-
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). |
void ProtectStack::restoreSize |
( |
size_t |
new_size | ) |
|
|
static |
Restore PPS to a previous size.
Restore the C pointer protection stack to a previous size by popping elements off the top.
- Parameters:
-
new_size | The size to which the stack is to be restored. Must not be greater than the current size. |
- Note:
- In future this method will probably cease to be available, since the use of the ProtectStack::Scope class is preferable.
static size_t CXXR::ProtectStack::size |
( |
| ) |
|
|
inlinestatic |
Current size of PPS.
- Returns:
- the current size of the C pointer protection stack.
- Note:
- This method is intended for use in conjunction with restoreSize(), and may cease to be public in future.
static void CXXR::ProtectStack::unprotect |
( |
unsigned int |
count = 1 | ) |
|
|
inlinestatic |
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 ProtectStack::Scope as the corresponding protect.
- Parameters:
-
count | Number of cells to be popped. Must not be larger than the current size of the C pointer protection stack. |
static void CXXR::ProtectStack::unprotectPtr |
( |
RObject * |
node | ) |
|
|
inlinestatic |
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.
- Parameters:
-
node | Pointer to the node whose cell is to be removed from the C pointer protection stack. |
- Deprecated:
- Utterly.
Conduct a const visitor to protected objects.
Conduct a GCNode::const_visitor object to each node on the pointer protection stack.
- Parameters:
-
v | Pointer to the const_visitor object. |
The documentation for this class was generated from the following files: