GlobalObjects
Loading...
Searching...
No Matches
glo::OndemandLot Class Referenceabstract

Is the abstract base class of on-demand sets and lists. More...

#include <GloOndemandLot.h>

Inheritance diagram for glo::OndemandLot:

Public Member Functions

 OndemandLot ()
 
 OndemandLot (Base &rBase)
 
virtual ~OndemandLot ()
 
virtual int appendOndemand (const Reference &rNewOndemand)
 
virtual int appendPers (BasePersistent *pNewObj)
 
virtual void clear ()
 
virtual BasegetBase () const override
 
virtual int getObjID (ObjID &rObjID, EnSeekMode eMode)
 
virtual ReferencegetOndemand (EnSeekMode eMode)=0
 
virtual int getPers (BasePersistent *&prRetVal, EnSeekMode eMode)
 
virtual int getPers (glo::ObjID &rObjID, BasePersistent *&prRetVal, EnSeekMode eMode)
 
virtual int getPers (glo::ObjID &rObjID, std::shared_ptr< BasePersistent > &rRetVal, EnSeekMode eMode)
 
virtual int getPers (std::shared_ptr< BasePersistent > &rRetVal, EnSeekMode eMode)
 
virtual int getPersistent (BasePersistent *&prRetVal, const ObjID &rObjID)
 
virtual int insertOndemand (const Reference &rNewOndemand)
 
virtual int insertOndemandBefore (const Reference &rNewOndemand, const Reference &rOndemand)
 
virtual int insertPers (BasePersistent *pNewObj)
 
virtual int insertPers (std::shared_ptr< BasePersistent > spNewObj)
 
virtual int insertPersBefore (BasePersistent *pNewObj, const BasePersistent *pObject)
 
std::list< Reference * > & List ()
 
virtual int removeOndemand (const Reference &rOndemand)
 
virtual int removePers (BasePersistent *pObject)
 
virtual int setBase (Base *pBase) override
 
virtual int setCurrentObject (const ObjID &rObjID)
 
virtual int setPosition (std::size_t nPosition)
 
virtual std::size_t size () const
 
virtual bool inLot (const ObjID &object) const
 Checks if passed object is referenced in the container.
 
virtual bool inLot (const BasePersistent &object) const
 Checks if passed object is referenced in the container.
 
virtual bool inLot (const std::shared_ptr< BasePersistent > object) const
 Checks if passed object is referenced in the container.
 
virtual bool inLot (const Reference &object) const
 Checks if passed object is referenced in the container.
 
- Public Member Functions inherited from glo::BaseLot
 BaseLot ()
 
virtual ~BaseLot ()
 
virtual int appendPers (std::shared_ptr< BasePersistent > spNewObj)
 
virtual int getTypeAsString (std::string &rsTypeName) override
 
virtual int insertPersBefore (std::shared_ptr< BasePersistent > spNewObj, const std::shared_ptr< BasePersistent > spObject)
 
virtual int lock (const LockSpecification &rLockSpecification)
 
virtual int lock (EnLockMode eLockMode=LK_DELETEvWRITE, EnDeepMode eDeepMode=DM_SHALLOW)
 
virtual int removePers (std::shared_ptr< BasePersistent > spObject)
 
virtual int setWatch (const WatchSpecification &rWatchSpec)
 
virtual int setWatch (TdWatchNotifyMode ulWatchMode, EnDeepMode eDeepMode, CallBack *pCallBack=0)
 
virtual int unlock (const LockSpecification &rLockSpecification)
 
virtual int unlock (EnLockMode eLockMode=LK_DELETEvWRITE, EnDeepMode eDeepMode=DM_SHALLOW)
 
virtual int unsetWatch (const WatchSpecification &rWatchSpec)
 
virtual int unsetWatch (TdWatchNotifyMode ulWatchMode, EnDeepMode eDeepMode, CallBack *pCallBack=0)
 
- Public Member Functions inherited from glo::AbstractBaseLot
 AbstractBaseLot ()
 
virtual ~AbstractBaseLot ()
 
virtual int getPersistent (std::shared_ptr< BasePersistent > &rRetVal, const ObjID &rObjID)
 
virtual int setCurrentObject (const BasePersistent &rObject)
 
- Public Member Functions inherited from glo::CallBack
 CallBack ()
 
virtual ~CallBack ()
 
virtual void notify (NotifyNote &rNote)
 
CallBackoperator= (const CallBack &rT)
 
bool operator== (const CallBack &rT) const
 Comparison operator, all attributes are compared.
 
bool operator!= (const CallBack &rT) const
 Comparison operator, all attributes are compared.
 

Protected Attributes

std::list< Reference * > m_odRefList
 
std::list< Reference * >::iterator m_odRefListIterator
 
unsigned long m_ulDatabaseID
 
- Protected Attributes inherited from glo::BaseLot
unsigned long m_ulClassID
 

Private Member Functions

 OndemandLot (const OndemandLot &)
 
OndemandLotoperator= (const OndemandLot &)
 

Additional Inherited Members

- Public Attributes inherited from glo::CallBack
std::string m_strDebugInfo
 
- Protected Member Functions inherited from glo::BaseLot
int lockObjID (const ObjID &rObjID)
 
int setWatchObjID (const ObjID &rObjID)
 
int takeOverBase (const BasePersistent *pObj)
 
int takeOverBase (const Reference *pRef)
 
int unlockObjID (const ObjID &rObjID)
 
int unsetWatchObjID (const ObjID &rObjID)
 
- Protected Member Functions inherited from glo::CallBack
 CallBack (const CallBack &rT)
 
void deinit ()
 
void init ()
 

Detailed Description

Is the abstract base class of on-demand sets and lists.

Author
Helmut Jakoby

Constructor & Destructor Documentation

◆ OndemandLot() [1/3]

glo::OndemandLot::OndemandLot ( )

Standard constructor.

◆ OndemandLot() [2/3]

glo::OndemandLot::OndemandLot ( Base & rBase)

Constructor with parameter passing.

Parameters
[in]rBaseThe database is passed.

◆ ~OndemandLot()

virtual glo::OndemandLot::~OndemandLot ( )
virtual

Destructor.

◆ OndemandLot() [3/3]

glo::OndemandLot::OndemandLot ( const OndemandLot & )
private

The copy constructor is not available.

Member Function Documentation

◆ appendOndemand()

virtual int glo::OndemandLot::appendOndemand ( const Reference & rNewOndemand)
virtual

Appends a reference to a persistent object to the end of the container.

If the container is locked, the referenced object of the reference to be inserted is locked with the container lock mode.

If the container is monitored, the referenced object of the reference to be inserted is also monitored with the monitoring mode of the container.

Parameters
[in]rNewOndemandThe reference to a persistent object to be inserted.
Returns
A return value < 0 indicates an error.
Attention
The internal iterator m_odRefListIterator points to the inserted element if the insertion is successful.

Reimplemented in glo::OndemandList, and glo::OndemandSet.

◆ appendPers()

virtual int glo::OndemandLot::appendPers ( BasePersistent * pNewObj)
virtual

Appends a persistent object to the end of the container.

If the container is locked, the object to be inserted is locked with the lock mode of the container.

If the container is monitored, the object to be inserted is also monitored with the monitoring mode of the container.

Parameters
[in]pNewObjThe persistent object to be inserted.
Returns
A return value < 0 indicates an error.
Attention
The internal iterator m_odRefListIterator points to the inserted element if the insertion is successful.

Reimplemented from glo::BaseLot.

Reimplemented in glo::OndemandSet.

◆ clear()

virtual void glo::OndemandLot::clear ( )
virtual

All objects are removed from the list. The list-specific lock and watching mode is removed for all objects in the list.

Implements glo::BaseLot.

Reimplemented in glo::OndemandList, and glo::OndemandSet.

◆ getBase()

virtual Base * glo::OndemandLot::getBase ( ) const
overridevirtual
Returns
Returns pointers to the database.
Attention
The object returned must not be removed from memory by the calling instance.
See also
setBase(Base*)

Implements glo::BaseLot.

◆ getObjID()

virtual int glo::OndemandLot::getObjID ( ObjID & rObjID,
EnSeekMode eMode )
virtual

Returns an object id from the container in relation to eMode.

Parameters
[in,out]rObjIDThe object ID if found.
[in]eModeThe seek mode.

Parameter examples:

Returns
A return < 0 indicates an error. A return == ERR_RANGE indicates the end of the AllSet.

Implements glo::BaseLot.

◆ getOndemand()

virtual Reference * glo::OndemandLot::getOndemand ( EnSeekMode eMode)
pure virtual

Returns a Reference with respect to eMode.

Parameters
[in]eModeThe seek mode.

Parameter examples:

Returns
If found, the pointer to the found Reference.
Attention
The delivered object remains the responsibility of the delivering OndemandLot; therefore it must not be removed from memory.

Implemented in glo::OndemandList, and glo::OndemandSet.

◆ getPers() [1/4]

virtual int glo::OndemandLot::getPers ( BasePersistent *& prRetVal,
EnSeekMode eMode )
virtual

Returns an object from the container in relation to eMode.

Parameters
[in,out]prRetValIf no error, the fetched object.
[in]eModeThe seek mode.

Parameter examples:

Returns
A return < 0 indicates an error. A return == ERR_RANGE indicates the end of the AllSet.
Attention
If prRetVal is valid, this object must be removed from memory by the calling instance.
Note
It is recommended, if possible, to consider using std::shared_ptr and to use the method get(std::shared_ptr<BasePersistent>&, EnSeekMode).

Implements glo::BaseLot.

◆ getPers() [2/4]

virtual int glo::OndemandLot::getPers ( glo::ObjID & rObjID,
BasePersistent *& prRetVal,
EnSeekMode eMode )
virtual

Returns an object ID and if possible a object from the container of the database in relation to eMode. This also makes it possible to iterate over objects that cannot be read (only the object ID is then returned).

Parameters
[in,out]rObjIDThe object ID.
[in,out]prRetValIf no error, the fetched object.
[in]eModeThe seek mode.

Parameter examples:

Returns
A return < 0 indicates an error. A return == ERR_RANGE indicates the end of the AllSet.
Attention
If prRetVal is valid, this object must be removed from memory by the calling instance.
Note
It is recommended, if possible, to consider using std::shared_ptr and to use the method get(std::shared_ptr<glo::ObjID&, BasePersistent>&, EnSeekMode).

◆ getPers() [3/4]

virtual int glo::OndemandLot::getPers ( glo::ObjID & rObjID,
std::shared_ptr< BasePersistent > & rRetVal,
EnSeekMode eMode )
virtual

Returns an object ID and if possible a object from the container of the database in relation to eMode. This also makes it possible to iterate over objects that cannot be read (only the object ID is then returned).

Parameters
[in,out]rObjIDThe object ID.
[in,out]rRetValIf no error, the fetched object.
[in]eModeThe seek mode.

Parameter examples:

Returns
A return < 0 indicates an error. A return == ERR_RANGE indicates the end of the AllSet.

◆ getPers() [4/4]

virtual int glo::OndemandLot::getPers ( std::shared_ptr< BasePersistent > & rRetVal,
EnSeekMode eMode )
virtual

Returns an object from the container in relation to eMode.

Parameters
[in,out]rRetValIf no error, the fetched object.
[in]eModeThe seek mode.

Parameter examples:

Returns
A return < 0 indicates an error. A return == ERR_RANGE indicates the end of the AllSet.

Reimplemented from glo::BaseLot.

◆ getPersistent()

virtual int glo::OndemandLot::getPersistent ( BasePersistent *& prRetVal,
const ObjID & rObjID )
virtual

Returns an object with passed object ID from the container.

Parameters
[in,out]prRetValIf no error, the fetched object.
[in]rObjIDThe object ID.
Returns
A return value < 0 indicates an error.
Attention
If prRetVal is valid, this object must be removed from memory by the calling instance using BasePersistent::forget().

Implements glo::AbstractBaseLot.

Reimplemented in glo::OndemandList, and glo::OndemandSet.

◆ inLot() [1/4]

virtual bool glo::OndemandLot::inLot ( const BasePersistent & object) const
virtual

Checks if passed object is referenced in the container.

Parameters
[in]objectThe object to check.
Returns
If true, the passed object will be referenced in the container.

Reimplemented from glo::BaseLot.

Reimplemented in glo::OndemandList, and glo::OndemandSet.

◆ inLot() [2/4]

virtual bool glo::OndemandLot::inLot ( const ObjID & object) const
virtual

Checks if passed object is referenced in the container.

Parameters
[in]objectThe object to check.
Returns
If true, the passed object will be referenced in the container.

Implements glo::BaseLot.

Reimplemented in glo::OndemandList, and glo::OndemandSet.

◆ inLot() [3/4]

virtual bool glo::OndemandLot::inLot ( const Reference & object) const
virtual

Checks if passed object is referenced in the container.

Parameters
[in]objectThe object to check.
Returns
If true, the passed object will be referenced in the container.

Reimplemented in glo::OndemandList, and glo::OndemandSet.

◆ inLot() [4/4]

virtual bool glo::OndemandLot::inLot ( const std::shared_ptr< BasePersistent > object) const
virtual

Checks if passed object is referenced in the container.

Parameters
[in]objectThe object to check.
Returns
If true, the passed object will be referenced in the container.

Reimplemented from glo::BaseLot.

Reimplemented in glo::OndemandList, and glo::OndemandSet.

◆ insertOndemand()

virtual int glo::OndemandLot::insertOndemand ( const Reference & rNewOndemand)
virtual

Inserts a reference to a persistent object in the container after the current position.

If the container is locked, the referenced object of the reference to be inserted is locked with the container lock mode.

If the container is monitored, the referenced object of the reference to be inserted is also monitored with the monitoring mode of the container.

Parameters
[in]rNewOndemandThe reference to a persistent object to be inserted.
Returns
A return value < 0 indicates an error.
Attention
The internal iterator m_odRefListIterator points to the inserted element if the insertion is successful.

Reimplemented in glo::OndemandList, and glo::OndemandSet.

◆ insertOndemandBefore()

virtual int glo::OndemandLot::insertOndemandBefore ( const Reference & rNewOndemand,
const Reference & rOndemand )
virtual

Inserts a reference to a persistent object before another one in the container.

If the container is locked, the referenced object of the reference to be inserted is locked with the container lock mode.

If the container is monitored, the referenced object of the reference to be inserted is also monitored with the monitoring mode of the container.

Parameters
[in]rNewOndemandThe reference to a persistent object to be inserted.
[in]rOndemandThe subsequent reference to a persistent object.
Returns
A return value < 0 indicates an error.
Attention
The internal iterator m_odRefListIterator points to the inserted element if the insertion is successful.

Reimplemented in glo::OndemandSet.

◆ insertPers() [1/2]

virtual int glo::OndemandLot::insertPers ( BasePersistent * pNewObj)
virtual

Inserts a persistent object into the container behind the current position.

If the container is locked, the object to be inserted is locked with the lock mode of the container.

If the container is monitored, the object to be inserted is also monitored with the monitoring mode of the container.

Parameters
[in]pNewObjThe persistent object to be inserted.
Returns
A return value < 0 indicates an error.
Attention
The internal iterator m_odRefListIterator points to the inserted element if the insertion is successful.

Reimplemented from glo::BaseLot.

Reimplemented in glo::OndemandSet.

◆ insertPers() [2/2]

virtual int glo::OndemandLot::insertPers ( std::shared_ptr< BasePersistent > spNewObj)
virtual

Inserts a persistent object into the container behind the current position.

If the container is locked, the object to be inserted is locked with the lock mode of the container.

If the container is monitored, the object to be inserted is also monitored with the monitoring mode of the container.

Parameters
[in]spNewObjThe persistent object in a std::shared_ptr to be inserted.
Returns
A return value < 0 indicates an error.
Attention
The internal iterator m_odRefListIterator points to the inserted element if the insertion is successful.

Reimplemented from glo::BaseLot.

Reimplemented in glo::OndemandSet.

◆ insertPersBefore()

virtual int glo::OndemandLot::insertPersBefore ( BasePersistent * pNewObj,
const BasePersistent * pObject )
virtual

Inserts a persistent object before another object in the container.

If the container is locked, the object to be inserted is locked with the lock mode of the container.

If the container is monitored, the object to be inserted is also monitored with the monitoring mode of the container.

Parameters
[in]pNewObjThe persistent object to be inserted.
[in]pObjectThe subsequent persistent object.
Returns
A return value < 0 indicates an error.
Attention
The internal iterator m_odRefListIterator points to the inserted element if the insertion is successful.

Reimplemented from glo::BaseLot.

Reimplemented in glo::OndemandSet.

◆ List()

std::list< Reference * > & glo::OndemandLot::List ( )

Returns reference to the internal object list.

Attention
This possibility of access should only be limited to accessing the objects with another iterator. Adding or removing objects can cause undefined behavior.

◆ operator=()

OndemandLot & glo::OndemandLot::operator= ( const OndemandLot & )
inlineprivate

The assignment operator is not available.

◆ removeOndemand()

virtual int glo::OndemandLot::removeOndemand ( const Reference & rOndemand)
virtual

Removes the passed reference to a persistent object from the container.

If the container is locked, the referenced object of the reference to be removed is released with the container lock mode.

If the container is monitored, the monitoring of the referenced object of the reference to be removed is ended with the monitoring mode of the container.

Parameters
[in]rOndemandThe reference to a persistent object to be removed.
Returns
A return value < 0 indicates an error.
Attention
The internal iterator m_odRefListIterator points to the element following the removed one if the deletion was successful. If there is no subsequent element, the internal iterator m_odRefListIterator points to the container end.

Reimplemented in glo::OndemandList, and glo::OndemandSet.

◆ removePers()

virtual int glo::OndemandLot::removePers ( BasePersistent * pObject)
virtual

Removes the passed persistent object from the container.

If the container is locked, the object to be removed is released with the lock mode of the container.

If the container is monitored, the monitoring of the object to be removed is ended with the monitoring mode of the container.

Parameters
[in]pObjectThe persistent object to be removed.
Returns
A return value < 0 indicates an error.
Attention
The internal iterator m_odRefListIterator points to the element following the removed one if the deletion was successful. If there is no subsequent element, the internal iterator m_odRefListIterator points to the container end.

Implements glo::BaseLot.

◆ setBase()

virtual int glo::OndemandLot::setBase ( Base * pBase)
overridevirtual

Sets the pointer to the database.

Parameters
[in]pBasePointer to the database.
Returns
If return value < 0, then an error has occurred.
Attention
The database remains the responsibility of the calling instance. If, for example, the database is removed from memory, setBase(Base*) must first be called with nullptr or removeBase().

Implements glo::BaseLot.

◆ setCurrentObject()

virtual int glo::OndemandLot::setCurrentObject ( const ObjID & rObjID)
virtual

Sets the internal iterator to the first position of the reference to a persistent object with passed object ID.

Parameters
[in]rObjIDThe object ID.
Returns
A return value < 0 indicates an error.

Implements glo::AbstractBaseLot.

Reimplemented in glo::OndemandList, and glo::OndemandSet.

◆ setPosition()

virtual int glo::OndemandLot::setPosition ( std::size_t nPosition)
virtual

Sets the internal iterator to the passed position.

Parameters
[in]nPositionThe position to be set.
Returns
A return value < 0 indicates an error.

Implements glo::AbstractBaseLot.

Reimplemented in glo::OndemandList, and glo::OndemandSet.

◆ size()

virtual std::size_t glo::OndemandLot::size ( ) const
virtual

Returns the number of objects in the list.

Returns
The number of objects in the list. A return value < 0 indicates an error.

Implements glo::AbstractBaseLot.

Reimplemented in glo::OndemandList, and glo::OndemandSet.

Member Data Documentation

◆ m_odRefList

std::list<Reference *> glo::OndemandLot::m_odRefList
protected

The list of ondemand references of type Reference.

◆ m_odRefListIterator

std::list<Reference*>::iterator glo::OndemandLot::m_odRefListIterator
protected

An internal iterator to the list of on-demand references.

◆ m_ulDatabaseID

unsigned long glo::OndemandLot::m_ulDatabaseID
protected

The reference to a database via the database ID.


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