#include <storage/IndexedIterable.h>
Inheritance diagram for BIndexedIterable:
This class builds from BGenericIterable a kind of iterable that contains an indexed array of items. It introduces a new IIterator class, IndexedIterator, that maintains a position in the array.
Derived classes can usually simply fill in the new virtuals defined here in order to have a working iterable; there is no need to create another class derived from IndexedIterator.
Bookkeeping | |
Creation, destruction, locking, etc. | |
BIndexedIterable (const SContext &context) | |
BIndexedIterable () | |
Indexed Iterable | |
virtual size_t | CountEntriesLocked () const =0 |
Subclasses must implement this to return the total number of items available. | |
virtual void | CreateSelectionLocked (SValue *inoutSelection, SValue *outCookie) const |
Optionally implement this to provide support for BV_ITERABLE_SELECT. | |
virtual void | CreateSortOrderLocked (SValue *inoutSortBy, SVector< ssize_t > *outOrder) const |
Optionally implement this to provide support for BV_ITERABLE_ORDER_BY. | |
virtual status_t | EntryAtLocked (const sptr< IndexedIterator > &it, size_t index, uint32_t flags, SValue *key, SValue *entry)=0 |
Subclasses must implement this to return an item from the iterator. | |
virtual status_t | RemoveEntryAtLocked (size_t index) |
Remove the item at 'index' from the iterable. | |
void | UpdateIteratorIndicesLocked (size_t index, ssize_t delta) |
Adjust all active iterators due to items being added/removed from the iterable. | |
Generic Iterable Virtuals | |
virtual sptr< GenericIterator > | NewGenericIterator (const SValue &args) |
Implemented to create an IndexedIterator object. | |
Bookkeeping | |
virtual | ~BIndexedIterable () |
Classes | |
class | IndexedIterator |
Iterator over an BIndexedIterable's data set. More... |
|
|
|
|
|
|
|
Subclasses must implement this to return the total number of items available.
Implemented in BSchemaDatabaseNode, BSchemaRowIDJoin::RowNode, BSchemaTableNode::RowNode, BIndexedDataNode, BIndexedTableNode, BIndexedTableNode::RowNode, BStructuredNode, and BCatalog. |
|
Optionally implement this to provide support for BV_ITERABLE_SELECT. The default implementation simply makes inoutSelection undefined and outCookie empty, meaning it will do no slection. You can implement this yourself to modify inoutSelection to match the exact keys you have available, and optionally fill in outCookie with any information useful to perform the selection. Reimplemented in BIndexedTableNode. |
|
Optionally implement this to provide support for BV_ITERABLE_ORDER_BY. The default implementation simply makes inoutSortBy undefined and outOrder empty, meaning it will do no sorting. You can implement this yourself to modify inoutSortBy to match the exact keys you are sorting by, and fill in outOrder with a permutation vector that maps positions in the IndexedIterator to indices in BIndexedIterable. |
|
Subclasses must implement this to return an item from the iterator. It is up to the implementor to deal with the REQUEST_DATA flag if they want to provide that optimization. This class guarantees it will never call EntryAtLocked() with an index that is out of range, though other classes may not be so kind. Implemented in BSchemaRowIDJoin::RowNode, BIndexedDataNode, BIndexedTableNode, and BIndexedCatalog. |
|
Implemented to create an IndexedIterator object.
Implements BGenericIterable. |
|
Remove the item at 'index' from the iterable. The default implementation returns B_UNSUPPORTED. |
|
Adjust all active iterators due to items being added/removed from the iterable. Your subclass must call this when it changes the contents of the iterable. Note that this must be done -after- you have finished the changed, since active iterators may need to recompute their sort order at this point. |