GlobalObjects
Loading...
Searching...
No Matches
glo::Persistent Class Reference

The base class of the persistent classes. All persistent classes must be derived from this class to be able to process their objects in the database. More...

#include <GloPersistent.h>

Inheritance diagram for glo::Persistent:

Public Member Functions

 Persistent ()
 
 Persistent (const Persistent &rT)
 
virtual int assign (Base &rBase) override
 
virtual int deleteInBase (EnDeepMode eDeepMode=DM_SHALLOW) override
 
virtual std::time_t getCreateDate () const override
 
virtual void * getGloAttribute (const AttributeID &rAttributeID)
 
virtual void * getGloAttribute (const std::string &rstrAttributName)
 
virtual unsigned long getGloClassID () const override
 
virtual std::time_t getLastChangeDate () const override
 
virtual ObjID getObjID () const override
 
virtual int getTypeAsString (std::string &rsTypeName) override
 
virtual int lock (EnLockMode eLockMode=LK_DELETEvWRITE, EnDeepMode eDeepMode=DM_SHALLOW) override
 
virtual void postDeleteInBase (int iDeleteErr, EnDeepMode eDeepMode, void *pData)
 
virtual void postLock (int iLockErr, EnLockMode eLockMode, EnDeepMode eDeepMode, void *pData)
 
virtual void postRefresh (int iRefreshErr, void *pData)
 
virtual void postSetWatch (int iSetWatchErr, TdWatchNotifyMode ulWatchMode, EnDeepMode eDeepMode, CallBack *pCallBack, void *pData)
 
virtual void postStore (int iStoreErr, EnDeepMode eDeepMode, void *pData)
 
virtual void postUnlock (int iUnlockErr, EnLockMode eLockMode, EnDeepMode eDeepMode, void *pData)
 
virtual void postUnsetWatch (int iUnsetWatchErr, TdWatchNotifyMode ulWatchMode, EnDeepMode eDeepMode, CallBack *pCallBack, void *pData)
 
virtual int preDeleteInBase (EnDeepMode eDeepMode, void *&prData)
 
virtual int preLock (EnLockMode eLockMode, EnDeepMode eDeepMode, void *&prData)
 
virtual int preRefresh (void *&prData)
 
virtual int preSetWatch (TdWatchNotifyMode ulWatchMode, EnDeepMode eDeepMode, CallBack *pCallBack, void *&prData)
 
virtual int preStore (EnDeepMode eDeepMode, void *&prData)
 
virtual int preUnlock (EnLockMode eLockMode, EnDeepMode eDeepMode, void *&prData)
 
virtual int preUnsetWatch (TdWatchNotifyMode ulWatchMode, EnDeepMode eDeepMode, CallBack *pCallBack, void *&prData)
 
virtual int refresh () override
 
virtual void removeBase () override
 
virtual int setGloAttribute (const AttributeID &rAttributeID, void *pPara)
 
virtual int setGloAttribute (const std::string &rstrAttributName, void *pPara)
 
virtual int setWatch (TdWatchNotifyMode ulWatchMode, EnDeepMode eDeepMode, CallBack *pCallBack=0) override
 
virtual int store (EnDeepMode eDeepMode=DM_SHALLOW) override
 
virtual void takeOverRecord (Record *pRecord) override
 
virtual int unlock (EnLockMode eLockMode=LK_DELETEvWRITE, EnDeepMode eDeepMode=DM_SHALLOW) override
 
virtual int unsetWatch (TdWatchNotifyMode ulWatchMode, EnDeepMode eDeepMode, CallBack *pCallBack=0) override
 
virtual bool isSameOrSuperClassFrom (const glo::Persistent *pPersistent) const
 Checks if passed object can be cast to this.
 
virtual bool isSameOrSuperClassFrom (const std::shared_ptr< glo::Persistent > pPersistent) const
 Checks if passed object can be cast to this.
 
- Public Member Functions inherited from glo::BasePersistent
 BasePersistent ()
 
 BasePersistent (const BasePersistent &)
 
virtual void activate ()
 
virtual unsigned int forget ()
 
int getAllPersAttributeNames (std::list< std::string > &rRetValList, const std::vector< unsigned long > *pClassIdVector=0) const
 
int getAllPersAttributeNamesSortByID (std::map< AttributeID, std::string > &rRetValMap, const std::vector< unsigned long > *pClassIdVector=0) const
 
int getAllPersAttributes (std::list< BaseRecordAttribute * > &rRetValList, const std::vector< unsigned long > *pClassIdVector=0) const
 
int getAllPersAttributes (std::list< std::shared_ptr< BaseRecordAttribute > > &rRetValList, const std::vector< unsigned long > *pClassIdVector=0) const
 
int getAllPersAttributesSortByID (std::map< AttributeID, BaseRecordAttribute *, std::less< AttributeID > > &rRetValMap, const std::vector< unsigned long > *pClassIdVector=0) const
 
int getAllPersAttributesSortByID (std::map< AttributeID, std::shared_ptr< BaseRecordAttribute >, std::less< AttributeID > > &rRetValMap, const std::vector< unsigned long > *pClassIdVector=0) const
 
int getAllPersAttributesSortByName (std::map< std::string, BaseRecordAttribute *, std::less< std::string > > &rRetValMap, const std::vector< unsigned long > *pClassIdVector=0) const
 
int getAllPersAttributesSortByName (std::map< std::string, std::shared_ptr< BaseRecordAttribute >, std::less< std::string > > &rRetValMap, const std::vector< unsigned long > *pClassIdVector=0) const
 
virtual int getClassInfo (ClassInfo *&prClassInfo)
 
unsigned int getLinkCount () const
 
int getPersAttribute (BaseRecordAttribute *&prRetVal, const AttributeID &rAttributeID) const
 
int getPersAttribute (BaseRecordAttribute *&prRetVal, const std::string &sName) const
 
int getPersAttribute (std::shared_ptr< BaseRecordAttribute > &rRetVal, const AttributeID &rAttributeID) const
 
int getPersAttribute (std::shared_ptr< BaseRecordAttribute > &rRetVal, const std::string &sName) const
 
virtual int getProcessingPossibilities (LockPossibleSpecification &rLockPossibleSpec, EnDeepMode eDeepMode=DM_SHALLOW) const
 
int getRecord (Record *&prRecord) const
 
int getRecord (std::shared_ptr< Record > &rRetVal) const
 
virtual bool isAssigned () const
 
virtual bool isDeletedInBase ()
 
virtual int isLocked (const LockSpecification &rLockSpecification) const
 
virtual int isLocked (EnLockMode eLockMode=LK_DELETEvWRITE, EnDeepMode eDeepMode=DM_SHALLOW) const
 
virtual int isPossible (bool bRead, bool bWrite, bool bDelete, EnDeepMode eDeepMode=DM_SHALLOW) const
 
virtual int isPossible (const LockPossibleSpecification &rLockPossibleSpec, EnDeepMode eDeepMode=DM_SHALLOW) const
 
virtual bool isStored ()
 
virtual int lock (const LockSpecification &rLockSpecification)
 
BasePersistentoperator= (const BasePersistent &rT)
 
virtual unsigned int remember ()
 
virtual int setWatch (const WatchSpecification &rWatchSpec)
 
virtual int unlock (const LockSpecification &rLockSpecification)
 
virtual int unsetWatch (const WatchSpecification &rWatchSpec)
 
bool operator== (const BasePersistent &rT) const
 Comparison operator, all attributes are compared.
 
bool operator!= (const BasePersistent &rT) const
 Comparison operator, all attributes are compared.
 
- 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

virtual ~Persistent ()
 
virtual void _postAssign (Base &rBase)
 
virtual void insertInObjectSpy () const override
 
Persistentoperator= (const Persistent &rT)
 
virtual void removeInObjectSpy () const override
 
virtual void setCreateDate () override
 
bool operator== (const Persistent &rT) const
 Comparison operator.
 
bool operator!= (const Persistent &rT) const
 Comparison operator.
 
- Protected Member Functions inherited from glo::BasePersistent
virtual ~BasePersistent ()
 
void setSpyaction (bool bSpyaction)
 
- Protected Member Functions inherited from glo::CallBack
 CallBack (const CallBack &rT)
 

Private Attributes

std::time_t m_dtCreateDate
 
std::time_t m_dtLastChange
 
ObjID m_ObjID
 

Additional Inherited Members

- Public Attributes inherited from glo::CallBack
std::string m_strDebugInfo
 
- Protected Attributes inherited from glo::BasePersistent
bool m_bSpyaction
 
eut::CriticalSection m_LocalCriticalSection
 
Recordm_pRecord
 
unsigned int m_uiReferenceCount
 

Detailed Description

The base class of the persistent classes. All persistent classes must be derived from this class to be able to process their objects in the database.

Objects of this type have a reference counter and must not be removed from memory using the destructor.
Objects with reference counters may only be instantiated once. When passing to another instance, the reference counter must be incremented using Persistent::remember().
If the owning instance no longer needs the object, the reference counter is decremented via Persistent::forget().
When the reference counter runs to 0, the destructor is called automatically.

Author
Helmut Jakoby

Constructor & Destructor Documentation

◆ Persistent() [1/2]

glo::Persistent::Persistent ( )

Standard constructor.

◆ ~Persistent()

virtual glo::Persistent::~Persistent ( )
protectedvirtual

Destructor, the object removes itself from the PersObjectSpy if inside.
The destructor is not available. The object may only be removed from memory using forget().

◆ Persistent() [2/2]

glo::Persistent::Persistent ( const Persistent & rT)

Copy constructor. No attributes of this class are copied!

Member Function Documentation

◆ _postAssign()

virtual void glo::Persistent::_postAssign ( Base & rBase)
protectedvirtual

Called in BasePersistent::assign( Base & rBase ) if not error there. Used in derived classes to supply attributes of type glo::TOndemand and derived glo::BaseLot with the database.

Parameters
[in]rBaseThe database in wich the object is stored.
Attention
This method is used by GlobalObjects and extended in persistent subclasses. Ergo, this method must not be overwritten by the developer.

◆ assign()

virtual int glo::Persistent::assign ( Base & rBase)
overridevirtual

By means of this method, an object of this class is made known to the database and (if successful) receives a unique ObjID (if not already registered).
Only after this method has been called can an object be saved. A persistent object only needs to be logged on to the database once, before it is saved for the first time. Afterwards it keeps its unique ObjID.

Parameters
[in]rBaseThe database in which the object is to be stored.
Returns
A return value < 0 indicates an error.
Note
The transferred database must be open.

Reimplemented from glo::BasePersistent.

◆ deleteInBase()

virtual int glo::Persistent::deleteInBase ( EnDeepMode eDeepMode = DM_SHALLOW)
overridevirtual

The object respectively its persistent attributes are deleted in the database.
Before deleting in the database, the method Persistent::preDeleteInBase(EnDeepMode,void*&) is called, which is given a pointer reference (which can be set in Persistent::preDeleteInBase(EnDeepMode,void*&)) in addition to the glo::EnDeepMode. After deleting or even if not successful. the method Persistent::postDeleteInBase(int,EnDeepMode,void*) is called.
If necessary, Persistent::preDeleteInBase(EnDeepMode,void*&) and Persistent::postDeleteInBase(int,EnDeepMode,void*) can be overwritten.

Parameters
[in]eDeepModeThe deleting depth mode.
Returns
A return < 0 indicates an error.

Reimplemented from glo::BasePersistent.

◆ getCreateDate()

virtual std::time_t glo::Persistent::getCreateDate ( ) const
overridevirtual

Returns the date of creation in the database.

Returns
The creation date.

Implements glo::BasePersistent.

◆ getGloAttribute() [1/2]

virtual void * glo::Persistent::getGloAttribute ( const AttributeID & rAttributeID)
virtual

Returns a pointer to a persistent attribute.

Parameters
[in]rAttributeIDThe attribute ID of the attribute to be returned.
Returns
The void pointer to the persistent attribute.
Exceptions
eut::ErrorNExceptionIf attribute is not found, an exception is thrown.
Attention
This method must be overwritten in the subclasses that have at least one persistent attribute.
Note
This function is required by ObjectMaker.

◆ getGloAttribute() [2/2]

virtual void * glo::Persistent::getGloAttribute ( const std::string & rstrAttributName)
virtual

Returns a pointer to a persistent attribute.

Parameters
[in]rstrAttributNameThe name of the attribute to be set (e.g. "ClassName.AttributName").
Returns
The void pointer to the persistent attribute.
Exceptions
eut::ErrorNExceptionIf attribute is not found, an exception is thrown.
Attention
This method must be overwritten in the subclasses that have at least one persistent attribute.

◆ getGloClassID()

virtual unsigned long glo::Persistent::getGloClassID ( ) const
overridevirtual

Returns the own class ID.

Returns
The class ID
Attention
Must be overwritten in each subclass and return the respective class ID that matches the schema!

Implements glo::BasePersistent.

◆ getLastChangeDate()

virtual std::time_t glo::Persistent::getLastChangeDate ( ) const
overridevirtual

Returns the date of the last change in the database.

Returns
The change date.

Implements glo::BasePersistent.

◆ getObjID()

virtual ObjID glo::Persistent::getObjID ( ) const
overridevirtual
Returns
Returns the unique ObjID.

Reimplemented from glo::BasePersistent.

◆ getTypeAsString()

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

Returns the class name.

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

Reimplemented from glo::BasePersistent.

◆ insertInObjectSpy()

virtual void glo::Persistent::insertInObjectSpy ( ) const
overrideprotectedvirtual

Pastes the object into its ObjectSpy.

Implements glo::BasePersistent.

◆ isSameOrSuperClassFrom() [1/2]

virtual bool glo::Persistent::isSameOrSuperClassFrom ( const glo::Persistent * pPersistent) const
virtual

Checks if passed object can be cast to this.

Parameters
[in]pPersistentPointer to the object to be checked.
Returns
If true, the passed object is of the same type or a subclass of the object of this class..

◆ isSameOrSuperClassFrom() [2/2]

virtual bool glo::Persistent::isSameOrSuperClassFrom ( const std::shared_ptr< glo::Persistent > pPersistent) const
virtual

Checks if passed object can be cast to this.

Parameters
[in]pPersistentPointer to the object to be checked.
Returns
If true, the passed object is of the same type or a subclass of the object of this class..

◆ lock()

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

The object is locked in the database for other clients.
Before locking, the Persistent::preLock(EnLockMode,EnDeepMode,void*&) method is called, which is given a pointer reference (which can be set in Persistent::preLock(EnLockMode,EnDeepMode,void*&)). After locking, or even if it fails, the Persistent::postLock(int,EnLockMode,EnDeepMode,void*) method is called.
If necessary, Persistent::preLock(EnLockMode,EnDeepMode,void*&) and Persistent::postLock(int,EnLockMode,EnDeepMode,void*) can be overwritten.

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) const with the same parameter values must be used.
See also
Locking a persistent object.

Reimplemented from glo::BasePersistent.

◆ operator!=()

bool glo::Persistent::operator!= ( const Persistent & rT) const
protected

Comparison operator.

Parameters
[in]rTThe object to be compared with this one.

◆ operator=()

Persistent & glo::Persistent::operator= ( const Persistent & rT)
protected

Assignment operator.

Parameters
[in]rTThe data is transferred from this object.

◆ operator==()

bool glo::Persistent::operator== ( const Persistent & rT) const
protected

Comparison operator.

Parameters
[in]rTThe object to be compared with this one.

◆ postDeleteInBase()

virtual void glo::Persistent::postDeleteInBase ( int iDeleteErr,
EnDeepMode eDeepMode,
void * pData )
virtual

Is called in Persistent::deleteInBase(EnDeepMode) after deleting in the database.

Parameters
[in]iDeleteErrPossibly a deleting error, if != 0 the deleteing in Persistent::deleteInBase(EnDeepMode) was not performed.
[in]eDeepModeThe deleting depth mode.
[in]pDataData that may ben set in Persistent::preDeleteInBase(EnDeepMode,void**).
Attention
Care must be taken to avoid problems with circular calls.

◆ postLock()

virtual void glo::Persistent::postLock ( int iLockErr,
EnLockMode eLockMode,
EnDeepMode eDeepMode,
void * pData )
virtual

Called in Persistent::lock(EnLockMode,EnDeepMode) after attempting to lock the object.

Parameters
[in]iLockErrPossibly an error during locking. If !=0 the lock in Persistent::lock(EnLockMode,EnDeepMode) was not performed.
[in]eLockModeThe lock mode.
[in]eDeepModeThe lock depth mode.
[in]pDataData that may ben set in Persistent::preLock(EnLockMode,EnDeepMode,void**).
Attention
Care must be taken to avoid problems with circular calls.

◆ postRefresh()

virtual void glo::Persistent::postRefresh ( int iRefreshErr,
void * pData )
virtual

This method is called in Persistent::refresh() after the attempt to reread the persistent attributes of the object.

Parameters
[in]iRefreshErrPossibly an error during the refresh. If !=0 the refresh in Persistent::refresh() was not performed.
[in]pDataData that may ben set in Persistent::preRefresh(void**).
Attention
Care must be taken to avoid problems with circular calls.

◆ postSetWatch()

virtual void glo::Persistent::postSetWatch ( int iSetWatchErr,
TdWatchNotifyMode ulWatchMode,
EnDeepMode eDeepMode,
CallBack * pCallBack,
void * pData )
virtual

Is called in Persistent::setWatch(TdWatchNotifyMode,EnDeepMode,CallBack*) after setting the watching.

Parameters
[in]iSetWatchErrPossibly an error when setting the watching. If !=0 the setting of the watching in Persistent::setWatch(TdWatchNotifyMode,EnDeepMode,CallBack*) was not performed.
[in]ulWatchModeThe watch mode.
[in]eDeepModeThe watching depth mode.
[in]pCallBackThe CallBack object that is notified via its method CallBack::notify(NotifyNote&).
[in]pDataData that may ben set in Persistent::preUnlock(EnLockMode,EnDeepMode,void**).
Attention
Care must be taken to avoid problems with circular calls.

◆ postStore()

virtual void glo::Persistent::postStore ( int iStoreErr,
EnDeepMode eDeepMode,
void * pData )
virtual

Is called in Persistent::store(EnDeepMode) after storing.

Parameters
[in]iStoreErrPossibly a storage error, if != 0 the storing in Persistent::store(EnDeepMode) was not performed.
[in]eDeepModeThe storage depth mode.
[in]pDataData that may ben set in Persistent::preStore(EnDeepMode,void**).
Attention
Care must be taken to avoid problems with circular calls.

◆ postUnlock()

virtual void glo::Persistent::postUnlock ( int iUnlockErr,
EnLockMode eLockMode,
EnDeepMode eDeepMode,
void * pData )
virtual

Called in Persistent::unlock(EnLockMode,EnDeepMode) after attempting to unlock the object.

Parameters
[in]iUnlockErrPossibly an error during unlocking. If !=0 the unlocking in Persistent::unlock(EnLockMode,EnDeepMode) was not performed.
[in]eLockModeThe lock mode.
[in]eDeepModeThe lock depth mode.
[in]pDataData that may ben set in Persistent::preUnlock(EnLockMode,EnDeepMode,void**).
Attention
Care must be taken to avoid problems with circular calls.

◆ postUnsetWatch()

virtual void glo::Persistent::postUnsetWatch ( int iUnsetWatchErr,
TdWatchNotifyMode ulWatchMode,
EnDeepMode eDeepMode,
CallBack * pCallBack,
void * pData )
virtual

Called in Persistent::unsetWatch(TdWatchNotifyMode,EnDeepMode,CallBack*) after watching is stopped.

Parameters
[in]iUnsetWatchErrPossibly an error when stopping the watching. If !=0 the watching was not stopped in Persistent::unsetWatch(TdWatchNotifyMode,EnDeepMode,CallBack*).
[in]ulWatchModeThe original watch mode.
[in]eDeepModeThe original watching depth mode.
[in]pCallBackThe CallBack object that was notified via its method CallBack::notify(NotifyNote&).
[in]pDataData that may ben set in Persistent::preUnlock(EnLockMode,EnDeepMode,void**).
Attention
Care must be taken to avoid problems with circular calls.

◆ preDeleteInBase()

virtual int glo::Persistent::preDeleteInBase ( EnDeepMode eDeepMode,
void *& prData )
virtual

Is called in Persistent::deleteInBase(EnDeepMode) before deleting in the database.

Parameters
[in]eDeepModeThe deleting depth mode.
[in]prDataData can be passed to Persistent::postDeleteInBase(int,EnDeepMode,void*) via this reference.
Returns
A return < 0 indicates an error.
Note
If an error is returned, the deleting in Persistent::deleteInBase(EnDeepMode) is not performed and returns the error returned here.
Attention
If this method is overridden, do not call this in it, because this method always returns 0 as error.
Care must be taken to avoid problems with circular calls.

◆ preLock()

virtual int glo::Persistent::preLock ( EnLockMode eLockMode,
EnDeepMode eDeepMode,
void *& prData )
virtual

Is called in Persistent::lock(EnLockMode,EnDeepMode) before the object is locked in the database for other clients.

Parameters
[in]eLockModeThe lock mode.
[in]eDeepModeThe lock depth mode.
[in]prDataData can be passed to Persistent::postLock(int,EnLockMode,EnDeepMode,void*) via this reference.
Returns
A return < 0 indicates an error.
Note
If an error is returned, the locking in Persistent::lock(EnLockMode,EnDeepMode) is not performed and itself returns the error that occurred here.
Attention
If this method is overridden, do not call this in it, because this method always returns 0 as error.
Care must be taken to avoid problems with circular calls.

◆ preRefresh()

virtual int glo::Persistent::preRefresh ( void *& prData)
virtual

Is called in Persistent::refresh() before all persistent attributes of the object are re-read from the database.

Parameters
[in]prDataData can be passed to Persistent::postRefresh(int,void*) via this reference.
Returns
A return < 0 indicates an error.
Note
If an error is returned, the reread in Persistent::refresh() is not performed and returns the error encountered here.
Attention
If this method is overridden, do not call this in it, because this method always returns 0 as error.
Care must be taken to avoid problems with circular calls.

◆ preSetWatch()

virtual int glo::Persistent::preSetWatch ( TdWatchNotifyMode ulWatchMode,
EnDeepMode eDeepMode,
CallBack * pCallBack,
void *& prData )
virtual

Is called in Persistent::setWatch(TdWatchNotifyMode,EnDeepMode,CallBack*) before watching is initiated.

Parameters
[in]ulWatchModeThe watch mode.
[in]eDeepModeThe watching depth mode.
[in]pCallBackThe CallBack object that is notified via its method CallBack::notify(NotifyNote&).
[in]prDataData can be passed to Persistent::postSetWatch(int,TdWatchNotifyMode,EnDeepMode,CallBack*,void*) via this reference.
Returns
A return < 0 indicates an error.
Note
If an error is returned, the watching in Persistent::setWatch(TdWatchNotifyMode,EnDeepMode,CallBack*) is not performed and returns the error that occurred here.
Attention
If this method is overridden, do not call this in it, because this method always returns 0 as error.
Care must be taken to avoid problems with circular calls.

◆ preStore()

virtual int glo::Persistent::preStore ( EnDeepMode eDeepMode,
void *& prData )
virtual

Is called in Persistent::store(EnDeepMode) before storing.

Parameters
[in]eDeepModeThe storage depth mode.
[in]prDataData can be passed to Persistent::postStore(int,EnDeepMode,void*) via this reference.
Returns
A return < 0 indicates an error.
Note
If an error is returned, the storing in Persistent::store(EnDeepMode) is not performed and returns the error returned here.
Attention
If this method is overridden, do not call this in it, because this method always returns 0 as error.
Care must be taken to avoid problems with circular calls.

◆ preUnlock()

virtual int glo::Persistent::preUnlock ( EnLockMode eLockMode,
EnDeepMode eDeepMode,
void *& prData )
virtual

Called in Persistent::unLock(EnLockMode,EnDeepMode) before the object in the database is shared with other clients.

Parameters
[in]eLockModeThe original lock mode.
[in]eDeepModeThe original lock depth mode.
[in]prDataData can be passed to Persistent::postUnlock(int,EnLockMode,EnDeepMode,void*) via this reference.
Returns
A return < 0 indicates an error.
Note
If an error is returned, the unlock in Persistent::unlock(EnLockMode,EnDeepMode) is not performed and returns the error that occurred here.
Attention
If this method is overridden, do not call this in it, because this method always returns 0 as error.
Care must be taken to avoid problems with circular calls.

◆ preUnsetWatch()

virtual int glo::Persistent::preUnsetWatch ( TdWatchNotifyMode ulWatchMode,
EnDeepMode eDeepMode,
CallBack * pCallBack,
void *& prData )
virtual

Called in Persistent::unsetWatch(TdWatchNotifyMode,EnDeepMode,CallBack*) before stopping watching.

Parameters
[in]ulWatchModeThe original watch mode.
[in]eDeepModeThe original watching depth mode.
[in]pCallBackThe CallBack object that was notified via its method CallBack::notify(NotifyNote&).
[in]prDataData can be passed to Persistent::postunsetWatch(int,TdWatchNotifyMode,EnDeepMode,CallBack*,void*) via this reference.
Returns
A return < 0 indicates an error.
Note
If an error is returned, the monitoring in Persistent::unsetWatch(TdWatchNotifyMode,EnDeepMode,CallBack*) is not terminated and returns the error that occurred here.
Attention
If this method is overridden, do not call this in it, because this method always returns 0 as error.
Care must be taken to avoid problems with circular calls.

◆ refresh()

virtual int glo::Persistent::refresh ( )
overridevirtual

Reads all persistent attributes of the object from the database again.
The Persistent::preRefresh(void*&) method is called before the refresh, and a pointer reference (which can be set in Persistent::preRefresh(void*&) ) is given to it. After the refresh, or even if it fails, the Persistent::postRefresh(int,void*) method is called.
If necessary, Persistent::preRefresh(void*&) and Persistent::postRefresh(int,void*) can be overwritten.

Returns
A return value < 0 indicates an error.
Note
If the object is in a transaction that is not yet completed, the values are retrieved from the transaction.
See also
GlobalObjects Transaction.

Reimplemented from glo::BasePersistent.

◆ removeBase()

virtual void glo::Persistent::removeBase ( )
overridevirtual

Removes the reference to the database and removes itself from the PersObjectSpy, if inside.

Reimplemented from glo::BasePersistent.

◆ removeInObjectSpy()

virtual void glo::Persistent::removeInObjectSpy ( ) const
overrideprotectedvirtual

Removes the object from its ObjectSpy.

Implements glo::BasePersistent.

◆ setCreateDate()

virtual void glo::Persistent::setCreateDate ( )
overrideprotectedvirtual

Sets the creation date to 'now'.

Implements glo::BasePersistent.

◆ setGloAttribute() [1/2]

virtual int glo::Persistent::setGloAttribute ( const AttributeID & rAttributeID,
void * pPara )
virtual

Sets a persistent attribute.

Parameters
[in]rAttributeIDThe attribute ID of the attribute to be set
[in]pParaThe value to be set as void pointer, internally a static_cast is performed!
Returns
If attribute is not found, ERR_ATTRIBUTE_NOT_IN_SOURCE_OBJECT is returned.
Attention
This method must be overwritten in the subclasses that have at least one persistent attribute.
Note
This function is required by ObjectMaker.

◆ setGloAttribute() [2/2]

virtual int glo::Persistent::setGloAttribute ( const std::string & rstrAttributName,
void * pPara )
virtual

Sets a persistent attribute.

Parameters
[in]rstrAttributNameThe name of the attribute to be set (e.g. "ClassName.AttributName").
[in]pParaThe value to be set as void pointer, internally a static_cast is performed!
Returns
If attribute is not found, ERR_ATTRIBUTE_NOT_IN_SOURCE_OBJECT is returned.
Attention
This method must be overwritten in the subclasses that have at least one persistent attribute.

◆ setWatch()

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

The object is monitored in the database.
Before watching the object, the Persistent::preSetWatch(TdWatchNotifyMode,EnDeepMode,CallBack*,void*&) method is called, which is given a pointer reference (which can be set in Persistent::preSetWatch(TdWatchNotifyMode,EnDeepMode,CallBack,void*&)). After the watch request, or even if it fails, the Persistent::postSetWatch(int,TdWatchNotifyMode,EnDeepMode,CallBack*,void*) method is called.
If necessary, Persistent::preSetWatch(TdWatchNotifyMode,EnDeepMode,CallBack*,void*&) and Persistent::postSetWatch(int,TdWatchNotifyMode,EnDeepMode,CallBack*,void*) can be overwritten.

Parameters
[in]ulWatchModeThe watch mode.
Allowed watch modes:
[in]eDeepModeThe watching 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*) const 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.

Reimplemented from glo::BasePersistent.

◆ store()

virtual int glo::Persistent::store ( EnDeepMode eDeepMode = DM_SHALLOW)
overridevirtual

The object respectively its persistent attributes are stored in the database.
Before storing, the method Persistent::preStore(EnDeepMode,void*&) is called, which is given a pointer reference (which can be set in Persistent::preStore(EnDeepMode,void*&)) in addition to the glo::EnDeepMode. After storing or even if not successful. the method Persistent::postStore(int,EnDeepMode,void*) is called.
if necessary, Persistent::preStore(EnDeepMode,void*&) and Persistent::postStore(int,EnDeepMode,void*) can be overwritten.

Parameters
[in]eDeepModeThe storage depth mode.
Returns
A return < 0 indicates an error.
Note
The object must be known to the database respectively logged in there.
See also
BasePersistent::assign(Base&)

Reimplemented from glo::BasePersistent.

◆ takeOverRecord()

virtual void glo::Persistent::takeOverRecord ( Record * pRecord)
overridevirtual

Adopts transferred record if unequal to NULL_PTR.

If a valid record is passed, m_dtCreateDate and m_dtLastChange will be taken from the record.

Parameters
[in]pRecordThe record to be transferred.

Reimplemented from glo::BasePersistent.

◆ unlock()

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

The object is released in the database. A lock release must be called with the same parameters as the previous lock call.
Before unlocking the method Persistent::preUnlock(EnLockMode,EnDeepMode,void*&) is called, which is given a pointer reference (which can be set in Persistent::preUnlock(EnLockMode,EnDeepMode,void*&)). After unlocking, or even if its fails, the Persistent::postUnlock(int,EnLockMode,EnDeepMode,void*) method is called.
If necessary, Persistent::preUnlock(EnLockMode,EnDeepMode,void*&) and Persistent::postUnlock(int,EnLockMode,EnDeepMode,void*) can be overwritten.

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) const if the parameters have the same values.
See also
Locking a persistent object.

Reimplemented from glo::BasePersistent.

◆ unsetWatch()

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

The monitoring of the object in the database is terminated. A monitoring termination must be called with the same parameters as the previous monitoring.
Before the watching is stopped, the Persistent::preUnsetWatch(TdWatchNotifyMode,EnDeepMode,CallBack*,void*&) method is called, which is given a pointer reference (which can be set in Persistent::preUnsetWatch(TdWatchNotifyMode,EnDeepMode,CallBack,void*&)). After the watching is finished or even if it fails, the Persistent::postUnsetWatch(int,TdWatchNotifyMode,EnDeepMode,CallBack*,void*) method is called.
If necessary, Persistent::preUnsetWatch(TdWatchNotifyMode,EnDeepMode,CallBack*,void*&) and Persistent::postUnsetWatch(int,TdWatchNotifyMode,EnDeepMode,CallBack*,void*) can be overwritten.

Parameters
[in]ulWatchModeThe original watch mode.
Allowed watch modes:
[in]eDeepModeThe original monitoring depth mode.
[in]pCallBackThe CallBack object that was 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
Clears the monitoring initiated by the corresponding method setWatch(TdWatchNotifyMode, EnDeepMode, CallBack*) const if the parameters have the same values.
See also
Watch and notify.

Reimplemented from glo::BasePersistent.

Member Data Documentation

◆ m_dtCreateDate

std::time_t glo::Persistent::m_dtCreateDate
private

The creation date is set in a database after a successful login.

◆ m_dtLastChange

std::time_t glo::Persistent::m_dtLastChange
private

The last modification date in the database will be set when successfully saved in a database.

◆ m_ObjID

ObjID glo::Persistent::m_ObjID
private

The ObjID. If a data record is referenced, the ObjID is retrieved from it.


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