BankAndCustomer
Loading...
Searching...
No Matches
SelfWatchingClass Class Reference

Example of a self-observing class that reloads its persistent attributes from the database by calling refresh(), when other instances has change them. More...

#include <SelfWatchingClass.h>

Inheritance diagram for SelfWatchingClass:
Collaboration diagram for SelfWatchingClass:

Public Member Functions

 SelfWatchingClass ()
 
virtual ~SelfWatchingClass ()
 
virtual void activate () override
 
virtual void postStore (int iStoreErr, glo::EnDeepMode eDeepMode, void *pData) override
 
virtual void postDeleteInBase (int iDeleteErr, glo::EnDeepMode eDeepMode, void *pData) override
 
virtual void notify (glo::NotifyNote &rNote) override
 
- Public Member Functions inherited from glo::Persistent
 Persistent ()
 
 Persistent (const Persistent &rT)
 
virtual int assign (Base &rBase) override
 
virtual void removeBase () override
 
virtual ObjID getObjID () const override
 
virtual std::time_t getCreateDate () const override
 
virtual std::time_t getLastChangeDate () const override
 
virtual void takeOverRecord (Record *pRecord) override
 
virtual int preStore (EnDeepMode eDeepMode, void *&prData)
 
virtual int store (EnDeepMode eDeepMode=DM_SHALLOW) override
 
virtual void postStore (int iStoreErr, EnDeepMode eDeepMode, void *pData)
 
virtual int preDeleteInBase (EnDeepMode eDeepMode, void *&prData)
 
virtual int deleteInBase (EnDeepMode eDeepMode=DM_SHALLOW) override
 
virtual void postDeleteInBase (int iDeleteErr, EnDeepMode eDeepMode, void *pData)
 
virtual int preRefresh (void *&prData)
 
virtual int refresh () override
 
virtual void postRefresh (int iRefreshErr, void *pData)
 
virtual int preLock (EnLockMode eLockMode, EnDeepMode eDeepMode, void *&prData)
 
virtual int lock (EnLockMode eLockMode=LK_DELETEvWRITE, EnDeepMode eDeepMode=DM_SHALLOW) override
 
virtual void postLock (int iLockErr, EnLockMode eLockMode, EnDeepMode eDeepMode, void *pData)
 
virtual int preRelock (EnLockMode eLockMode, EnDeepMode eDeepMode, void *&prData)
 
virtual int relock (EnLockMode eLockMode=LK_DELETEvWRITE, EnDeepMode eDeepMode=DM_SHALLOW) override
 
virtual void postRelock (int iLockErr, EnLockMode eLockMode, EnDeepMode eDeepMode, void *pData)
 
virtual int preUnlock (EnLockMode eLockMode, EnDeepMode eDeepMode, void *&prData)
 
virtual int unlock (EnLockMode eLockMode=LK_DELETEvWRITE, EnDeepMode eDeepMode=DM_SHALLOW) override
 
virtual void postUnlock (int iUnlockErr, EnLockMode eLockMode, EnDeepMode eDeepMode, void *pData)
 
virtual int preSetWatch (TdWatchNotifyMode ulWatchMode, EnDeepMode eDeepMode, CallBack *pCallBack, void *&prData)
 
virtual int setWatch (TdWatchNotifyMode ulWatchMode, EnDeepMode eDeepMode, CallBack *pCallBack=0) override
 
virtual void postSetWatch (int iSetWatchErr, TdWatchNotifyMode ulWatchMode, EnDeepMode eDeepMode, CallBack *pCallBack, void *pData)
 
virtual int preUnsetWatch (TdWatchNotifyMode ulWatchMode, EnDeepMode eDeepMode, CallBack *pCallBack, void *&prData)
 
virtual int unsetWatch (TdWatchNotifyMode ulWatchMode, EnDeepMode eDeepMode, CallBack *pCallBack=0) override
 
virtual void postUnsetWatch (int iUnsetWatchErr, TdWatchNotifyMode ulWatchMode, EnDeepMode eDeepMode, CallBack *pCallBack, void *pData)
 
virtual unsigned long getGloClassID () const override
 
virtual int getTypeAsString (std::string &rsTypeName) override
 
virtual int setGloAttribute (const AttributeID &rAttributeID, void *pPara)
 
virtual void * getGloAttribute (const AttributeID &rAttributeID)
 
virtual int setGloAttribute (const std::string &rstrAttributName, void *pPara)
 
virtual void * getGloAttribute (const std::string &rstrAttributName)
 
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 int getClassInfo (ClassInfo *&prClassInfo)
 
virtual unsigned int remember ()
 
virtual unsigned int forget ()
 
virtual bool isAssigned () const
 
unsigned int getLinkCount () const
 
int getRecord (Record *&prRecord) const
 
int getRecord (std::shared_ptr< Record > &rRetVal) const
 
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 getPersAttribute (BaseRecordAttribute *&prRetVal, const std::string &sName) const
 
int getPersAttribute (std::shared_ptr< BaseRecordAttribute > &rRetVal, const std::string &sName) const
 
int getPersAttribute (BaseRecordAttribute *&prRetVal, const AttributeID &rAttributeID) const
 
int getPersAttribute (std::shared_ptr< BaseRecordAttribute > &rRetVal, const AttributeID &rAttributeID) 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 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
 
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
 
virtual bool isStored ()
 
virtual bool isDeletedInBase ()
 
virtual int lock (const LockSpecification &rLockSpecification)
 
virtual int relock (const LockSpecification &rLockSpecification)
 
virtual int unlock (const LockSpecification &rLockSpecification)
 
virtual int isLocked (EnLockMode eLockMode=LK_DELETEvWRITE, EnDeepMode eDeepMode=DM_SHALLOW) const
 
virtual int isLocked (const LockSpecification &rLockSpecification) 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 int getProcessingPossibilities (LockPossibleSpecification &rLockPossibleSpec, EnDeepMode eDeepMode=DM_SHALLOW) const
 
virtual int setWatch (const WatchSpecification &rWatchSpec)
 
virtual int unsetWatch (const WatchSpecification &rWatchSpec)
 
BasePersistentoperator= (const BasePersistent &rT)
 
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 ()
 
virtual void notify (NotifyNote &rNote)
 
virtual void setBase (Base *pBase)
 
Base * getBase () const
 
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

 GLO_OBJECT (SelfWatchingClass:glo::Persistent)
 

Private Attributes

bool m_bIsSelfWatching
 
bool m_bInTheNotifyMethod
 
bool m_bInDestructor
 

Additional Inherited Members

- Public Attributes inherited from glo::CallBack
std::string m_strDebugInfo
 
- Protected Member Functions inherited from glo::Persistent
virtual ~Persistent ()
 
virtual void insertInObjectSpy () const override
 
virtual void removeInObjectSpy () const override
 
virtual void setCreateDate () override
 
virtual void _postAssign (Base &rBase)
 
Persistentoperator= (const Persistent &rT)
 
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)
 
- Protected Attributes inherited from glo::BasePersistent
unsigned int m_uiReferenceCount
 
eut::CriticalSection m_LocalCriticalSection
 
Record * m_pRecord
 
bool m_bSpyaction
 

Detailed Description

Example of a self-observing class that reloads its persistent attributes from the database by calling refresh(), when other instances has change them.

Author
Helmut Jakoby

Constructor & Destructor Documentation

◆ SelfWatchingClass()

SelfWatchingClass::SelfWatchingClass ( )

The attributes are initialized in the constructor.

◆ ~SelfWatchingClass()

virtual SelfWatchingClass::~SelfWatchingClass ( )
virtual

In the destructor the watching is canceled again.

Member Function Documentation

◆ activate()

virtual void SelfWatchingClass::activate ( )
overridevirtual

When the object is loaded from the database, a watching is initiated.

Reimplemented from glo::Persistent.

◆ GLO_OBJECT()

SelfWatchingClass::GLO_OBJECT ( SelfWatchingClass:glo::Persistent )
private

◆ notify()

virtual void SelfWatchingClass::notify ( glo::NotifyNote & rNote)
overridevirtual

This method is called by the database if this object should be notified.

When this object is saved by another instance, a refresh of the attributes from the database is initiated.

Wenn das Objekt von einer anderen Instanz gelöscht wurde, wird das Objekt nicht mehr überwacht.

Parameters
[in]rNoteThe notification information.

◆ postDeleteInBase()

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

Is called in glo::Persistent::deleteInBase(EnDeepMode) after deletion in the database or if deletion fails.

An attempt is made to remove a watching if parameter iDeleteErr == 0.

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**).

◆ postStore()

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

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

An attempt is made to set a watching if parameter iStoreErr == 0.

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**).

Member Data Documentation

◆ m_bInDestructor

bool SelfWatchingClass::m_bInDestructor
private

Set in the destructor to avoid executing notify(glo::NotifyNote&).

◆ m_bInTheNotifyMethod

bool SelfWatchingClass::m_bInTheNotifyMethod
private

If true, the destructor waits until notify(glo::NotifyNote&) is processed.

◆ m_bIsSelfWatching

bool SelfWatchingClass::m_bIsSelfWatching
private

If true, the object has set a watch on itself.


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