#include <Obstack_T.h>
Collaboration diagram for ACE_Obstack_T< CHAR >:
Public Member Functions | |
ACE_Obstack_T (size_t size=(4096 *sizeof(CHAR))-sizeof(ACE_Obchunk), ACE_Allocator *allocator_strategy=0) | |
~ACE_Obstack_T (void) | |
int | request (size_t len) |
CHAR * | grow (CHAR c) |
void | grow_fast (CHAR c) |
CHAR * | freeze (void) |
CHAR * | copy (const CHAR *data, size_t len) |
size_t | length (void) const |
size_t | size (void) const |
void | unwind (void *obj) |
void | release (void) |
void | dump (void) const |
Dump the state of an object. | |
Public Attributes | |
ACE_ALLOC_HOOK_DECLARE | |
Declare the dynamic allocation hooks. | |
Protected Member Functions | |
ACE_Obchunk * | new_chunk (void) |
void | unwind_i (void *obj) |
Protected Attributes | |
ACE_Allocator * | allocator_strategy_ |
Pointer to the allocator used by this Obstack. | |
size_t | size_ |
Current size of the Obstack;. | |
ACE_Obchunk * | head_ |
Head of the Obchunk chain. | |
ACE_Obchunk * | curr_ |
Pointer to the current Obchunk. |
The implementation is similar to the GNU obstack utility, which is used extensively in the GCC compiler.
ACE_Obstack_T< CHAR >::ACE_Obstack_T | ( | size_t | size = (4096 *sizeof(CHAR))-sizeof(ACE_Obchunk) , |
|
ACE_Allocator * | allocator_strategy = 0 | |||
) | [inline] |
ACE_Obstack_T< CHAR >::~ACE_Obstack_T | ( | void | ) | [inline] |
int ACE_Obstack_T< CHAR >::request | ( | size_t | len | ) | [inline] |
Request Obstack to prepare a block at least len long for building a new string. Return -1 if fail, 0 if success.
CHAR * ACE_Obstack_T< CHAR >::grow | ( | CHAR | c | ) | [inline] |
Inserting a new CHAR c into the current building block without freezing (null terminating) the block. This function will create new chunk by checking the boundary of current Obchunk. Return the location c gets inserted to, or 0 if error.
void ACE_Obstack_T< CHAR >::grow_fast | ( | CHAR | c | ) | [inline] |
Inserting a new CHAR c into the current building block without freezing (null terminating) the block and without checking for out-of-bound error.
CHAR * ACE_Obstack_T< CHAR >::freeze | ( | void | ) | [inline] |
Freeze the current building block by null terminating it. Return the starting address of the current building block, 0 if error occurs.
CHAR * ACE_Obstack_T< CHAR >::copy | ( | const CHAR * | data, | |
size_t | len | |||
) | [inline] |
Copy the data into the current Obchunk and freeze the current block. Return the starting address of the current building block, 0 if error occurs. len specify the string length, not the actually data size.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE size_t ACE_Obstack_T< CHAR >::length | ( | void | ) | const [inline] |
Return the maximum length or size of a string that can be put into this Obstack. size = length * sizeof (CHAR).
ACE_INLINE size_t ACE_Obstack_T< CHAR >::size | ( | void | ) | const [inline] |
void ACE_Obstack_T< CHAR >::unwind | ( | void * | obj | ) | [inline] |
"Unwind" the stack. If obj is a null pointer, everything allocated in the stack is released. Otherwise, obj must be an address of an object allocated in the stack. In this case, obj is released along with everthing allocated in the Obstack since obj.
void ACE_Obstack_T< CHAR >::release | ( | void | ) | [inline] |
"Release" the entire stack of Obchunks, putting it back on the free list.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL void ACE_Obstack_T< CHAR >::dump | ( | void | ) | const [inline] |
Dump the state of an object.
ACE_Obchunk * ACE_Obstack_T< CHAR >::new_chunk | ( | void | ) | [inline, protected] |
void ACE_Obstack_T< CHAR >::unwind_i | ( | void * | obj | ) | [inline, protected] |
Search through the list of Obchunks and release them. Helper funtion used by unwind.
ACE_Obstack_T< CHAR >::ACE_ALLOC_HOOK_DECLARE |
Declare the dynamic allocation hooks.
ACE_Allocator* ACE_Obstack_T< CHAR >::allocator_strategy_ [protected] |
Pointer to the allocator used by this Obstack.
size_t ACE_Obstack_T< CHAR >::size_ [protected] |
Current size of the Obstack;.
class ACE_Obchunk* ACE_Obstack_T< CHAR >::head_ [protected] |
Head of the Obchunk chain.
class ACE_Obchunk* ACE_Obstack_T< CHAR >::curr_ [protected] |
Pointer to the current Obchunk.