fawkes::BlackBoardMemoryManager::ChunkIterator Class Reference

Iterator for memory chunks. More...

#include <blackboard/internal/memory_manager.h>

List of all members.

Public Member Functions

 ChunkIterator ()
 Constructor.
 ChunkIterator (const ChunkIterator &it)
 Copy constructor.
ChunkIteratoroperator++ ()
 Increment iterator.
ChunkIterator operator++ (int inc)
 Increment iterator.
ChunkIteratoroperator+ (unsigned int i)
 Advance by a certain amount.
ChunkIteratoroperator+= (unsigned int i)
 Advance by a certain amount.
bool operator== (const ChunkIterator &c) const
 Check equality of two iterators.
bool operator!= (const ChunkIterator &c) const
 Check inequality of two iterators.
void * operator * () const
 Get memory pointer of chunk.
ChunkIteratoroperator= (const ChunkIterator &c)
 Assign iterator.
unsigned int size () const
 Get size of data segment.
unsigned int overhang () const
 Get number of overhanging bytes.

Friends

class BlackBoardMemoryManager


Detailed Description

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.


Constructor & Destructor Documentation

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  ) 

Copy constructor.

Parameters:
it Iterator to copy

Definition at line 936 of file memory_manager.cpp.

References __cur, and __shmem.


Member Function Documentation

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.

Returns:
pointer to memory

Definition at line 1051 of file memory_manager.cpp.

References fawkes::chunk_list_t::ptr, and fawkes::SharedMemory::ptr().

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.

Parameters:
c iterator to compare current instance to
Returns:
true, if iterators point to different chunks of memory, false otherwise

Definition at line 1039 of file memory_manager.cpp.

References __cur.

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.

Parameters:
i steps to advance in list. If i is bigger than the number of remaining elements in the list will stop beyond list.
Returns:
reference to current instance after advancing i steps or after reaching end of list.

Definition at line 996 of file memory_manager.cpp.

References fawkes::chunk_list_t::next.

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:

 for (ChunkIterator cit = memmgr->begin(); cit != memmgr->end(); cit++) {
   // your code here
 }
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!
See also:
operator++()
Parameters:
inc ignored
Returns:
copy of the current instance before advancing to the next element.

Definition at line 978 of file memory_manager.cpp.

References fawkes::chunk_list_t::next.

BlackBoardMemoryManager::ChunkIterator & fawkes::BlackBoardMemoryManager::ChunkIterator::operator++ (  ) 

Increment iterator.

Advances to the next element. This is the infix-operator. It may be used like this:

 for (ChunkIterator cit = memmgr->begin(); cit != memmgr->end(); ++cit) {
   // your code here
 }
Returns:
Reference to instance itself after advancing to the next element.

Definition at line 954 of file memory_manager.cpp.

References fawkes::chunk_list_t::next.

BlackBoardMemoryManager::ChunkIterator & fawkes::BlackBoardMemoryManager::ChunkIterator::operator+= ( unsigned int  i  ) 

Advance by a certain amount.

Works like operator+(unsigned int i), provided for convenience.

Parameters:
i steps to advance in list
Returns:
reference to current instance after advancing i steps or after reaching end of list.

Definition at line 1012 of file memory_manager.cpp.

References fawkes::chunk_list_t::next.

BlackBoardMemoryManager::ChunkIterator & fawkes::BlackBoardMemoryManager::ChunkIterator::operator= ( const ChunkIterator c  ) 

Assign iterator.

Makes the current instance to point to the same memory element as c.

Parameters:
c assign value
Returns:
reference to current instance

Definition at line 1066 of file memory_manager.cpp.

References __cur, and __shmem.

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.

Parameters:
c iterator to compare current instance to
Returns:
true, if iterators point to the same chunk, false otherwise

Definition at line 1027 of file memory_manager.cpp.

References __cur.

unsigned int fawkes::BlackBoardMemoryManager::ChunkIterator::overhang (  )  const

Get number of overhanging bytes.

See documentation of BlackBoardMemoryManager about overhanging bytes.

See also:
BlackBoardMemoryManager
Returns:
number of overhanging bytes.

Definition at line 1091 of file memory_manager.cpp.

References fawkes::chunk_list_t::overhang.

unsigned int fawkes::BlackBoardMemoryManager::ChunkIterator::size (  )  const

Get size of data segment.

Returns the size of the memory chunk. This includes overhanging bytes.

Returns:
size of chunk including overhanging bytes

Definition at line 1079 of file memory_manager.cpp.

References fawkes::chunk_list_t::size.


The documentation for this class was generated from the following files:
Generated on Tue Feb 22 13:31:37 2011 for Fawkes API by  doxygen 1.4.7