Develop Biology
The language of life
|
#include <Iterator.h>
Public Member Functions | |
Iterator (const Container *container, const Index index=InvalidIndex()) | |
virtual | ~Iterator () |
virtual Iterator * | Decrement () |
Index | GetIndex () const |
virtual Iterator * | Increment () |
virtual bool | IsAtBeginning () const |
virtual bool | IsAtEnd () const |
bool | MoveTo (const Index index) |
virtual ByteStream | operator* () |
virtual const ByteStream | operator* () const |
Protected Attributes | |
Container * | m_container |
Index | m_index |
An Iterator is the preferred means of accessing the elements stored in an Container. Please use increment and decrement operators to move through these elements. While untested, it is likely that starting at the end and decrementing will be faster than starting at the beginning and incrementing, due to removing the overhead of having to keep track of where the end is.
NOTE: There are no checks to guard against being given a bad Container*. These have been neglected to increase performance.
Definition at line 38 of file Iterator.h.
bio::Iterator::Iterator | ( | const Container * | container, |
const Index | index = InvalidIndex() |
||
) |
Constructor is only built with a const Container*. We cast away the cv and keep only the mutable pointer. This is done in order to avoid having a separate class for const access (as is in the standard library).
container | |
index |
Definition at line 27 of file Iterator.cpp.
|
virtual |
Definition at line 38 of file Iterator.cpp.
|
virtual |
Move *this down a Index.
Definition at line 82 of file Iterator.cpp.
References IsAtBeginning(), bio::Container::IsFree(), m_container, and m_index.
Referenced by bio::SmartIterator::operator--().
Index bio::Iterator::GetIndex | ( | ) | const |
Definition at line 43 of file Iterator.cpp.
References m_index.
Referenced by bio::Container::Clear(), bio::SmartIterator::GetIndex(), bio::Container::SeekTo(), bio::physical::Line::SeekToId(), and bio::physical::Line::SeekToName().
|
virtual |
Move *this up a Index
Definition at line 68 of file Iterator.cpp.
References bio::Container::GetAllocatedSize(), IsAtEnd(), bio::Container::IsFree(), m_container, and m_index.
Referenced by bio::SmartIterator::operator++().
|
virtual |
Definition at line 58 of file Iterator.cpp.
References m_index.
Referenced by bio::Container::Clear(), Decrement(), bio::Container::Import(), bio::SmartIterator::IsAtBeginning(), bio::Container::SeekTo(), bio::physical::Line::SeekToId(), and bio::physical::Line::SeekToName().
|
virtual |
Definition at line 63 of file Iterator.cpp.
References bio::Container::GetAllocatedSize(), m_container, and m_index.
Referenced by Increment(), and bio::SmartIterator::IsAtEnd().
bool bio::Iterator::MoveTo | ( | const Index | index | ) |
Make *this point somewhere else;
index |
Definition at line 48 of file Iterator.cpp.
References bio::Container::IsAllocated(), m_container, and m_index.
Referenced by bio::Container::Clear(), bio::SmartIterator::MoveTo(), bio::Container::SeekTo(), bio::physical::Line::SeekToId(), and bio::physical::Line::SeekToName().
|
virtual |
Dereferencing gives the datum *this is currently pointing to.
Definition at line 95 of file Iterator.cpp.
References bio::Container::Access(), m_container, and m_index.
|
virtual |
Dereferencing gives the datum *this is currently pointing to.
Definition at line 100 of file Iterator.cpp.
References bio::Container::Access(), m_container, and m_index.
|
mutableprotected |
Definition at line 105 of file Iterator.h.
Referenced by Decrement(), Increment(), IsAtEnd(), MoveTo(), and operator*().
|
protected |
Definition at line 106 of file Iterator.h.
Referenced by Decrement(), GetIndex(), Increment(), IsAtBeginning(), IsAtEnd(), MoveTo(), and operator*().