![]() |
VR-Forces 4.0.4 Class Documentation
|
Public Types | |
| typedef DtDebugMemoryBlockHeader | DtMemoryHeader |
Public Member Functions | |
| DtDebugDrawerSharedMemoryManager () | |
| Default constructor. | |
| virtual | ~DtDebugDrawerSharedMemoryManager () |
| Default destructor. | |
| virtual void | init (int memoryType, bool clearMemory=false, unsigned long memorySize=10485670) |
| Initializes shared memory for access by another copy of this class in another program. | |
| virtual void | push (DtDebugDrawerGeometryMemory *shape) |
| Pushes an instance of DtDebugDrawerGeometryMemory onto shared memory. | |
| virtual unsigned int | numEmtries () |
| Must call this function before calling getNext(). | |
| virtual const char * | getNext (const char *previousPtr, DtDebugDrawerGeometryMemory **shape) |
| Expects that pointToMemoryBlock() has been called. | |
| virtual const std::vector< int > | getMemoryBlockIndexList () |
| Use this function to get the number of names, this automatically filters by type. | |
| virtual DtString | getMemoryBlockName (int index) |
| Using the number of names in the list, you can get any name in the list by index. | |
| virtual void | pointToMemoryBlock (DtString name) |
| Switches this instance of shared memory to point to a different block of memory. | |
| virtual void | startNewFrame () |
| Notifies the shared memory block that it will be writing new data. | |
| virtual void | advanceFrameCount () |
| Frame count allows the drawer of shapes to indicate that a complete frame has been completed and is ready for drawing. | |
| virtual unsigned long | frameCount () const |
| Frame count allows the drawer of shapes to indicate that a complete frame has been completed and is ready for drawing. | |
Static Public Attributes | |
| static const int | DtDebugDrawerSharedMemoryNoType = 0 |
| static const int | DtDebugDrawerSharedMemoryAllType = 1 |
| static const int | DtDebugDrawerSharedMemoryVRFType = 2 |
| static const int | DtDebugDrawerSharedMemoryBHaveType = 3 |
Protected Attributes | |
| unsigned long | myMaxSize |
| Max size of shared memory (in bytes). | |
| unsigned long | myCurrentSize |
| Current used size of shared memory (in bytes). | |
| char * | myCurrentMemPtr |
| Pointer to the current writable location in shared memory. | |
| char * | myMemoryPtr |
| Pointer to the start of shared memory. | |
| DtMemoryHeader * | myHeader |
| Pointer to the header in shared memory. | |
| DtSharedMemoryPoolManager * | myManager |
| Shared memory wrapper class objects. | |
| DtSharedMemoryPoolClient * | myClient |
| DtDebugDrawerNameManager * | myNameManager |
| Connection to the name memory block where names are stored for the GUI. | |
| bool | myIsReader |
| DtString | myMemoryName |
| int | myMemoryType |
Default constructor.
| virtual DtDebugDrawerSharedMemoryManager::~DtDebugDrawerSharedMemoryManager | ( | ) | [virtual] |
Default destructor.
Shared memory will be destroyed when the last instance of this class is destroyed of a given name from init().
| virtual void DtDebugDrawerSharedMemoryManager::init | ( | int | memoryType, |
| bool | clearMemory = false, |
||
| unsigned long | memorySize = 10485670 |
||
| ) | [virtual] |
Initializes shared memory for access by another copy of this class in another program.
The name and size must match in all instances for access to the same shared memory space. Default parameters are generally enough. This function, if arg is true, will ask the name manager for a name and set it's name property to that. This will be how this block of memory is referenced.
| clearMemory | True if you are the writer to memory, false otherwise. |
| memorySize | Use default. Agreed upon size of the memory block you wish to allocate (in bytes). The value defaults to 10485670 bytes (10MB). |
| virtual void DtDebugDrawerSharedMemoryManager::push | ( | DtDebugDrawerGeometryMemory * | shape | ) | [virtual] |
Pushes an instance of DtDebugDrawerGeometryMemory onto shared memory.
If memory is full, it will simply not push any more data on. If init() has not been invoked, it will not push any data to shared memory.If the shape pointer is null it will not push anything. If the shape pointer is not a valid shape defined in DtDebugDrawerGeometry it will not push the data to memory. If an instance of this class has not pushed any data via this function, this function should not be called by this instance. Only one instance should be calling this function.
| shape | Pointer to a DtDebugDrawerGeometryMemory to put in shared memory. Will always append to the end of previous push() call. |
| virtual void DtDebugDrawerSharedMemoryManager::advanceFrameCount | ( | ) | [virtual] |
Frame count allows the drawer of shapes to indicate that a complete frame has been completed and is ready for drawing.
The reader of the data can compare the frame count to the last frame that they read, and know whether anything has changed.
| virtual unsigned long DtDebugDrawerSharedMemoryManager::frameCount | ( | ) | const [virtual] |
Frame count allows the drawer of shapes to indicate that a complete frame has been completed and is ready for drawing.
The reader of the data can compare the frame count to the last frame that they read, and know whether anything has changed.
| virtual unsigned int DtDebugDrawerSharedMemoryManager::numEmtries | ( | ) | [virtual] |
| virtual const char* DtDebugDrawerSharedMemoryManager::getNext | ( | const char * | previousPtr, |
| DtDebugDrawerGeometryMemory ** | shape | ||
| ) | [virtual] |
Expects that pointToMemoryBlock() has been called.
Expects that numEntries() is called afterwards so as to not go beyond the shared memory space or even to empty shared memory. Expects a null pointer for the previousPtr for the first entry inserted through push(). Will delete the shape pointer reference and replace it with the next shape added in subsequent push() calls. It is up to the caller to delete the the final shape once the end of numEntries() has been reached and no further calls to this function will be made. Any number of instances of this class may retrieve the memory though this function.
| previousPtr | Pass in a null pointer for the first entry in shared memory. Subsequent calls expects the pointer it returned as this parameter previously. |
| shape | Pointer to a pointer to an instance of DtDebugDrawerGeometryMemory or null. The pointer returned will point to the pointer to the new DtDebugDrawerGeometryMemory retrieved from shared memory that was previously added via push(). |
| virtual const std::vector<int> DtDebugDrawerSharedMemoryManager::getMemoryBlockIndexList | ( | ) | [virtual] |
Use this function to get the number of names, this automatically filters by type.
| virtual DtString DtDebugDrawerSharedMemoryManager::getMemoryBlockName | ( | int | index | ) | [virtual] |
Using the number of names in the list, you can get any name in the list by index.
| index | the key to the name |
| virtual void DtDebugDrawerSharedMemoryManager::pointToMemoryBlock | ( | DtString | name | ) | [virtual] |
Switches this instance of shared memory to point to a different block of memory.
Each block is keyed by name (which is unique) and you can specify which block of memory you want to point to using this function. Generally, you want to get the block name from the getMemoryBlockName() function. If you happen to know the name of the memory block, then it can also be manually entered.
| name | The name of the memory block you wish to point to. |
| virtual void DtDebugDrawerSharedMemoryManager::startNewFrame | ( | ) | [virtual] |
Notifies the shared memory block that it will be writing new data.
numEntries() will return 0 after this function is called.
const int DtDebugDrawerSharedMemoryManager::DtDebugDrawerSharedMemoryNoType = 0 [static] |
const int DtDebugDrawerSharedMemoryManager::DtDebugDrawerSharedMemoryAllType = 1 [static] |
const int DtDebugDrawerSharedMemoryManager::DtDebugDrawerSharedMemoryVRFType = 2 [static] |
const int DtDebugDrawerSharedMemoryManager::DtDebugDrawerSharedMemoryBHaveType = 3 [static] |
unsigned long DtDebugDrawerSharedMemoryManager::myMaxSize [protected] |
Max size of shared memory (in bytes).
Set in init() as a parameter. The default is 10485670 bytes (10MB).
unsigned long DtDebugDrawerSharedMemoryManager::myCurrentSize [protected] |
Current used size of shared memory (in bytes).
Only the instance performing push() will have the current used size and should not be modified in that instance.
char* DtDebugDrawerSharedMemoryManager::myCurrentMemPtr [protected] |
Pointer to the current writable location in shared memory.
Only the instance performing push() will have this pointer set.
char* DtDebugDrawerSharedMemoryManager::myMemoryPtr [protected] |
Pointer to the start of shared memory.
DtMemoryHeader* DtDebugDrawerSharedMemoryManager::myHeader [protected] |
Pointer to the header in shared memory.
DtSharedMemoryPoolManager* DtDebugDrawerSharedMemoryManager::myManager [protected] |
Shared memory wrapper class objects.
DtSharedMemoryPoolClient* DtDebugDrawerSharedMemoryManager::myClient [protected] |
Connection to the name memory block where names are stored for the GUI.
bool DtDebugDrawerSharedMemoryManager::myIsReader [protected] |
int DtDebugDrawerSharedMemoryManager::myMemoryType [protected] |