#include <support/Iterator.h>
Inheritance diagram for BRandomIterator:
Public Member Functions | |
BRandomIterator (const sptr< IIterator > &iter) | |
virtual size_t | Count () const |
The total number of items available in the iterator. | |
virtual void | InitAtom () |
Called the first time a strong reference is acquired. All significant object initialization should go here. | |
virtual status_t | Next (IIterator::ValueList *keys, IIterator::ValueList *values, uint32_t flags, size_t count=0) |
Return a batch of keys and values from the iteration. | |
virtual void | Observed (const SValue &key, const SValue &value) |
Override this to receive observed events. | |
virtual SValue | Options () const |
The iterable options that are in force for this iterator. | |
virtual size_t | Position () const |
The current position in the iterator. | |
virtual status_t | Remove () |
Removes the current element. | |
virtual void | SetPosition (size_t value) |
The current position in the iterator. | |
Protected Member Functions | |
virtual | ~BRandomIterator () |
|
|
|
|
|
The total number of items available in the iterator.
Implements IRandomIterator. |
|
Called the first time a strong reference is acquired. All significant object initialization should go here. You can override it and do any setup you need. Note that you do not need to call the SAtom implementation. (So you can derive from two different SAtom implementations and safely call down to both of their IncStrong() methods.)
Reimplemented from SAtom. |
|
Return a batch of keys and values from the iteration.
The iterator may return key/value pairs, or single values. If returning single values, by the SValue mapping rules the key should always be B_WILD_VALUE. The Next() method can be given a flags parameter. Like INode::Walk(), you can supply REQUEST_DATA and COLLAPSE_NODE in the function's flags, with the corresponding semantics for the values the iterator returns. Also like INode::Walk(), the iterator is free to ignore these flags. Implements IIterator. |
|
Override this to receive observed events.
Implements BObserver. |
|
The iterable options that are in force for this iterator. You can use this determine which of the arguments given to IIterable::NewIterator() are in force for this iterator, and in what way. These are the same form as the arguments supplied to IIterable::NewIterator(). Implements IIterator. |
|
The current position in the iterator. This is the index of the item that will be returned the next time IIterator::Next() is called. That is, semantically the Next() operation returns the data at the current location, and then increments the iterator to the next location. To retrieve an item at a specific location, first set position to the index of the desired item (range from 0 to count-1) and then call IIterator with count=1 to retrieve only that item. Setting position to 0 will make the iterator restart back at the beginning of its data. Implements IRandomIterator. |
|
Removes the current element. Iterators are not required to implement this, and can return B_UNSUPPORTED in that case. Note that this removes the item at the current position, thus if you call Next() and then Remove(), you will be removing the next item after the ones you had just retrieved. Implements IRandomIterator. |
|
The current position in the iterator. This is the index of the item that will be returned the next time IIterator::Next() is called. That is, semantically the Next() operation returns the data at the current location, and then increments the iterator to the next location. To retrieve an item at a specific location, first set position to the index of the desired item (range from 0 to count-1) and then call IIterator with count=1 to retrieve only that item. Setting position to 0 will make the iterator restart back at the beginning of its data. Implements IRandomIterator. |