IRandomIterator Class Reference
[Data Model]

#include <support/IRandomIterator.h>

Inheritance diagram for IRandomIterator:

IIterator IInterface SAtom BnRandomIterator BGenericIterable::GenericIterator BRandomIterator BCatalogDelegate::IteratorDelegate BIndexedIterable::IndexedIterator BSchemaRowIDJoin::JoinIterator BSchemaTableNode::QueryIterator List of all members.

Detailed Description

Extended IIterator interface that supports random access.

This interface is an extension to IIterator that allows one to perform random access on the contents of the iterator. This is accomplished by introducing two properties, one holding the total number of items and the other allowing you to set and get the position (zero-based) in the iterator.

The position is always the next item that will be returned. Thus if you set position to 0 and then call Next(), the results you get back will start with the first item in the iterator.


Public Member Functions

virtual size_t Count () const =0
 The total number of items available in the iterator.
status_t LinkRandomIterator (const sptr< IBinder > &to, const SValue &mappings, uint32_t flags=0)
virtual size_t Position () const =0
 The current position in the iterator.
virtual status_t Remove ()=0
 Removes the current element.
virtual void SetPosition (size_t value)=0
 The current position in the iterator.
status_t UnlinkRandomIterator (const sptr< IBinder > &to, const SValue &mappings, uint32_t flags=0)

Protected Member Functions

 IRandomIterator ()
virtual ~IRandomIterator ()


Constructor & Destructor Documentation

IRandomIterator  )  [inline, protected]
 

virtual ~IRandomIterator  )  [protected, virtual]
 


Member Function Documentation

virtual size_t Count  )  const [pure virtual]
 

The total number of items available in the iterator.

Implemented in BSchemaRowIDJoin::JoinIterator, BSchemaTableNode::QueryIterator, BCatalogDelegate::IteratorDelegate, BGenericIterable::GenericIterator, BIndexedIterable::IndexedIterator, and BRandomIterator.

status_t LinkRandomIterator const sptr< IBinder > &  to,
const SValue mappings,
uint32_t  flags = 0
[inline]
 

virtual size_t Position  )  const [pure virtual]
 

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.

Implemented in BSchemaRowIDJoin::JoinIterator, BSchemaTableNode::QueryIterator, BCatalogDelegate::IteratorDelegate, BGenericIterable::GenericIterator, BIndexedIterable::IndexedIterator, and BRandomIterator.

virtual status_t Remove  )  [pure virtual]
 

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.

Implemented in BSchemaRowIDJoin::JoinIterator, BSchemaTableNode::QueryIterator, BCatalogDelegate::IteratorDelegate, BGenericIterable::GenericIterator, and BRandomIterator.

virtual void SetPosition size_t  value  )  [pure virtual]
 

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.

Implemented in BSchemaRowIDJoin::JoinIterator, BSchemaTableNode::QueryIterator, BCatalogDelegate::IteratorDelegate, BGenericIterable::GenericIterator, BIndexedIterable::IndexedIterator, and BRandomIterator.

status_t UnlinkRandomIterator const sptr< IBinder > &  to,
const SValue mappings,
uint32_t  flags = 0
[inline]
 


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