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

A type-safe set of pointers to persistent objects in the database (intended as an attribute for persistent objects).
Objects can be inserted only once. More...

#include <GloTPointerSet.h>

Inheritance diagram for glo::TPointerSet< T >:

Public Member Functions

 TPointerSet ()
 
 TPointerSet (Base &rBase)
 
virtual ~TPointerSet ()
 
virtual int get (std::shared_ptr< T > &rRetVal, EnSeekMode eMode)
 
virtual int get (T *&prRetVal, EnSeekMode eMode)
 
virtual int getTypeAsString (std::string &rsTypeName) override
 
virtual int insert (std::shared_ptr< T > spNewObj)
 
virtual int insert (T *pNewObj)
 
virtual int remove (std::shared_ptr< T > spObject)
 
virtual int remove (T *pObject)
 
- Public Member Functions inherited from glo::PointerSet
 PointerSet ()
 
 PointerSet (Base &rBase)
 
virtual ~PointerSet ()
 
virtual void clear ()
 
virtual int getPers (BasePersistent *&prRetVal, EnSeekMode eMode)
 
virtual int getPersistent (BasePersistent *&prRetVal, const ObjID &rObjID)
 
virtual int insertPers (BasePersistent *pNewObj)
 
virtual int removePers (BasePersistent *pObject)
 
std::set< BasePersistent * > & Set ()
 
virtual int setCurrentObject (const ObjID &rObjID)
 
virtual int setPosition (std::size_t nPosition)
 
virtual std::size_t size () const
 
virtual void getAllClassIDs (std::list< ObjID > &rAllClassIDs) const
 See description in superclass.
 
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.
 
- Public Member Functions inherited from glo::PointerLot
 PointerLot ()
 
 PointerLot (Base &rBase)
 
virtual ~PointerLot ()
 
virtual BasegetBase () const override
 
virtual int getObjID (ObjID &rObjID, EnSeekMode eMode)
 
virtual int setBase (Base *pBase) override
 
- Public Member Functions inherited from glo::BaseLot
 BaseLot ()
 
virtual ~BaseLot ()
 
virtual int getPers (std::shared_ptr< BasePersistent > &rRetVal, EnSeekMode eMode)
 
virtual int insertPers (std::shared_ptr< BasePersistent > spNewObj)
 
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.
 

Private Member Functions

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

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::BaseLot
unsigned long m_ulClassID
 

Detailed Description

template<class T>
class glo::TPointerSet< T >

A type-safe set of pointers to persistent objects in the database (intended as an attribute for persistent objects).
Objects can be inserted only once.

When a persistent object with an attribute of type TPointerSet is loaded from the database into memory, the objects contained in the TPointerSet are automatically loaded into memory.

This class ensures that the method Persistent::forget() of the contained objects is called when the object is destroyed.

When an object is delivered, the method Persistent::remember() is called.

Author
Helmut Jakoby

Constructor & Destructor Documentation

◆ TPointerSet() [1/3]

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

Standard constructor.

◆ TPointerSet() [2/3]

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

Constructor with parameter passing.

Parameters
[in]rBaseThe database is passed.

◆ ~TPointerSet()

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

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

See also
clear()

◆ TPointerSet() [3/3]

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

The copy constructor is not available.

Member Function Documentation

◆ get() [1/2]

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

Returns an object from the set in relation to eMode.

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

Parameter examples:

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

◆ get() [2/2]

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

Returns an object from the set 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. It is recommended to use the method of the same name with a std::shared_ptr.

◆ getTypeAsString()

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

Returns the type of the template set, 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::TPointerSet< T >::insert ( std::shared_ptr< T > spNewObj)
virtual

Inserts the passed persistent object into the set.

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

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

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

◆ insert() [2/2]

template<class T >
int glo::TPointerSet< T >::insert ( T * pNewObj)
virtual

Inserts the passed persistent object into the set.

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

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

Parameters
[in]pNewObjThe persistent object to be inserted. If no error, the linkcounter is incremented by pNewObj.
Returns
A return value < 0 indicates an error.
Attention
The internal iterator m_poObjSetIterator points to the inserted element if the insertion is successful.

◆ operator=()

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

The assignment operator is not available.

◆ remove() [1/2]

template<class T >
int glo::TPointerSet< T >::remove ( std::shared_ptr< T > spObject)
virtual

Removes the passed persistent object from the set.

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

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

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

◆ remove() [2/2]

template<class T >
int glo::TPointerSet< T >::remove ( T * pObject)
virtual

Removes the passed persistent object from the set.

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

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

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

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