BGenericIterable Class Reference

#include <storage/GenericIterable.h>

Inheritance diagram for BGenericIterable:

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

Detailed Description

The most generic base class implementation of the IIterable interface.

This class takes care of the construction of iterators and their management. Derived classes will need to create their own subclass of the GenericIterator class found here, and implement NewGenericIterator() to return new instances of that class.

Some additional subclasses provide for specific and convenient implementations, such as BIndexedIterable for an iterable over an array-like structure. Note that BGenericIterable by itself only provides iterators that implement the raw IIterator interface -- a full IRandomIterator can not be provided here.


Iterator Management

Helpers for dealing with active iterator objects.

typedef bool(* for_each_iterator_func )(const sptr< BGenericIterable > &iterable, const sptr< GenericIterator > &iterator, void *cookie)
 Call-back function for ForEachIteratorLocked().
void ForEachIteratorLocked (for_each_iterator_func func, void *cookie)
 This will call func for each iterator that currently exists.
void PushIteratorChangedLocked ()
 Push the IteratorChanged event for all active iterators.

Bookkeeping

Creation, destruction, locking, etc.

 BGenericIterable (const SContext &context)
 BGenericIterable ()
virtual lock_status_t Lock () const
 Lock the iterable's state.
virtual void Unlock () const
 Unlock the node's state.
virtual ~BGenericIterable ()

New Generic Iterable Virtuals

Subclasses must override NextIteratorEntryLocked() to supply the remaining iterable implementation, and can use the others to customize its behavior.

virtual sptr< GenericIteratorNewGenericIterator (const SValue &args)=0
 Create and return a new iterator object.

INode Interface

Generic implementation of the INode interface.

virtual sptr< IIteratorNewIterator (const SValue &args=B_UNDEFINED_VALUE, status_t *error=NULL)
 Returns a new iterator by calling NewGenericIterator().

Friends

class GenericIterator

Classes

class  GenericIterator
 Generic base class implementation of a BGenericIterable's iterator. More...


Member Typedef Documentation

typedef bool(* for_each_iterator_func)(const sptr< BGenericIterable > &iterable, const sptr< GenericIterator > &iterator, void *cookie)
 

Call-back function for ForEachIteratorLocked().


Constructor & Destructor Documentation

BGenericIterable  ) 
 

BGenericIterable const SContext context  ) 
 

~BGenericIterable  )  [protected, virtual]
 


Member Function Documentation

void ForEachIteratorLocked for_each_iterator_func  func,
void *  cookie
 

This will call func for each iterator that currently exists.

lock_status_t Lock  )  const [virtual]
 

Lock the iterable's state.

To keep itself consistent, this class provides a public lock that is used when doing read/write operations on the class state as well as the actual data. The default implemention of this method acquires an internal lock. You can override it to cause all internal implementation to acquire some other lock. Be sure to also override Unlock() if doing so.

Reimplemented in BSchemaRowIDJoin, BSchemaRowIDJoin::RowNode, BSchemaTableNode, BSchemaTableNode::RowNode, BCatalogDelegate, BIndexedDataNode, BIndexedTableNode, BIndexedTableNode::RowNode, BIndexedCatalog, and BCatalog.

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

Create and return a new iterator object.

Derived classes need to implement this to return their own GenericIterator subclass.

Implemented in BSchemaRowIDJoin, BSchemaTableNode, BCatalogDelegate, and BIndexedIterable.

sptr< IIterator > NewIterator const SValue args = B_UNDEFINED_VALUE,
status_t error = NULL
[virtual]
 

Returns a new iterator by calling NewGenericIterator().

Subclasses should not override this method, using NewGenericIterator() instead.

Implements IIterable.

void PushIteratorChangedLocked  ) 
 

Push the IteratorChanged event for all active iterators.

void Unlock  )  const [virtual]
 

Unlock the node's state.

Reimplemented in BSchemaRowIDJoin, BSchemaRowIDJoin::RowNode, BSchemaTableNode, BSchemaTableNode::RowNode, BCatalogDelegate, BIndexedDataNode, BIndexedTableNode, BIndexedTableNode::RowNode, BIndexedCatalog, and BCatalog.


Friends And Related Function Documentation

friend class GenericIterator [friend]
 


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