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

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

#include <GloBaseLot.h>

Inheritance diagram for glo::BaseLot:

Public Member Functions

 BaseLot ()
 
 BaseLot (Base &rBase)
 
virtual ~BaseLot ()
 
virtual int appendPers (BasePersistent *pNewObj)
 
virtual int appendPers (std::shared_ptr< BasePersistent > spNewObj)
 
virtual void clear ()=0
 
virtual int getObjID (ObjID &rObjID, EnSeekMode eMode)=0
 
virtual int getPers (BasePersistent *&prRetVal, EnSeekMode eMode)=0
 
virtual int getPers (std::shared_ptr< BasePersistent > &rRetVal, EnSeekMode eMode)
 
virtual int getTypeAsString (std::string &rsTypeName) override
 
virtual bool inLot (const BasePersistent &rObject) const
 
virtual bool inLot (const ObjID &rObjID) const override=0
 
virtual bool inLot (const std::shared_ptr< BasePersistent > spObject) const
 
virtual int insertPers (BasePersistent *pNewObj)
 
virtual int insertPers (std::shared_ptr< BasePersistent > spNewObj)
 
virtual int insertPersBefore (BasePersistent *pNewObj, const BasePersistent *pObject)
 
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 (BasePersistent *pObject)=0
 
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 (BasePersistent *&prRetVal, const ObjID &prObjID)=0
 
virtual int getPersistent (std::shared_ptr< BasePersistent > &rRetVal, const ObjID &rObjID)
 
virtual int setCurrentObject (const BasePersistent &rObject)
 
virtual int setCurrentObject (const ObjID &rObjID)=0
 
virtual int setPosition (std::size_t nPosition)=0
 
virtual std::size_t size () const =0
 
- Public Member Functions inherited from glo::CallBack
 CallBack ()
 
 CallBack (Base &rBase)
 
virtual ~CallBack ()
 
BasegetBase () const
 
virtual void notify (NotifyNote &rNote)
 
CallBackoperator= (const CallBack &rT)
 
virtual void setBase (Base *pBase)
 
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 Member Functions

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)
 

Protected Attributes

unsigned long m_ulClassID
 

Private Member Functions

 BaseLot (const BaseLot &)
 
BaseLotoperator= (const BaseLot &)
 

Private Attributes

std::shared_ptr< LockSpecificationm_spLockSpecification
 
std::shared_ptr< WatchSpecificationm_spWatchSpecification
 

Additional Inherited Members

- Public Attributes inherited from glo::CallBack
std::string m_strDebugInfo
 

Detailed Description

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

Author
Helmut Jakoby

Constructor & Destructor Documentation

◆ BaseLot() [1/3]

glo::BaseLot::BaseLot ( )

Standard constructor.

◆ BaseLot() [2/3]

glo::BaseLot::BaseLot ( Base & rBase)

Constructor with parameter passing.

Parameters
[in]rBaseThe database is passed.

◆ ~BaseLot()

virtual glo::BaseLot::~BaseLot ( )
virtual

Destructor.

◆ BaseLot() [3/3]

glo::BaseLot::BaseLot ( const BaseLot & )
private

The copy constructor is not available.

Member Function Documentation

◆ appendPers() [1/2]

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

Inserts in subclasses a persistent object at the end of the container. Here only the database is set or, if already set, checked.

Parameters
[in]pNewObjThe persistent object to be inserted.
Returns
A return value < 0 indicates an error.

Reimplemented in glo::OndemandSet, glo::PointerSet, glo::OndemandLot, and glo::PointerList.

◆ appendPers() [2/2]

virtual int glo::BaseLot::appendPers ( std::shared_ptr< BasePersistent > spNewObj)
virtual

Inserts in subclasses a persistent object at the end of the container. Here only the database is set or, if already set, checked.

Parameters
[in]spNewObjThe persistent object to be inserted in a std::shared_ptr.
Returns
A return value < 0 indicates an error.

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

◆ clear()

virtual void glo::BaseLot::clear ( )
pure virtual

All objects are removed from the container. The separate lock and watching mode is removed for all objects in the container.

Implemented in glo::OndemandList, glo::OndemandLot, glo::OndemandSet, glo::PointerList, and glo::PointerSet.

◆ getObjID()

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

Returns in subclasses an object ID in rObjID 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.

Implemented in glo::OndemandLot, and glo::PointerLot.

◆ getPers() [1/2]

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

Returns an object from the container in relation to eMode.

Parameters
[in,out]prRetValThe object 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.
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.
See also
BaseLot::getPers( std::shared_ptr<BasePersistent> &, EnSeekMode )

Implemented in glo::OndemandLot, glo::PointerList, glo::PointerSet, and glo::PointerLot.

◆ getPers() [2/2]

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

Returns an object in a std::shared_ptr from the container in relation to eMode.

Parameters
[in,out]rRetValThe object in a std::shared_ptr 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.

◆ getTypeAsString()

virtual int glo::BaseLot::getTypeAsString ( std::string & rsTypeName)
overridevirtual

Returns the class name when connected to the database.

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

Reimplemented from glo::CallBack.

Reimplemented in glo::TOndemandList< T >, glo::TOndemandSet< T >, glo::TPointerList< T >, and glo::TPointerSet< T >.

◆ inLot() [1/3]

virtual bool glo::BaseLot::inLot ( const BasePersistent & rObject) const
virtual

Checks in subclasses whether passed object is in the container.

Parameters
[in]rObjectThe searched object.
Returns
If true, passed object is in the container.

Reimplemented in glo::OndemandList, glo::OndemandLot, glo::OndemandSet, glo::PointerList, glo::PointerLot, and glo::PointerSet.

◆ inLot() [2/3]

virtual bool glo::BaseLot::inLot ( const ObjID & rObjID) const
overridepure virtual

◆ inLot() [3/3]

virtual bool glo::BaseLot::inLot ( const std::shared_ptr< BasePersistent > spObject) const
virtual

Checks whether passed object is in the container.

Parameters
[in]spObjectThe searched object in a std::shared_ptr.
Returns
If true, passed object is in the container.

Reimplemented in glo::OndemandList, glo::OndemandLot, glo::OndemandSet, glo::PointerList, glo::PointerLot, and glo::PointerSet.

◆ insertPers() [1/2]

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

Inserts in the subclasses a persistent object in the container behind the current position. Here only the database is set or, if already set, checked.

Parameters
[in]pNewObjThe persistent object to be inserted.
Returns
A return value < 0 indicates an error.

Reimplemented in glo::OndemandLot, glo::OndemandSet, glo::PointerList, and glo::PointerSet.

◆ insertPers() [2/2]

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

Inserts in the subclasses a persistent object in the container behind the current position. Here only the database is set or, if already set, checked.

Parameters
[in]spNewObjThe persistent object in a std::shared_ptr to be inserted.
Returns
A return value < 0 indicates an error.

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

◆ insertPersBefore() [1/2]

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

Inserts in container a persistent object in the subclasses before another object. Here only the database is set or, if already set, checked.

Parameters
[in]pNewObjThe persistent object to be inserted.
[in]pObjectThe subsequent persistent object.
Returns
A return value < 0 indicates an error.

Reimplemented in glo::OndemandSet, glo::PointerSet, glo::OndemandLot, and glo::PointerLot.

◆ insertPersBefore() [2/2]

virtual int glo::BaseLot::insertPersBefore ( std::shared_ptr< BasePersistent > spNewObj,
const std::shared_ptr< BasePersistent > spObject )
virtual

Inserts in subclasses a persistent object before another object in the container. Here only the database is set or, if already set, checked.

Parameters
[in]spNewObjThe persistent object to be inserted in a std::shared_ptr.
[in]spObjectThe following persistent object in a std::shared_ptr.
Returns
A return value < 0 indicates an error.

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

◆ lock() [1/2]

virtual int glo::BaseLot::lock ( const LockSpecification & rLockSpecification)
virtual

Objects in the container will be locked in the database for other clients (all or none).

Parameters
[in]rLockSpecificationThe lock- and lock depth mode.
Returns
A return value < 0 indicates an error.
Note
To unlock the lock, the corresponding method unlock(const LockSpecification&) with the same parameter value must be used.
See also
Locking multiple persistent objects.

◆ lock() [2/2]

virtual int glo::BaseLot::lock ( EnLockMode eLockMode = LK_DELETEvWRITE,
EnDeepMode eDeepMode = DM_SHALLOW )
virtual

Objects in the container will be locked in the database for other clients (all or none).

Parameters
[in]eLockModeThe lock mode.
[in]eDeepModeThe lock depth mode.
Returns
A return value < 0 indicates an error.
Note
To unlock the lock, the corresponding method unlock(EnLockMode, EnDeepMode) with the same parameter values must be used.
See also
Locking multiple persistent objects.

◆ lockObjID()

int glo::BaseLot::lockObjID ( const ObjID & rObjID)
protected

Locks the object with transferred object ID in the database with the lock mode of the set

Parameters
[in]rObjIDThe object ID of the object to be locked.
Returns
A return value < 0 indicates an error.
See also
Locking a persistent object.

◆ operator=()

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

The assignment operator is not available.

◆ removePers() [1/2]

virtual int glo::BaseLot::removePers ( BasePersistent * pObject)
pure virtual

Removes in subclasses persistent objects passed from the container.

Parameters
[in]pObjectThe persistent object to be removed.
Returns
A return value < 0 indicates an error.

Implemented in glo::OndemandLot, glo::PointerList, glo::PointerSet, and glo::PointerLot.

◆ removePers() [2/2]

virtual int glo::BaseLot::removePers ( std::shared_ptr< BasePersistent > spObject)
virtual

Removes in subclasses persistent objects passed in subclasses from the container.

Parameters
[in]spObjectThe persistent object to be removed in a std::shared_ptr.
Returns
A return value < 0 indicates an error.

◆ setWatch() [1/2]

virtual int glo::BaseLot::setWatch ( const WatchSpecification & rWatchSpec)
virtual

The objects in the container are monitored in the database.

Parameters
[in]rWatchSpecThe monitoring specification.
Returns
A return < 0 indicates an error.
Note
To cancel the monitoring, the corresponding method unsetWatch(const WatchSpecification&) must be used with the same parameter values.
See also
Watch and notify.

◆ setWatch() [2/2]

virtual int glo::BaseLot::setWatch ( TdWatchNotifyMode ulWatchMode,
EnDeepMode eDeepMode,
CallBack * pCallBack = 0 )
virtual

The objects in the container are monitored in the database.

Parameters
[in]ulWatchModeThe watch mode.
Allowed watch modes:
[in]eDeepModeThe lock depth mode.
[in]pCallBackThe CallBack object that is notified via its method CallBack::notify(NotifyNote&). If no CallBack is passed, notify(NotifyNote&) is taken from this; in this case the method notify(NotifyNote&) should be overwritten in the respective derived class.
Returns
A return value < 0 indicates an error.
Note
To remove the monitoring, the corresponding method unsetWatch(TdWatchNotifyMode, EnDeepMode, CallBack*) with same parameter values can be used.
Attention
Basically pCallBack must not be destroyed before the monitoring has been cancelled!
See also
Watch and notify.

◆ setWatchObjID()

int glo::BaseLot::setWatchObjID ( const ObjID & rObjID)
protected

Initiates a monitoring of the object with passed object ID in the database with the monitoring mode of the set.

Parameters
[in]rObjIDThe object ID of the object to be monitored.
Returns
A return value < 0 indicates an error.

◆ takeOverBase() [1/2]

int glo::BaseLot::takeOverBase ( const BasePersistent * pObj)
protected

Takes over the database from the transferred persistent object.

Parameters
[in]pObjThe object whose database is transferred.
Returns
A return value < 0 indicates an error.

◆ takeOverBase() [2/2]

int glo::BaseLot::takeOverBase ( const Reference * pRef)
protected

Adopts the database from a reference to a persistent object.

Parameters
[in]pRefThe reference whose database is taken over.
Returns
A return value < 0 indicates an error.

◆ unlock() [1/2]

virtual int glo::BaseLot::unlock ( const LockSpecification & rLockSpecification)
virtual

Objects in the container are released in the database. A lock release must be called with the same parameters as the previous lock call.

Parameters
[in]rLockSpecificationThe original lock and lock depth mode.
Returns
A return value < 0 indicates an error.
Note
Removes the lock initiated by the corresponding method lock(const LockSpecification&) if the parameter has the same values.
See also
Locking multiple persistent objects.

◆ unlock() [2/2]

virtual int glo::BaseLot::unlock ( EnLockMode eLockMode = LK_DELETEvWRITE,
EnDeepMode eDeepMode = DM_SHALLOW )
virtual

Objects in the container are released in the database. A lock release must be called with the same parameters as the previous lock call.

Parameters
[in]eLockModeThe original lock mode.
[in]eDeepModeThe original lock depth mode.
Returns
A return < 0 indicates an error.
Note
Removes the lock initiated by the corresponding method lock(EnLockMode, EnDeepMode) if the parameters have the same values.
See also
Locking multiple persistent objects.

◆ unlockObjID()

int glo::BaseLot::unlockObjID ( const ObjID & rObjID)
protected

Unlocks the object with transferred object ID in the database with the lock mode of the set

Parameters
[in]rObjIDThe object ID of the object to be unlocked.
Returns
A return value < 0 indicates an error.
See also
Locking a persistent object.

◆ unsetWatch() [1/2]

virtual int glo::BaseLot::unsetWatch ( const WatchSpecification & rWatchSpec)
virtual

The monitoring of the objects in the container is terminated in the database. A monitoring termination must be called with the same parameters as the previous monitoring.

Parameters
[in]rWatchSpecThe original monitoring specification.
Returns
A return < 0 indicates an error.
Note
Terminates the monitoring initiated by the corresponding method setWatchLot(const WatchSpecification&) if the parameters have the same values.
See also
Watch and notify.

◆ unsetWatch() [2/2]

virtual int glo::BaseLot::unsetWatch ( TdWatchNotifyMode ulWatchMode,
EnDeepMode eDeepMode,
CallBack * pCallBack = 0 )
virtual

The monitoring of the objects in the container is terminated in the database. A monitoring termination must be called with the same parameters as the previous monitoring.

Parameters
[in]ulWatchModeThe original watch mode.
Allowed watch modes:
[in]eDeepModeThe original lock depth mode.
[in]pCallBackThe CallBack object that is notified via its method CallBack::notify(NotifyNote&). If no CallBack is passed, notify(NotifyNote&) is taken from this; in this case the method notify(NotifyNote&) should be overwritten in the respective derived class.
Returns
A return value < 0 indicates an error.
Note
Terminates the monitoring initiated by the corresponding method setWatch(TdWatchNotifyMode, EnDeepMode, CallBack*) if the parameters have the same values.
See also
Watch and notify.

◆ unsetWatchObjID()

int glo::BaseLot::unsetWatchObjID ( const ObjID & rObjID)
protected

The monitoring of the object with passed object ID is terminated in the database.

Parameters
[in]rObjIDThe object ID of the object whose monitoring is terminated.
Returns
A return value < 0 indicates an error.

Member Data Documentation

◆ m_spLockSpecification

std::shared_ptr< LockSpecification > glo::BaseLot::m_spLockSpecification
private

There can only be one lock for a container of persistent objects.

Used to lock or release newly inserted objects with this lock.

◆ m_spWatchSpecification

std::shared_ptr< WatchSpecification > glo::BaseLot::m_spWatchSpecification
private

There can only be one monitoring for a container of persistent objects.

Is used to monitor newly inserted objects with this monitoring mode or to cancel monitoring of these objects.

◆ m_ulClassID

unsigned long glo::BaseLot::m_ulClassID
protected

A container of persistent objects is only valid for one class and, if applicable, for its subclasses. This is the class ID.


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