#include <lsxml.h>
Inheritance diagram for lsxml::ContextT< _Tag >:
Public Member Functions | |
ContextT (uint blockSize=(4 *4096), int flags=0) | |
Constructs a standard context. | |
ContextT (void *memory, uint size) | |
Constructs a context which uses the specified memory block. | |
~ContextT () | |
Destructor. Destroys managed objects and releases allocated memory. | |
void * | Allocate (uint size, bool temporary=false) |
Allocates memory in this context. | |
bool | IsTemporary (void *mem) |
Checks if the specified pointer belongs to a temporary block. | |
void | MakeCurrent () |
Sets this context as the current one. | |
void | Collect () |
Collects all used memory and resources. | |
void | Manage (ManagedObject *obj) |
Adds the specified object to the list of managed objects. | |
void | Unmanage (ManagedObject *obj) |
Removes the specified object from the list of managed objects. | |
void | BeginFrame () |
Begins an allocation frame. | |
void | EndFrame () |
Ends an allocation frame. | |
Static Public Member Functions | |
static ContextT< _Tag > * | Current () |
Returns the current context for this thread. |
lsxml::ContextT< _Tag >::ContextT | ( | uint | blockSize = (4 *4096) , |
|
int | flags = 0 | |||
) | [explicit] |
Constructs a standard context.
blockSize | the size of a single block | |
flags | the context flags |
lsxml::ContextT< _Tag >::ContextT | ( | void * | memory, | |
uint | size | |||
) |
Constructs a context which uses the specified memory block.
Using this constructor, the user can supply the context with a custom memory block (i.e. a stack buffer or memory mapped file). Note that this constructor shoud be used with care - the library does not track the current memory usage, therefore exceeding the buffer capacity will result in a segmentation fault.
memory | address of the buffer | |
size | size of the buffer |
void* lsxml::ContextT< _Tag >::Allocate | ( | uint | size, | |
bool | temporary = false | |||
) |
Allocates memory in this context.
Allocates a memory block in this context
size | number of bytes to allocate | |
temporary | this parameter is used internally by the library |
bool lsxml::ContextT< _Tag >::IsTemporary | ( | void * | mem | ) |
Checks if the specified pointer belongs to a temporary block.
This function is used internally by the library
static ContextT<_Tag>* lsxml::ContextT< _Tag >::Current | ( | ) | [inline, static] |
Returns the current context for this thread.
Returns the current context for the current thread.
void lsxml::ContextT< _Tag >::MakeCurrent | ( | ) |
Sets this context as the current one.
Sets this context as the current context for the current thread
void lsxml::ContextT< _Tag >::Collect | ( | ) |
Collects all used memory and resources.
Releases all managed objects and frees all blocks allocated previously by this context. Does not physically free the memory.
void lsxml::ContextT< _Tag >::Manage | ( | ManagedObject * | obj | ) |
Adds the specified object to the list of managed objects.
This function is used internally by the library
void lsxml::ContextT< _Tag >::Unmanage | ( | ManagedObject * | obj | ) |
Removes the specified object from the list of managed objects.
This function is used internally by the library