Fawkes API
Fawkes Development Version
|
24 #ifndef _BLACKBOARD_MEMORY_MANAGER_H_
25 #define _BLACKBOARD_MEMORY_MANAGER_H_
27 #include <sys/types.h>
31 class BlackBoardSharedMemoryHeader;
32 class BlackBoardInterfaceManager;
33 class BlackBoardMemoryManager;
67 const char * shmem_token =
"FawkesBlackBoard");
70 void *
alloc(
unsigned int num_bytes);
71 void free(
void *chunk_ptr);
124 unsigned int size()
const;
139 unsigned int list_length(
const chunk_list_t *list)
const;
143 void cleanup_free_chunks();
147 void *alloc_nolock(
unsigned int num_bytes);
void check()
Check memory consistency.
ChunkIterator & operator+(unsigned int i)
Advance by a certain amount.
void * alloc(unsigned int num_bytes)
Allocate memory.
void free(void *chunk_ptr)
Free a memory chunk.
Chunk lists as stored in BlackBoard shared memory segment.
unsigned int free_size() const
Get total free memory.
unsigned int overhang
number of overhanging bytes in this chunk
ChunkIterator & operator+=(unsigned int i)
Advance by a certain amount.
Mutex mutual exclusion lock.
unsigned int overhang() const
Get number of overhanging bytes.
void unlock()
Unlock memory.
bool operator==(const ChunkIterator &c) const
Check equality of two iterators.
ChunkIterator end()
Get end of chunk list.
bool is_master() const
Check if this BB memory manager is the master.
Iterator for memory chunks.
unsigned int size() const
Get size of data segment.
ChunkIterator()
Constructor.
unsigned int version() const
Get BlackBoard version.
unsigned int allocated_size() const
Get total allocated memory.
BlackBoard memory manager.
void * ptr
pointer to data memory
BlackBoard interface manager.
bool try_lock()
Try to lock memory.
BlackBoardMemoryManager(size_t memsize)
Heap Memory Constructor.
Fawkes library namespace.
unsigned int num_free_chunks() const
Get number of free chunks.
unsigned int max_free_size() const
Get maximum allocatable memory size.
unsigned int max_allocated_size() const
Get maximum alloced memory size.
void * operator*() const
Get memory pointer of chunk.
bool operator!=(const ChunkIterator &c) const
Check inequality of two iterators.
ChunkIterator begin()
Get first element for chunk iteration.
unsigned int memory_size() const
Get size of memory.
ChunkIterator & operator=(const ChunkIterator &c)
Assign iterator.
ChunkIterator & operator++()
Increment iterator.
unsigned int size
total size of chunk, including overhanging bytes, excluding header
unsigned int overhang_size() const
Get number of overhanging bytes.
void print_free_chunks_info() const
Print out info about free chunks.
void print_allocated_chunks_info() const
Print out info about allocated chunks.
void print_performance_info() const
Prints out performance info.
unsigned int num_allocated_chunks() const
Get number of allocated chunks.
~BlackBoardMemoryManager()
Destructor.
chunk_list_t * next
offset to next element in list