BGenericIterable::GenericIterator Class Reference

#include <storage/GenericIterable.h>

Inheritance diagram for BGenericIterable::GenericIterator:

BnRandomIterator SSQLBuilder IRandomIterator BBinder IIterator IBinder IInterface SAtom SAtom BCatalogDelegate::IteratorDelegate BIndexedIterable::IndexedIterator BSchemaRowIDJoin::JoinIterator BSchemaTableNode::QueryIterator List of all members.

Detailed Description

Generic base class implementation of a BGenericIterable's iterator.

You will need to create your own concete subclass.


IIterator/IRandomIterator interfaces.

This is a generic implementation of the iterator interface. Some of these have new virtuals on this class that you should override instead of the base virtuals here.

virtual size_t Count () const
 This base class does not support IRandomIterator, so this is stubbed to return 0.
virtual status_t Next (IIterator::ValueList *keys, IIterator::ValueList *values, uint32_t flags, size_t count)
 Fills in the vectors by calling back to BGenericIterable::NextIteratorEntryLocked().
virtual SValue Options () const
 Return the argument options that are in effect for this iterator.
virtual size_t Position () const
 This base class does not support IRandomIterator, so this is stubbed to return 0.
virtual status_t Remove ()
 Calls back to BGenericIterable::RemoveIteratorEntryLocked().
virtual void SetPosition (size_t p)
 This base class does not support IRandomIterator, so this is stubbed to do nothing.

SSQLBuilder Redirection

Redirect our SSQLBuilder virtuals up to the BGenericIterable class, so subclasses can modify the iterable's behavior from there.

virtual SValue CreateSQLFilter (const SValue &filter) const
 Call back to BGenericIterable::CreateSQLFilter().
virtual void MapSQLColumn (SValue *inoutColumn) const
 Call back to BGenericIterable::MapSQLColumn().
virtual void MapSQLOrderColumn (SValue *inoutColumnName, SValue *inoutOrder) const
 Call back to BGenericIterable::MapSQLOrderColumn().

Bookkeeping

Creation, destruction, locking, etc.

 GenericIterator (const SContext &context, const sptr< BGenericIterable > &owner)
virtual SValue Inspect (const sptr< IBinder > &caller, const SValue &which, uint32_t flags)
 Override to only return the IIterator interface.
const sptr< BGenericIterable > & Owner () const
 Return the BGenericIterable that created this iterator.
virtual status_t StatusCheck () const
 Use to return an error back to NewIterator(). The default implementation always returns B_OK.
virtual status_t FinishAtom (const void *id)
 The destructor must call Lock(), so return FINISH_ATOM_ASYNC to avoid deadlocks.
virtual void InitAtom ()
 Adds the iterator to its BGenericIterable.
virtual ~GenericIterator ()

New Functionality

Virtuals you need to override to complete the iterator implementation, virtuals you can override to customize it, and helper functions.

virtual status_t NextLocked (uint32_t flags, SValue *key, SValue *entry)=0
 Move iterator to next item and return it. The 'flags' come directly from IIterator::Next().
virtual status_t ParseArgs (const SValue &args)
 Process arguments passed to NewIterator().
virtual status_t RemoveLocked ()
 Remove the current item from the iterable.


Constructor & Destructor Documentation

GenericIterator const SContext context,
const sptr< BGenericIterable > &  owner
 

~GenericIterator  )  [protected, virtual]
 


Member Function Documentation

size_t Count  )  const [virtual]
 

This base class does not support IRandomIterator, so this is stubbed to return 0.

Implements IRandomIterator.

Reimplemented in BSchemaRowIDJoin::JoinIterator, BSchemaTableNode::QueryIterator, BCatalogDelegate::IteratorDelegate, and BIndexedIterable::IndexedIterator.

SValue CreateSQLFilter const SValue filter  )  const [virtual]
 

Call back to BGenericIterable::CreateSQLFilter().

Reimplemented from SSQLBuilder.

Reimplemented in BSchemaTableNode::QueryIterator.

status_t FinishAtom const void *  id  )  [protected, virtual]
 

The destructor must call Lock(), so return FINISH_ATOM_ASYNC to avoid deadlocks.

Reimplemented from SAtom.

Reimplemented in BSchemaRowIDJoin::JoinIterator, and BSchemaTableNode::QueryIterator.

void InitAtom  )  [protected, virtual]
 

Adds the iterator to its BGenericIterable.

Reimplemented from SAtom.

Reimplemented in BSchemaTableNode::QueryIterator.

SValue Inspect const sptr< IBinder > &  caller,
const SValue which,
uint32_t  flags
[virtual]
 

Override to only return the IIterator interface.

A GenericIterator does not have a position, so it can only support the IIterator interface. If your subclass of GenericIterator wants to also support IRandomIterator, you should re-implement this function to directly call BnRandomIterator::Inspect().

Reimplemented from BnRandomIterator.

Reimplemented in BSchemaRowIDJoin::JoinIterator, BSchemaTableNode::QueryIterator, BCatalogDelegate::IteratorDelegate, and BIndexedIterable::IndexedIterator.

void MapSQLColumn SValue inoutColumn  )  const [virtual]
 

Call back to BGenericIterable::MapSQLColumn().

Note:
If you re-implement this, you will probably need to re-implement MapSQLOrderColumn() as well (possibly just to call through to MapSQLColumn(), like SSQLBuilder::MapSQLOrderColumn() does).

Reimplemented from SSQLBuilder.

void MapSQLOrderColumn SValue inoutColumnName,
SValue inoutOrder
const [virtual]
 

Call back to BGenericIterable::MapSQLOrderColumn().

Reimplemented from SSQLBuilder.

status_t Next IIterator::ValueList keys,
IIterator::ValueList values,
uint32_t  flags,
size_t  count
[virtual]
 

Fills in the vectors by calling back to BGenericIterable::NextIteratorEntryLocked().

Implements IIterator.

Reimplemented in BCatalogDelegate::IteratorDelegate.

virtual status_t NextLocked uint32_t  flags,
SValue key,
SValue entry
[pure virtual]
 

Move iterator to next item and return it. The 'flags' come directly from IIterator::Next().

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

SValue Options  )  const [virtual]
 

Return the argument options that are in effect for this iterator.

The default implementation returns B_UNDEFINED, indicating no additional arguments have been handled. Derived implementations should always try to implement this option; if you can't, re-implement this function to return only the options you do implement.

Implements IIterator.

Reimplemented in BSchemaRowIDJoin::JoinIterator, BSchemaTableNode::QueryIterator, BCatalogDelegate::IteratorDelegate, and BIndexedIterable::IndexedIterator.

const sptr<BGenericIterable>& Owner  )  const [inline]
 

Return the BGenericIterable that created this iterator.

status_t ParseArgs const SValue args  )  [virtual]
 

Process arguments passed to NewIterator().

The default implementation does nothing. Derived implementation should try to handle as many arguments as possible, returning those from Options().

Reimplemented in BSchemaRowIDJoin::JoinIterator, BSchemaTableNode::QueryIterator, BCatalogDelegate::IteratorDelegate, and BIndexedIterable::IndexedIterator.

size_t Position  )  const [virtual]
 

This base class does not support IRandomIterator, so this is stubbed to return 0.

Implements IRandomIterator.

Reimplemented in BSchemaRowIDJoin::JoinIterator, BSchemaTableNode::QueryIterator, BCatalogDelegate::IteratorDelegate, and BIndexedIterable::IndexedIterator.

status_t Remove  )  [virtual]
 

Calls back to BGenericIterable::RemoveIteratorEntryLocked().

Implements IRandomIterator.

Reimplemented in BSchemaRowIDJoin::JoinIterator, BSchemaTableNode::QueryIterator, and BCatalogDelegate::IteratorDelegate.

status_t RemoveLocked  )  [virtual]
 

Remove the current item from the iterable.

The default implementation returns B_UNSUPPORTED.

Reimplemented in BIndexedIterable::IndexedIterator.

void SetPosition size_t  p  )  [virtual]
 

This base class does not support IRandomIterator, so this is stubbed to do nothing.

Implements IRandomIterator.

Reimplemented in BSchemaRowIDJoin::JoinIterator, BSchemaTableNode::QueryIterator, BCatalogDelegate::IteratorDelegate, and BIndexedIterable::IndexedIterator.

status_t StatusCheck  )  const [virtual]
 

Use to return an error back to NewIterator(). The default implementation always returns B_OK.

Reimplemented in BCatalogDelegate::IteratorDelegate.


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