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

A Collection is a persistent sequence of node items. More...

#include <zorba/collection.h>

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

Public Member Functions

void addReference () const
 
virtual ItemSequence_t contents ()=0
 This function returns the sequence of nodes of the collection. More...
 
virtual void deleteNodeFirst ()=0
 This function deletes the first node from a collection. More...
 
virtual void deleteNodeLast ()=0
 This function deletes the last node from a collection. More...
 
virtual void deleteNodes (const ItemSequence_t &aNodes)=0
 This function deletes zero of more nodes from a collection. More...
 
virtual void deleteNodesFirst (unsigned long aNumNodes)=0
 This function deletes the n first nodes from a collection. More...
 
virtual void deleteNodesLast (unsigned long aNumNodes)=0
 This function deletes the n last nodes from a collection. More...
 
virtual void free ()
 
virtual void getAnnotations (std::vector< Annotation_t > &aAnnotations) const =0
 Retrieves all annotations for the given collection. More...
 
virtual const Item getName () const =0
 Get the name of the collection. More...
 
long getRefCount () const
 
virtual TypeIdentifier_t getType () const =0
 Retrieves the sequence type for this (static declared) collection. More...
 
virtual long long indexOf (const Item &aNode)=0
 This function returns the index of the given node in the collection. More...
 
virtual void insertNodesAfter (const Item &aTarget, const ItemSequence_t &aNodes)=0
 This function inserts copies of the given nodes into a collection at the position directly following the given target node. More...
 
virtual void insertNodesBefore (const Item &aTarget, const ItemSequence_t &aNodes)=0
 This function inserts copies of the given nodes into a collection at the position directly preceding the given target node. More...
 
virtual void insertNodesFirst (const ItemSequence_t &aNodes)=0
 This function inserts copies of the given nodes at the beginning of the collection. More...
 
virtual void insertNodesLast (const ItemSequence_t &aNodes)=0
 This function inserts copies of the given nodes at the end of the collection. More...
 
virtual bool isStatic () const =0
 The function checks if this collection has been statically declared. More...
 
virtual void registerDiagnosticHandler (DiagnosticHandler *aDiagnosticHandler)=0
 Register a DiagnosticHandler to which errors occuring during the management or manipulation of this collection are reported. More...
 
void removeReference ()
 
virtual ~Collection ()
 Destructor. More...
 

Protected Attributes

unsigned int theRefCount
 

Detailed Description

A Collection is a persistent sequence of node items.

Instances of this class can be used to modify or retrieve the contents of a collection.

The variable aNodes passed to any of the insert functions is evaluated as though it were an enclosed expression in an element constructor. The result of this step is a sequence of nodes to be inserted into the collection.

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.

Definition at line 39 of file collection.h.

Constructor & Destructor Documentation

virtual zorba::Collection::~Collection ( )
inlinevirtual

Destructor.

Definition at line 183 of file collection.h.

Member Function Documentation

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

Definition at line 40 of file smart_ptr.h.

virtual ItemSequence_t zorba::Collection::contents ( )
pure virtual

This function returns the sequence of nodes of the collection.

Returns
The sequence contained in the given collection.
virtual void zorba::Collection::deleteNodeFirst ( )
pure virtual

This function deletes the first node from a collection.

Exceptions
XDDY0011if the collection doesn't contain any node.
virtual void zorba::Collection::deleteNodeLast ( )
pure virtual

This function deletes the last node from a collection.

Exceptions
XDDY0011if the collection doesn't contain any node.
virtual void zorba::Collection::deleteNodes ( const ItemSequence_t aNodes)
pure virtual

This function deletes zero of more nodes from a collection.

Parameters
aNodesthe nodes in the collection that should be deleted.
Exceptions
XDDY0011if any nodes in the given sequence is not a member of a collection or not all nodes of the sequence belong to the same collection.
virtual void zorba::Collection::deleteNodesFirst ( unsigned long  aNumNodes)
pure virtual

This function deletes the n first nodes from a collection.

Exceptions
XDDY0011if the collection doesn't contain any node.
virtual void zorba::Collection::deleteNodesLast ( unsigned long  aNumNodes)
pure virtual

This function deletes the n last nodes from a collection.

Exceptions
XDDY0011if the collection doesn't contain any node.
virtual void zorba::SmartObject::free ( )
virtualinherited
virtual void zorba::Collection::getAnnotations ( std::vector< Annotation_t > &  aAnnotations) const
pure virtual

Retrieves all annotations for the given collection.

If the collection is a statically declared collection, the annotations are the ones that haven been given in the declaration of the collection (or the defaults). If the collection is a dynamic collection, the annotations are the default ones for dynamic collections.

Returns
a list of all annotations for the given collection (if found)
virtual const Item zorba::Collection::getName ( ) const
pure virtual

Get the name of the collection.

Returns
The name of the collection.
long zorba::SmartObject::getRefCount ( ) const
inlineinherited

Definition at line 38 of file smart_ptr.h.

virtual TypeIdentifier_t zorba::Collection::getType ( ) const
pure virtual

Retrieves the sequence type for this (static declared) collection.

Returns
the sequence type for the said collection, or 0 if this collection is not statically declared.
See Also
isStatic()
virtual long long zorba::Collection::indexOf ( const Item aNode)
pure virtual

This function returns the index of the given node in the collection.

Parameters
aNodeThe node to retrieve the index from.
Returns
Returns the position of the given node in the collection.
Exceptions
XDDY0011if node is not contained in any collection.
virtual void zorba::Collection::insertNodesAfter ( const Item aTarget,
const ItemSequence_t aNodes 
)
pure virtual

This function inserts copies of the given nodes into a collection at the position directly following the given target node.

Parameters
aTargetthe node in the collection after which the sequence should be inserted.
aNodesThe sequences of nodes whose copies should be added to the collection.
Exceptions
XDDY0011if any nodes in the sequence is not a member of a collection or not all nodes of the sequence belong to the same collection.
virtual void zorba::Collection::insertNodesBefore ( const Item aTarget,
const ItemSequence_t aNodes 
)
pure virtual

This function inserts copies of the given nodes into a collection at the position directly preceding the given target node.

Parameters
aTargetthe node in the collection before which the sequence should be inserted.
aNodesThe sequences of nodes whose copies should be added to the collection.
Exceptions
XDDY0011if any nodes in the sequence is not a member of a collection or not all nodes of the sequence belong to the same collection.
virtual void zorba::Collection::insertNodesFirst ( const ItemSequence_t aNodes)
pure virtual

This function inserts copies of the given nodes at the beginning of the collection.

Parameters
aNodesThe sequences of nodes whose copies should be added to the collection.
virtual void zorba::Collection::insertNodesLast ( const ItemSequence_t aNodes)
pure virtual

This function inserts copies of the given nodes at the end of the collection.

Parameters
aNodesThe sequences of nodes whose copies should be added to the collection.
virtual bool zorba::Collection::isStatic ( ) const
pure virtual

The function checks if this collection has been statically declared.

Returns
true if the collection is a static collection, false otherwise.
virtual void zorba::Collection::registerDiagnosticHandler ( DiagnosticHandler aDiagnosticHandler)
pure virtual

Register a DiagnosticHandler to which errors occuring during the management or manipulation of this collection are reported.

If no DiagnosticHandler has been set using (1) this function, (2) the corresponding function of the XmlDataManager, or (3) the corresponding function of the CollectionManager then subclasses of the ZorbaException class are thrown to report errors.

Parameters
aDiagnosticHandlerDiagnosticHandler to which errors are reported. The caller retains ownership over the DiagnosticHandler passed as parameter.
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: