|
Hedgehog
0.0.0
A library to generate hybrid pipeline workflow systems
|
Memory data interface to use a data type in a Memory manager (AbstractMemoryManager or StaticMemoryManager) More...
#include "memory_data.h"


Public Member Functions | |
| MemoryData ()=default | |
| Default constructor. | |
| virtual | ~MemoryData ()=default |
| Default destructor. | |
| AbstractMemoryManager< ManagedMemory > * | memoryManager () const |
| Memory manager accessor. More... | |
| void | memoryManager (AbstractMemoryManager< ManagedMemory > *memoryManager) |
| Memory manager setter. More... | |
| void | returnToMemoryManager () |
| Return the data to the memory manager. | |
| virtual void | used () |
| Mechanism to update the state of the data. | |
| virtual bool | canBeRecycled () |
| Accessor to test if the data can be recycle and sent bask to the Pool, true by default. More... | |
| virtual void | recycle () |
| Mechanism to recycle data. More... | |
Private Attributes | |
| AbstractMemoryManager< ManagedMemory > * | memoryManager_ = nullptr |
| Link to the Memory Manager. | |
Memory data interface to use a data type in a Memory manager (AbstractMemoryManager or StaticMemoryManager)
To declare a data A or B using the interface MemoryData, it can be written as:
The data will be served from the pool to the task through the AbstractMemoryManager, and can be return with MemoryData::returnToMemoryManager(). When returned, the MemoryData::used() and MemoryData::canBeRecycled() are called. If MemoryData::canBeRecycled() returns true, MemoryData::recycle() is called and it is returned to the pool and made available by its AbstractMemoryManager
| ManagedMemory | type of data to managed |
Definition at line 50 of file memory_data.h.
|
inlinevirtual |
Accessor to test if the data can be recycle and sent bask to the Pool, true by default.
Definition at line 76 of file memory_data.h.
|
inline |
|
inline |
Memory manager setter.
| memoryManager | Memory manager to set |
Definition at line 66 of file memory_data.h.


|
inlinevirtual |
Mechanism to recycle data.
If the ManagedMemory type uses user-defined allocations, then recycle is an appropriate place to deallocate the user-allocated data. It will be called only once before it is sent back to the pool.
Definition at line 83 of file memory_data.h.