GlobalObjects
Loading...
Searching...
No Matches
glo::TOndemandList< T > Class Template Reference

A type-safe list of references to persistent objects in the database (intended as an attribute for persistent objects). More...

#include <GloTOndemandList.h>

Inheritance diagram for glo::TOndemandList< T >:

Public Member Functions

 TOndemandList ()
 
 TOndemandList (Base &rBase)
 
virtual ~TOndemandList ()
 
virtual int get (glo::ObjID &rObjID, T *&prRetVal, EnSeekMode eMode)
 
virtual int get (std::shared_ptr< T > &rRetVal, const ObjID &rObjID)
 
virtual int get (T *&prRetVal, const ObjID &rObjID)
 
virtual int get (T *&prRetVal, EnSeekMode eMode)
 
virtual int getTypeAsString (std::string &rsTypeName) override
 
virtual int insert (T *NewObj)
 Inserts the passed persistent object into the list behind the current position.
 
virtual int insert (std::shared_ptr< T > NewObj)
 Inserts the passed persistent object into the list behind the current position.
 
virtual int insertBefore (T *NewObj, const T *Object)
 Inserts a persistent object before another object in the list.
 
virtual int insertBefore (std::shared_ptr< T > NewObj, const std::shared_ptr< T > Object)
 Inserts a persistent object before another object in the list.
 
virtual int append (T *NewObj)
 Appends a persistent object to the end of the list.
 
virtual int append (std::shared_ptr< T > NewObj)
 Appends a persistent object to the end of the list.
 
virtual int remove (T *Object)
 Removes the passed persistent object from the list.
 
virtual int remove (std::shared_ptr< T > Object)
 Removes the passed persistent object from the list.
 
virtual int get (std::shared_ptr< T > &rRetVal, EnSeekMode eMode)
 Returns an object from the list in relation to eMode.
 
virtual int get (TOndemand< T > &rRetVal, EnSeekMode eMode)
 Returns an object from the list in relation to eMode.
 
virtual int get (glo::ObjID &rObjID, std::shared_ptr< T > &rRetVal, EnSeekMode eMode)
 Returns an object ID and if possible a object from the container of the database in relation to eMode.
 
virtual int get (glo::ObjID &rObjID, TOndemand< T > &rRetVal, EnSeekMode eMode)
 Returns an object ID and if possible a object from the container of the database in relation to eMode.
 
- Public Member Functions inherited from glo::OndemandList
 OndemandList ()
 
 OndemandList (Base &rBase)
 
virtual ~OndemandList ()
 
virtual int appendOndemand (const Reference &rNewOndemand)
 
virtual void clear ()
 
virtual ReferencegetOndemand (EnSeekMode eMode)
 
virtual int getPersistent (BasePersistent *&prRetVal, const ObjID &rObjID)
 
virtual int insertOndemand (const Reference &rNewOndemand)
 
virtual int removeOndemand (const Reference &rOndemand)
 
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
 See description in superclass.
 
virtual bool inLot (const BasePersistent &object) const
 See description in superclass.
 
virtual bool inLot (const std::shared_ptr< BasePersistent > object) const
 See description in superclass.
 
virtual bool inLot (const Reference &object) const
 See description in superclass.
 
- Public Member Functions inherited from glo::OndemandLot
 OndemandLot ()
 
 OndemandLot (Base &rBase)
 
virtual ~OndemandLot ()
 
virtual int appendPers (BasePersistent *pNewObj) override
 
virtual BasegetBase () const override
 
virtual int getObjID (ObjID &rObjID, EnSeekMode eMode) override
 
virtual int getPers (BasePersistent *&prRetVal, EnSeekMode eMode) override
 
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) override
 
virtual int insertOndemandBefore (const Reference &rNewOndemand, const Reference &rOndemand)
 
virtual int insertPers (BasePersistent *pNewObj) override
 
virtual int insertPers (std::shared_ptr< BasePersistent > spNewObj) override
 
virtual int insertPersBefore (BasePersistent *pNewObj, const BasePersistent *pObject) override
 
std::list< Reference * > & List ()
 
virtual int removePers (BasePersistent *pObject) override
 
virtual int setBase (Base *pBase) override
 
- Public Member Functions inherited from glo::BaseLot
 BaseLot ()
 
virtual ~BaseLot ()
 
virtual int appendPers (std::shared_ptr< BasePersistent > spNewObj)
 
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.
 

Static Public Member Functions

static unsigned long getStaticGloClassID ()
 

Private Member Functions

 TOndemandList (const TOndemandList &)
 
TOndemandList< T > & operator= (const TOndemandList &)
 

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 ()
 
- Protected Attributes inherited from glo::OndemandLot
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
 

Detailed Description

template<class T>
class glo::TOndemandList< T >

A type-safe list of references to persistent objects in the database (intended as an attribute for persistent objects).

Objects can also be inserted multiple times and in any order.

In contrast to a TPointerList (where the referenced objects are automatically 'loaded'), the TOndemandList is a list of references; the referenced objects are not loaded from the database with the referencing object, but can be 'reloaded' if required.

It is always useful if an object is to reference several 'large' objects that do not have to be available.

If objects in one object database are to reference multiple objects in another object database, this is only possible with glo::TOndemandList or glo::TOndemandSet.

Author
Helmut Jakoby

Constructor & Destructor Documentation

◆ TOndemandList() [1/3]

template<class T>
glo::TOndemandList< T >::TOndemandList ( )

Standard constructor.

References glo::CallBack::m_strDebugInfo, and SUPER.

Referenced by TOndemandList(), and operator=().

◆ TOndemandList() [2/3]

template<class T>
glo::TOndemandList< T >::TOndemandList ( Base & rBase)

Constructor with parameter passing.

Parameters
[in]rBaseThe database is passed.

References glo::CallBack::m_strDebugInfo, and SUPER.

◆ ~TOndemandList()

template<class T>
glo::TOndemandList< T >::~TOndemandList ( )
virtual

Destructor, for all objects in the object list the own lock and watch mode is cancelled and then the object list is emptied.

See also
clear()

◆ TOndemandList() [3/3]

template<class T>
glo::TOndemandList< T >::TOndemandList ( const TOndemandList< T > & )
private

The copy constructor is not available.

References TOndemandList().

Member Function Documentation

◆ append() [1/2]

template<class T>
int glo::TOndemandList< T >::append ( std::shared_ptr< T > NewObj)
virtual

Appends a persistent object to the end of the list.

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

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

Parameters
[in]NewObjThe 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.

◆ append() [2/2]

template<class T>
int glo::TOndemandList< T >::append ( T * NewObj)
virtual

Appends a persistent object to the end of the list.

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

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

Parameters
[in]NewObjThe 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.

◆ get() [1/8]

template<class T>
int glo::TOndemandList< T >::get ( glo::ObjID & rObjID,
std::shared_ptr< T > & 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 a std::shared_ptr.
[in]eModeThe seek mode.
Returns
A return < 0 indicates an error.
A return == glo::ERR_RANGE indicates the end of the AllSet and is therefore not a real error.
If a referenced object does not exist in the database, the error glo::ERR_NO_INDEX is returned.

References get().

◆ get() [2/8]

template<class T>
int glo::TOndemandList< T >::get ( glo::ObjID & rObjID,
T *& 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.
Returns
A return < 0 indicates an error.
A return == glo::ERR_RANGE indicates the end of the AllSet and is therefore not a real error.
If a referenced object does not exist in the database, the error glo::ERR_NO_INDEX is returned.
Attention
If prRetVal is valid, this object must be removed from memory by the calling instance. It is recommended to use the method of the same name with a std::shared_ptr.

◆ get() [3/8]

template<class T>
int glo::TOndemandList< T >::get ( glo::ObjID & rObjID,
TOndemand< T > & 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 a std::shared_ptr.
[in]eModeThe seek mode.
Returns
A return < 0 indicates an error.
A return == glo::ERR_RANGE indicates the end of the AllSet and is therefore not a real error.
If a referenced object does not exist in the database, the error glo::ERR_NO_INDEX is returned.

References get(), and glo::TOndemand< T >::set().

◆ get() [4/8]

template<class T>
int glo::TOndemandList< T >::get ( std::shared_ptr< T > & rRetVal,
const ObjID & rObjID )
virtual

Returns an object with passed object ID from the container.

Parameters
[in,out]rRetValIf no error, the fetched object.
[in]rObjIDThe object ID.
Returns
A return < 0 indicates an error.
If a referenced object does not exist in the database, the error glo::ERR_NO_INDEX is returned.

References get().

◆ get() [5/8]

template<class T>
int glo::TOndemandList< T >::get ( std::shared_ptr< T > & rRetVal,
EnSeekMode eMode )
virtual

Returns an object from the list in relation to eMode.

Parameters
[in,out]rRetValIf no error, the fetched object.
[in]eModeThe seek mode.
Returns
A return < 0 indicates an error.
A return == glo::ERR_RANGE indicates the end of the AllSet and is therefore not a real error.
If a referenced object does not exist in the database, the error glo::ERR_NO_INDEX is returned.

References get().

◆ get() [6/8]

template<class T>
int glo::TOndemandList< T >::get ( T *& 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 < 0 indicates an error.
If a referenced object does not exist in the database, the error glo::ERR_NO_INDEX is returned.
Attention
If prRetVal is valid, this object must be removed from memory by the calling instance using BasePersistent::forget(). It is recommended to use the method of the same name with a std::shared_ptr.

◆ get() [7/8]

template<class T>
int glo::TOndemandList< T >::get ( T *& prRetVal,
EnSeekMode eMode )
virtual

Returns an object from the list in relation to eMode.

Parameters
[in,out]prRetValIf no error, the fetched object.
[in]eModeThe seek mode.
Returns
A return < 0 indicates an error.
A return == glo::ERR_RANGE indicates the end of the AllSet and is therefore not a real error.
If a referenced object does not exist in the database, the error glo::ERR_NO_INDEX is returned.
Attention
If prRetVal is valid, this object must be removed from memory by the calling instance. It is recommended to use the method of the same name with a std::shared_ptr.

Referenced by get(), get(), get(), get(), and get().

◆ get() [8/8]

template<class T>
int glo::TOndemandList< T >::get ( TOndemand< T > & rRetVal,
EnSeekMode eMode )
virtual

Returns an object from the list in relation to eMode.

Parameters
[in,out]rRetValIf no error, the fetched object.
[in]eModeThe seek mode.
Returns
A return < 0 indicates an error.
A return == glo::ERR_RANGE indicates the end of the AllSet and is therefore not a real error.
If a referenced object does not exist in the database, the error glo::ERR_NO_INDEX is returned.

References get(), and glo::TOndemand< T >::set().

◆ getStaticGloClassID()

template<class T>
static unsigned long glo::TOndemandList< T >::getStaticGloClassID ( )
inlinestatic

Returns the template class ID.

Returns
The class ID

◆ getTypeAsString()

template<class T>
int glo::TOndemandList< T >::getTypeAsString ( std::string & rsTypeName)
overridevirtual

Returns the type of the template list, i.e. the class name as string when connected to the database.

Parameters
[in,out]rsTypeNameThe type name.
Returns
If return value < 0, an error has occurred.

Reimplemented from glo::BaseLot.

◆ insert() [1/2]

template<class T>
int glo::TOndemandList< T >::insert ( std::shared_ptr< T > NewObj)
virtual

Inserts the passed persistent object into the list behind the current position.

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

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

Parameters
[in]NewObjThe 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.

◆ insert() [2/2]

template<class T>
int glo::TOndemandList< T >::insert ( T * NewObj)
virtual

Inserts the passed persistent object into the list behind the current position.

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

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

Parameters
[in]NewObjThe 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.

◆ insertBefore() [1/2]

template<class T>
int glo::TOndemandList< T >::insertBefore ( std::shared_ptr< T > NewObj,
const std::shared_ptr< T > Object )
virtual

Inserts a persistent object before another object in the list.

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

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

Parameters
[in]NewObjThe persistent object to be inserted.
[in]ObjectThe 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.

◆ insertBefore() [2/2]

template<class T>
int glo::TOndemandList< T >::insertBefore ( T * NewObj,
const T * Object )
virtual

Inserts a persistent object before another object in the list.

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

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

Parameters
[in]NewObjThe persistent object to be inserted.
[in]ObjectThe 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.

◆ operator=()

template<class T>
TOndemandList< T > & glo::TOndemandList< T >::operator= ( const TOndemandList< T > & )
private

The assignment operator is not available.

References TOndemandList().

◆ remove() [1/2]

template<class T>
int glo::TOndemandList< T >::remove ( std::shared_ptr< T > Object)
virtual

Removes the passed persistent object from the list.

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

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

Parameters
[in]ObjectThe 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.

◆ remove() [2/2]

template<class T>
int glo::TOndemandList< T >::remove ( T * Object)
virtual

Removes the passed persistent object from the list.

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

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

Parameters
[in]ObjectThe 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.

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