Public Member Functions | Protected Attributes | List of all members
zorba::Iterator Class Referenceabstract

Interface for an Iterator over an instance of the XML Data Model (i.e., a sequence of items). More...

#include <zorba/iterator.h>

Inheritance diagram for zorba::Iterator:
Inheritance graph
[legend]
Collaboration diagram for zorba::Iterator:
Collaboration graph
[legend]

Public Member Functions

void addReference () const
 
virtual void close ()=0
 Stop iterating. More...
 
virtual void free ()
 
long getRefCount () const
 
virtual bool isOpen () const =0
 brief Check whether the iterator is open or not More...
 
virtual bool next (Item &aItem)=0
 Get the next Item of the sequence. More...
 
virtual void open ()=0
 Start iterating. More...
 
void removeReference ()
 
virtual ~Iterator ()
 Destructor. More...
 

Protected Attributes

unsigned int theRefCount
 

Detailed Description

Interface for an Iterator over an instance of the XML Data Model (i.e., a sequence of items).

An iterator can be in one of the following two states: open or not-open. When in open state, only methods isOpen(), next() and close() may be called. When in not-open state, only isOpen and open() may be called. The open() method changes the state from non-open to open, and the close() method changes the state from open to not-open.

Iterator is not a thread-safe class, i.e., none of its methods should ever be called by two or more threads in parallel.

Note: This class is reference counted. When writing multi-threaded clients, it is the responibility of the client code to synchronize assignments to the SmartPtr holding this object.

Examples:
external_functions.cpp.

Definition at line 41 of file iterator.h.

Constructor & Destructor Documentation

virtual zorba::Iterator::~Iterator ( )
inlinevirtual

Destructor.

Definition at line 46 of file iterator.h.

Member Function Documentation

void zorba::SmartObject::addReference ( ) const
inlineinherited

Definition at line 40 of file smart_ptr.h.

virtual void zorba::Iterator::close ( )
pure virtual

Stop iterating.

The purpose of this method is to release resources that were allocated during open. After calling close(), neither close() nor next() may be called again. However, the iterator may be re-opened (by calling open()).

Exceptions
ZorbaExceptionif an error occurs, or the Iterator has not been opened.
virtual void zorba::SmartObject::free ( )
virtualinherited
long zorba::SmartObject::getRefCount ( ) const
inlineinherited

Definition at line 38 of file smart_ptr.h.

virtual bool zorba::Iterator::isOpen ( ) const
pure virtual

brief Check whether the iterator is open or not

virtual bool zorba::Iterator::next ( Item aItem)
pure virtual

Get the next Item of the sequence.

Parameters
aItemthe next Item of the result sequence, if true is returned by the function.
Returns
false if all the items of the sequence have been returned already by previous invocations of next(); true otherwise.
Exceptions
ZorbaExceptionif an error occurs, or the Iterator has not been opened.
virtual void zorba::Iterator::open ( )
pure virtual

Start iterating.

This function needs to be called before calling next() or close(). Its purpose is to create and initialize any resources that may be needed during the iteration. It should not be called again until after close() has been called.

Exceptions
ZorbaExceptionif an error occurs, or the iterator is open already.
void zorba::SmartObject::removeReference ( )
inlineinherited

Definition at line 42 of file smart_ptr.h.

Member Data Documentation

unsigned int zorba::SmartObject::theRefCount
mutableprotectedinherited

Definition at line 27 of file smart_ptr.h.


The documentation for this class was generated from the following file:
blog comments powered by Disqus