BIndexedIterable Class Reference
[Data Model]

#include <storage/IndexedIterable.h>

Inheritance diagram for BIndexedIterable:

BGenericIterable BnIterable SSQLBuilder IIterable BBinder IInterface IBinder SAtom SAtom BIndexedCatalog BIndexedDataNode BIndexedTableNode BSchemaRowIDJoin::RowNode BMetaDataCatalog BIndexedTableNode::RowNode BSchemaDatabaseNode BSchemaTableNode::RowNode BStructuredNode BCatalog BPackageManager List of all members.

Detailed Description

Base class for IIterable implementations that contain an array of items.

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...


Constructor & Destructor Documentation

BIndexedIterable  ) 
 

BIndexedIterable const SContext context  ) 
 

~BIndexedIterable  )  [protected, virtual]
 


Member Function Documentation

virtual size_t CountEntriesLocked  )  const [pure virtual]
 

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.

void CreateSelectionLocked SValue inoutSelection,
SValue outCookie
const [virtual]
 

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.

void CreateSortOrderLocked SValue inoutSortBy,
SVector< ssize_t > *  outOrder
const [virtual]
 

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.

virtual status_t EntryAtLocked const sptr< IndexedIterator > &  it,
size_t  index,
uint32_t  flags,
SValue key,
SValue entry
[pure virtual]
 

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.

sptr< BGenericIterable::GenericIterator > NewGenericIterator const SValue args  )  [virtual]
 

Implemented to create an IndexedIterator object.

Implements BGenericIterable.

status_t RemoveEntryAtLocked size_t  index  )  [virtual]
 

Remove the item at 'index' from the iterable.

The default implementation returns B_UNSUPPORTED.

void UpdateIteratorIndicesLocked size_t  index,
ssize_t  delta
 

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.


The documentation for this class was generated from the following files: