Class DBufferIter



Provides sequential access to a DBuffer's elements. Using a DBufferIter is more efficient than calling getByte repeatedly. The DBufferIter becomes invalid if its DBuffer adds or removes elements, and should be reset with setBuffer or setIndex.


DBufferIter(void)

The default constructor.


DBufferIter(const DBufferIter &source)

Creates a DBufferIter that points to the same DBuffer and element as source.


DBufferIter& operator= (const DBufferIter &source)

Sets this DBufferIter to point to the same DBuffer and element as source.


bool finished(void)

Returns true if the iterator has passed the end of the DBuffer, and value should no longer be called.


void next(void)

Moves to the next element in the DBuffer. After calling next, finished should be called to check if the iterator has moved past the DBuffer's last element.


void setBuffer(DBuffer *buffer)

Set the DBuffer to iterate through. The index is set to zero.


void setIndex(long int index)

Moves the iterator to point to the specified index in the DBuffer. Calling this function repeatedly is inefficient, use next instead. Throws an exception if index is out of bounds.


uint8_t& value(void)

Returns the value of the byte pointed to by this iterator. Should not be called if finished returned true, or if this iterator doesn't point to a valid DBuffer.





















Back to class reference