Fawkes API
Fawkes Development Version
|
Iterator for memory chunks. More...
#include <>>
Public Member Functions | |
ChunkIterator () | |
Constructor. More... | |
ChunkIterator (const ChunkIterator &it) | |
Copy constructor. More... | |
ChunkIterator & | operator++ () |
Increment iterator. More... | |
ChunkIterator | operator++ (int inc) |
Increment iterator. More... | |
ChunkIterator & | operator+ (unsigned int i) |
Advance by a certain amount. More... | |
ChunkIterator & | operator+= (unsigned int i) |
Advance by a certain amount. More... | |
bool | operator== (const ChunkIterator &c) const |
Check equality of two iterators. More... | |
bool | operator!= (const ChunkIterator &c) const |
Check inequality of two iterators. More... | |
void * | operator* () const |
Get memory pointer of chunk. More... | |
ChunkIterator & | operator= (const ChunkIterator &c) |
Assign iterator. More... | |
unsigned int | size () const |
Get size of data segment. More... | |
unsigned int | overhang () const |
Get number of overhanging bytes. More... | |
Friends | |
class | BlackBoardMemoryManager |
Iterator for memory chunks.
The ChunkIterator can be used to iterate over all allocated memory chunks in the memory segment.
Definition at line 100 of file memory_manager.h.
fawkes::BlackBoardMemoryManager::ChunkIterator::ChunkIterator | ( | ) |
Constructor.
Will create a instance pointing beyond the end of the lits.
Definition at line 905 of file memory_manager.cpp.
fawkes::BlackBoardMemoryManager::ChunkIterator::ChunkIterator | ( | const ChunkIterator & | it | ) |
bool fawkes::BlackBoardMemoryManager::ChunkIterator::operator!= | ( | const ChunkIterator & | c | ) | const |
Check inequality of two iterators.
Can be used to determine if two iterators point to different chunks.
c | iterator to compare current instance to |
Definition at line 1039 of file memory_manager.cpp.
void * fawkes::BlackBoardMemoryManager::ChunkIterator::operator* | ( | ) | const |
Get memory pointer of chunk.
Use this operator to get the pointer to the chunk of memory that this iterator points to.
Definition at line 1051 of file memory_manager.cpp.
References fawkes::SharedMemory::ptr().
BlackBoardMemoryManager::ChunkIterator & fawkes::BlackBoardMemoryManager::ChunkIterator::operator+ | ( | unsigned int | i | ) |
Advance by a certain amount.
Can be used to add an integer to the iterator to advance many steps in one go. This operation takes linear time depending on i.
i | steps to advance in list. If i is bigger than the number of remaining elements in the list will stop beyond list. |
Definition at line 996 of file memory_manager.cpp.
BlackBoardMemoryManager::ChunkIterator & fawkes::BlackBoardMemoryManager::ChunkIterator::operator++ | ( | ) |
Increment iterator.
Advances to the next element. This is the infix-operator. It may be used like this:
Definition at line 954 of file memory_manager.cpp.
BlackBoardMemoryManager::ChunkIterator fawkes::BlackBoardMemoryManager::ChunkIterator::operator++ | ( | int | inc | ) |
Increment iterator.
Advances to the next element in allocated chunk list. This is the postfix-operator. It may be used like this:
Note that since a copy of the original iterator has to be created an returned it the postfix operation takes both, more CPU time and more memory. If possible (especially if used in a for loop like the example) use the prefix operator!
inc | ignored |
Definition at line 978 of file memory_manager.cpp.
BlackBoardMemoryManager::ChunkIterator & fawkes::BlackBoardMemoryManager::ChunkIterator::operator+= | ( | unsigned int | i | ) |
Advance by a certain amount.
Works like operator+(unsigned int i), provided for convenience.
i | steps to advance in list |
Definition at line 1012 of file memory_manager.cpp.
BlackBoardMemoryManager::ChunkIterator & fawkes::BlackBoardMemoryManager::ChunkIterator::operator= | ( | const ChunkIterator & | c | ) |
Assign iterator.
Makes the current instance to point to the same memory element as c.
c | assign value |
Definition at line 1066 of file memory_manager.cpp.
bool fawkes::BlackBoardMemoryManager::ChunkIterator::operator== | ( | const ChunkIterator & | c | ) | const |
Check equality of two iterators.
Can be used to determine if two iterators point to the same chunk.
c | iterator to compare current instance to |
Definition at line 1027 of file memory_manager.cpp.
unsigned int fawkes::BlackBoardMemoryManager::ChunkIterator::overhang | ( | ) | const |
Get number of overhanging bytes.
See documentation of BlackBoardMemoryManager about overhanging bytes.
Definition at line 1091 of file memory_manager.cpp.
unsigned int fawkes::BlackBoardMemoryManager::ChunkIterator::size | ( | ) | const |
Get size of data segment.
Returns the size of the memory chunk. This includes overhanging bytes.
Definition at line 1079 of file memory_manager.cpp.