#include <stsharedmemory.h>
Public Member Functions | |
StSharedMemory () | |
StSharedMemory (const StSharedMemory ©) | |
~StSharedMemory () | |
void | malloc (unsigned size) |
void | realloc (unsigned size) |
void | free () |
void | renew () |
void * | getPointer () const |
unsigned | getMemorySize () const |
unsigned | getInstances () const |
void | setMemorySize (unsigned size) |
void | setMemoryPointer (void *pointer) |
void | makeCopy () |
char & | operator[] (unsigned index) |
const char & | operator[] (unsigned index) const |
StSharedMemory & | operator= (const StSharedMemory ©) |
Private Member Functions | |
void | clean () |
void | init () |
void | lock () |
void | unlock () |
Private Attributes | |
unsigned * | instances |
unsigned | memorySize |
void * | pointer |
StSharedMemory::StSharedMemory | ( | ) | [inline] |
StSharedMemory::StSharedMemory | ( | const StSharedMemory & | copy | ) | [inline] |
StSharedMemory::~StSharedMemory | ( | ) | [inline] |
void StSharedMemory::clean | ( | ) | [inline, private] |
If no instances are left memory will be freed.
void StSharedMemory::free | ( | ) | [inline] |
Free memory
unsigned StSharedMemory::getInstances | ( | ) | const [inline] |
unsigned StSharedMemory::getMemorySize | ( | ) | const [inline] |
void* StSharedMemory::getPointer | ( | ) | const [inline] |
void StSharedMemory::init | ( | ) | [inline, private] |
void StSharedMemory::lock | ( | ) | [inline, private] |
void StSharedMemory::makeCopy | ( | ) | [inline] |
If data should no longer be shared with other instances, use this function
void StSharedMemory::malloc | ( | unsigned | size | ) | [inline] |
Malloc new memory
StSharedMemory & StSharedMemory::operator= | ( | const StSharedMemory & | copy | ) | [inline] |
const char& StSharedMemory::operator[] | ( | unsigned | index | ) | const [inline] |
char& StSharedMemory::operator[] | ( | unsigned | index | ) | [inline] |
void StSharedMemory::realloc | ( | unsigned | size | ) | [inline] |
Resize the memory
void StSharedMemory::renew | ( | ) | [inline] |
Detach from data and get ready to renew the instance
void StSharedMemory::setMemoryPointer | ( | void * | pointer | ) | [inline] |
This function is DANGEROUS of you don't know what you're doing. Use only when memory is not allocated.
void StSharedMemory::setMemorySize | ( | unsigned | size | ) | [inline] |
This function is DANGEROUS if you don't know what you're doing. Use it only when memory was reallocated outside this class.
void StSharedMemory::unlock | ( | ) | [inline, private] |
unsigned* StSharedMemory::instances [private] |
unsigned StSharedMemory::memorySize [private] |
void* StSharedMemory::pointer [private] |