Collaboration diagram for CThingStack:
Public Member Functions | |
CThingStack () | |
The CThingStack contstructor simply calls the Construct function. | |
~CThingStack () | |
The CThingStack destructor simply calls the Destruct function. | |
void | Construct () |
The Constructor function sets the head pointer to NULL. | |
void | Destruct () |
The Destruct function simply calls the Empty function. | |
void | PushBareRef (CThing *objptr) |
This function creates a new bare reference type of stack object and pushes it to the top of the stack. | |
void | PushStrRef (CThing *objptr, unsigned long offset) |
This function creates a new string reference type of stack object and pushes it to the top of the stack. | |
void | PushStackBlock () |
This function creates a new stack block type of StackObj and pushes it to the top of the stack. | |
void | PushStackObject (StackObj *s) |
This function pushes a stack object "as is" to the top of the stack. | |
StackObj * | GetTop () const |
This function returns the first StackObj in the stack. | |
StackObj * | GetN (unsigned long depth) const |
This function returns the elemtent with the given distance from the top of the stack. | |
StackObj * | GetFunc () |
This function returns the first StackObj before a stack block or before the end of the stack, whichever is first. | |
StackObj * | Pop () |
This function is the standard pop operation for stacks. | |
void | Empty () |
This function loops through the stack and releases the memory associated with each StackObj. | |
bool | IsEmpty () const |
Determines if the stack has any elements in it. | |
void | Reverse () |
This function reverses the order of elements in the stack. | |
void | ConvertStackToBares () |
The ConvertStackToBares function turns all string reference objects in the stack into bare reference objects. | |
CThingStack * | GetASubStack () |
Returns a sub-stack that has had all of its string reference type StackObj objects converted to bare references. | |
CThingStack * | GetASubStackUnsafe () |
This function returns a new sub-stack from an existing stack. | |
unsigned int | NumberOfObjects () const |
This function returns the number of elements that are a member of the stack. | |
Private Attributes | |
StackObj * | head |
The top of the stack. |
It is often used to store the parameters, return values, usings, or current stack of a function call. A CThingStack may store several different kinds of references.
|
The CThingStack contstructor simply calls the Construct function.
|
|
The CThingStack destructor simply calls the Destruct function.
|
|
The ConvertStackToBares function turns all string reference objects in the stack into bare reference objects. This function is usually called before passing a stack to a function and on the return values from a function call, because in both these cases a string reference may be invalid.
|
|
The Destruct function simply calls the Empty function.
|
|
This function loops through the stack and releases the memory associated with each StackObj. Any CThing objects pointed to by StackObjs in the stack have ReleaseCThing called on them. After this function has finished head is NULL.
|
|
Returns a sub-stack that has had all of its string reference type StackObj objects converted to bare references. This is implemented though a call to CThingStack::GetASubStackUnsafe()
|
|
This function returns a new sub-stack from an existing stack. A sub-stack consists of all the elements in the existing stack up until a stack block is enountered or the end of the stack. The elements in the new sub-stack are the reverse of what they were in the parent stack. The elements in the sub-stack are removed from the parent stack, as is the stack block it stopped at, if any. The stack block however is not put on the sub-stack. The new sub-stack has its memory allocated by the def memory manger variable.
|
|
This function returns the first StackObj before a stack block or before the end of the stack, whichever is first. The StackObj returned by this function is removed from the stack. This function is used to find the rebi that should be called upon being executed, as the function to be called is the first rebi on the stack or the first one after a stack block.
|
|
This function returns the elemtent with the given distance from the top of the stack. 0 is considered the top of the stack.
|
|
This function returns the first StackObj in the stack. This function does not pop the value from the stack.
|
|
Determines if the stack has any elements in it.
|
|
This function returns the number of elements that are a member of the stack.
|
|
This function is the standard pop operation for stacks.
|
|
This function creates a new bare reference type of stack object and pushes it to the top of the stack. This function does not alter the reference count of the rebi.
|
|
This function creates a new stack block type of StackObj and pushes it to the top of the stack.
|
|
This function pushes a stack object "as is" to the top of the stack. StackObj objects pushed in this way should be either returns from Pop or GetFunc calls, or dynamically allocated memory. Freeing the memory associated with a StackObj after it has been added to the stack, adding non-dynamically allocated StackObj objects, or adding the same StackObj to more than one stack or to the same stack more than once is an error.
|
|
This function creates a new string reference type of stack object and pushes it to the top of the stack. This function does not alter the reference count of the rebi.
|