Itasca C++ Interface
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
itasca::IContainer Class Referenceabstract

Interface for containers of IThings. More...

#include <icontainer.h>

Classes

class  IOpaqueIterator
 Interface class for iterating through the container that has a null implementation. More...
 

Public Types

using signal_type = shared::Signal<const IThing *,const IContainer *>
 Defines the Signal2<> type used for removed, added, and destroy signals sent from the container.
 

Public Member Functions

virtual IThinggetIThing ()=0
 Returns the IThing pointer of the container.
 
virtual const IThinggetIThing () const =0
 Returns the const IThing pointer of the container.
 
virtual IContainergetIContainer ()=0
 Returns the IThing pointer of the container.
 
virtual const IContainergetIContainer () const =0
 Returns the const IThing pointer of the container.
 
virtual bool getValueBased () const =0
 Returns TRUE if the container is value based, or pointer based.
 
virtual bool isPartitioned () const =0
 Returns TRUE if the container is partitioned in cluster mode (zones, balls, etc).
 
virtual uint64 getSize () const =0
 Returns the IThing count or number of IThings held in the container.
 
virtual uint64 getNumberHidden () const =0
 Returns the number of IThings that have getHidden()==true.
 
virtual uint64 getNumberSelected () const =0
 Returns the number of IThings that have getSelected()==true.
 
virtual uint64 getNextID () const =0
 
virtual void setNextID (uint64)=0
 Set the maximum ID. This should only be used on a restore if manipulating the container under the hood.
 
virtual IThingremove (IThing *t)=0
 
virtual void erase (IThing *t)=0
 
virtual IThingadd (IThing *t, uint64 id=0)=0
 
virtual void clear ()=0
 
virtual IThingfindWithID (uint64 id)=0
 
virtual const IThingfindWithID (uint64 id) const =0
 
virtual uint64 getInstance (uint64 id) const =0
 Return instance count associated with id, this is always 0 if not a value based container.
 
virtual IThingfindWithName (const IString &s)=0
 
virtual const IThingfindWithName (const IString &s) const =0
 
virtual const signal_typegetAddedSignal () const =0
 
virtual const signal_typegetRemovedSignal () const =0
 
virtual const signal_typegetDestroySignal () const =0
 
virtual IOpaqueIteratoracquire () const =0
 Acquire a new IOpaqueIterator for use iterating through the container.
 
virtual void release (IOpaqueIterator *i) const =0
 
virtual bool atEnd (IOpaqueIterator *i) const =0
 
virtual IThingget (IOpaqueIterator *i)=0
 
virtual const IThingget (IOpaqueIterator *i) const =0
 
virtual bool increment (IOpaqueIterator *i) const =0
 
virtual bool copy (IOpaqueIterator *iSrc, IOpaqueIterator *iDst) const =0
 
virtual IThingdoSilentRemove (IThing *t)=0
 

Public Attributes

signal_type thingAdded
 
signal_type thingRemoved
 
signal_type aboutToDestroy
 

Static Public Attributes

static const TType type_ = 0x51cdf4ed
 The type identification number for this class, for use in convert_cast() and convert_getcast().
 

Detailed Description

Interface for containers of IThings.

A container, derived from IThing, contains a set of IThings. This interface provides methods to add, remove and erase an IThing. In addition, one can search for IThings via their names (as defined by the implementation) or unique integer IDs. A container holds a small granularity callback utility so that other methods can be invoked whenever an IThing is added, removed or erased.

Member Function Documentation

◆ add()

virtual IThing * itasca::IContainer::add ( IThing * t,
uint64 id = 0 )
pure virtual

Add the IThing t to the container. A pointer to t is returned. Any method or Signal2 attached to the Signal2 returned by getAddedSignal() will be executed when add() is invoked.

Parameters
tPointer to an IThing that will be added to the container. If the container is value based, a copy of t is placed in the container, and the return value is not the same as the argument.

◆ atEnd()

virtual bool itasca::IContainer::atEnd ( IOpaqueIterator * i) const
pure virtual

Return true if at the end of the container, false otherwise.

Parameters
iPointer to IOpaqueIterator.

◆ clear()

virtual void itasca::IContainer::clear ( )
pure virtual

Delete each IThing held in the container. Note that remove() is not invoked. Will execute getRemovedSignal() with a null pointer if there is anything in the container.

◆ copy()

virtual bool itasca::IContainer::copy ( IOpaqueIterator * iSrc,
IOpaqueIterator * iDst ) const
pure virtual

Copy the IOpaqueIterator iSrc to iDst. Returns true if this is successful.

Parameters
iSrcPointer to IOpaqueIterator that is the source to be copied.
iDstPointer to IOpaqueIterator that is the destination of the copy.

◆ doSilentRemove()

virtual IThing * itasca::IContainer::doSilentRemove ( IThing * t)
pure virtual

Silently remove t. This means that no events are called. DO NOT USE THIS UNLESS YOU KNOW THAT IT IS NECESSARY!!

◆ erase()

virtual void itasca::IContainer::erase ( IThing * t)
pure virtual

Erase the IThing t from the container. This invokes the remove() function and subsequently deletes t. Any method or Signal2 attached to the Signal2 returned by getRemovedSignal() will be executed when erase() is invoked.

Parameters
tPointer to an IThing that will be erased from the container.

◆ findWithID() [1/2]

virtual const IThing * itasca::IContainer::findWithID ( uint64 id) const
pure virtual

Returns the const IThing pointer to the IThing with the unique integer ID id. Returns 0 if not found.

Parameters
idUnique integer ID corresponding to the IThing to be found.

◆ findWithID() [2/2]

virtual IThing * itasca::IContainer::findWithID ( uint64 id)
pure virtual

Returns the IThing pointer to the IThing with the unique integer ID id. Returns 0 if not found.

Parameters
idUnique integer ID corresponding to the IThing to be found.

◆ findWithName() [1/2]

virtual const IThing * itasca::IContainer::findWithName ( const IString & s) const
pure virtual

Returns the const IThing pointer to the IThing with the name s. The exact meaning of the IString s is defined by the container and the implementing class. Returns 0 if no match is found.

Parameters
sIString name of the IThing to be found.
csQt CaseSensitivity object to specify case sensitivity when searching for the IThing with name s.

◆ findWithName() [2/2]

virtual IThing * itasca::IContainer::findWithName ( const IString & s)
pure virtual

Returns the IThing pointer to the IThing with the name s. The exact meaning of the IString s is defined by the container and the implementing class. Returns 0 if no match is found.

Parameters
sIString name of the IThing to be found.
csQt CaseSensitivity object to specify case sensitivity when searching for the IThing with name s.

◆ get() [1/2]

virtual const IThing * itasca::IContainer::get ( IOpaqueIterator * i) const
pure virtual

Return a const pointer to the IThing the iterator i refers to.

Parameters
iPointer to IOpaqueIterator.

◆ get() [2/2]

virtual IThing * itasca::IContainer::get ( IOpaqueIterator * i)
pure virtual

Return a pointer to the IThing the iterator i refers to.

Parameters
iPointer to IOpaqueIterator.

◆ getAddedSignal()

virtual const signal_type * itasca::IContainer::getAddedSignal ( ) const
pure virtual

Returns the small granularity callback Signal2 object (templatized with IThing * and IContainer * arguments) held in the container to which methods or Signal2 objects are attached that will be executed whenever an IThing is added to the container via the add() function. If the first argument (const IThing *) is null, that indicates that the list has just been restored and that ALL elements of the list have effectively been added.

◆ getDestroySignal()

virtual const signal_type * itasca::IContainer::getDestroySignal ( ) const
pure virtual

Returns the small granularity callback Signal2 object (templatized with IContainer arguments) held in the container to which methods or Signal2 objects are attached that will be executed just before the container itself is destroyed, allowing objects that depend on it (and hold iterators to it) to clear themselves.

◆ getNextID()

virtual uint64 itasca::IContainer::getNextID ( ) const
pure virtual

Returns an ID one larger than the largest ID of any IThing currently in the container. This ID will be assigned automatically to the next added IThing, if it does not have an ID already.

◆ getRemovedSignal()

virtual const signal_type * itasca::IContainer::getRemovedSignal ( ) const
pure virtual

Returns the small granularity callback Signal2 object (templatized with IThing * and IContainer * arguments) held in the container to which methods or Signal2 objects are attached that will be executed whenever an IThing is removed or erased from the container via the remove() or erase() functions. If the first argument (const IThing *) is null, that indicates that the list is about to be cleared of ALL elements.

◆ increment()

virtual bool itasca::IContainer::increment ( IOpaqueIterator * i) const
pure virtual

Increments the iterator if possible. Returns true if the iterator is incremented (e.g., if there is a next IThing in the container) else false.

Parameters
iPointer to IOpaqueIterator.

◆ release()

virtual void itasca::IContainer::release ( IOpaqueIterator * i) const
pure virtual

Release a previously acquired IOpaqueIterator.

Parameters
iPointer to IOpaqueIterator.

◆ remove()

virtual IThing * itasca::IContainer::remove ( IThing * t)
pure virtual

Remove the IThing t from the container. A pointer to t is returned. Any method or Signal2 attached to the Signal2 returned by getRemovedSignal() will be executed when remove() is invoked.

Parameters
tPointer to an IThing that will be removed from the container. This function is not allowed on a value based container, and will automatically trigger an exception.

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