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

Abstract base class for Persistent and the generic GenericPersistent. More...

#include <GloBasePersistent.h>

Inheritance diagram for glo::BasePersistent:

Public Member Functions

 BasePersistent ()
 
 BasePersistent (const BasePersistent &rT)
 
virtual int assign (Base &rBase)
 
virtual int deleteInBase (EnDeepMode eDeepMode=DM_SHALLOW)
 
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 BasegetBase () const override
 
virtual int getClassInfo (ClassInfo *&prClassInfo)
 
virtual std::time_t getCreateDate () const =0
 
virtual unsigned long getGloClassID () const =0
 
virtual std::time_t getLastChangeDate () const =0
 
unsigned int getLinkCount () const
 
virtual ObjID getObjID () 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 int getTypeAsString (std::string &rsTypeName) override
 
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)
 
virtual int lock (EnLockMode eLockMode=LK_DELETEvWRITE, EnDeepMode eDeepMode=DM_SHALLOW)
 
BasePersistentoperator= (const BasePersistent &rT)
 
virtual int refresh ()
 
virtual int relock (const LockSpecification &rLockSpecification)
 
virtual int relock (EnLockMode eLockMode=LK_DELETEvWRITE, EnDeepMode eDeepMode=DM_SHALLOW)
 
virtual unsigned int remember ()
 
virtual void removeBase ()
 
virtual int setBase (Base *pBase) override
 
virtual int setWatch (const WatchSpecification &rWatchSpec)
 
virtual int setWatch (TdWatchNotifyMode ulWatchMode, EnDeepMode eDeepMode, CallBack *pCallBack=0)
 
virtual int store (EnDeepMode eDeepMode=DM_SHALLOW)
 
virtual void takeOverRecord (Record *pRecord)
 
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)
 
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 ()
 
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.
 

Protected Member Functions

virtual ~BasePersistent ()
 
virtual void insertInObjectSpy () const =0
 
virtual void removeInObjectSpy () const =0
 
virtual void setCreateDate ()=0
 
void setSpyaction (bool bSpyaction)
 
- Protected Member Functions inherited from glo::CallBack
 CallBack (const CallBack &rT)
 
void deinit ()
 
void init ()
 

Protected Attributes

bool m_bSpyaction
 
eut::CriticalSection m_LocalCriticalSection
 
Basem_pBase
 
Recordm_pRecord
 
unsigned int m_uiReferenceCount
 

Friends

class PrivateBase
 

Additional Inherited Members

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

Detailed Description

Abstract base class for Persistent and the generic GenericPersistent.

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 BasePersistent::remember().
If the owning instance no longer needs the object, the reference counter is decremented via BasePersistent::forget().
When the reference counter runs to 0, the destructor is called automatically.
This error-prone method can be avoided by using the std::shared_ptr if the Forgetter is passed when instantiating a persistent object.

Example (PersClass is the persistent class):

std::shared_ptr<PersClass> t_NewPersObject( new PersClass(), glo::Forgetter<PersClass>() );
Especially for GenericPersistent or derived classes of Persistent the Forget method for std::shared_p...
Definition GloTypes.h:1234
Author
Helmut Jakoby

Constructor & Destructor Documentation

◆ BasePersistent() [1/2]

glo::BasePersistent::BasePersistent ( )

Standard constructor.

◆ ~BasePersistent()

virtual glo::BasePersistent::~BasePersistent ( )
protectedvirtual

Destructor, if necessary memory is cleared.
The destructor is not available. The object may only be removed from memory using forget().

◆ BasePersistent() [2/2]

glo::BasePersistent::BasePersistent ( const BasePersistent & rT)

Copy constructor. Only the pointer to the database is copied here.

Member Function Documentation

◆ assign()

virtual int glo::BasePersistent::assign ( Base & rBase)
virtual

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 in glo::Persistent.

◆ deleteInBase()

virtual int glo::BasePersistent::deleteInBase ( EnDeepMode eDeepMode = DM_SHALLOW)
virtual

The object respectively its persistent attributes are deleted in the database.

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

Reimplemented in glo::Persistent.

◆ forget()

virtual unsigned int glo::BasePersistent::forget ( )
virtual

An object of this class should always be delivered with a previous call to BasePersistent::remember(). The delivered instance must then 'forget' the object using this method.

Returns
The return value is the number of references to the object of this class.
Exceptions
eut::ErrorNExceptionAn exception is thrown if the reference counter wants to go into minus.
Note
It is recommended, if possible, to consider using std::shared_ptr in conjunction with Forgetter.

Reimplemented in glo::GenericPersistent.

◆ getAllPersAttributeNames()

int glo::BasePersistent::getAllPersAttributeNames ( std::list< std::string > & rRetValList,
const std::vector< unsigned long > * pClassIdVector = 0 ) const

Returns all names of the persistent attributes from its record.

Parameters
[in,out]rRetValListThe list of all attribute names.
[in]pClassIdVectorIf passed, only the attributes of the (super-) classes with the ClassID from pClassIdVector are transferred to rRetValMap.
Returns
A return < 0 indicates an error.

◆ getAllPersAttributeNamesSortByID()

int glo::BasePersistent::getAllPersAttributeNamesSortByID ( std::map< AttributeID, std::string > & rRetValMap,
const std::vector< unsigned long > * pClassIdVector = 0 ) const

Returns the names of the persistent attributes sorted by AttributeID from its record.

Parameters
[in,out]rRetValMapThe list of all attribute names.
[in]pClassIdVectorIf passed, only the attributes of the (super-) classes with the ClassID from pClassIdVector are transferred to rRetValMap.
Returns
A return < 0 indicates an error.

◆ getAllPersAttributes() [1/2]

int glo::BasePersistent::getAllPersAttributes ( std::list< BaseRecordAttribute * > & rRetValList,
const std::vector< unsigned long > * pClassIdVector = 0 ) const

Returns all GloBaseRecordAttributes from his record.

Parameters
[in,out]rRetValListThe attributes are appended to this list. The list is not cleaned up before.
[in]pClassIdVectorIf passed, only the attributes of the (super-) classes with the ClassID from pClassIdVector are transferred to rRetValList.
Returns
A return < 0 indicates an error.
Attention
The objects returned in rRetValList must be removed from memory by the calling instance using BaseRecordAttribute::forget().
Note
It is recommended, if possible, to consider using std::shared_ptr in conjunction with Forgetter and to use the method getAllPersAttributes(std::list<std::shared_ptr<BaseRecordAttribute>>&, const std::vector<unsigned long>*)const.

◆ getAllPersAttributes() [2/2]

int glo::BasePersistent::getAllPersAttributes ( std::list< std::shared_ptr< BaseRecordAttribute > > & rRetValList,
const std::vector< unsigned long > * pClassIdVector = 0 ) const

Returns all GloBaseRecordAttributes from his record.

Parameters
[in,out]rRetValListThe attributes are appended to this list. The list is not cleaned up before.
[in]pClassIdVectorIf passed, only the attributes of the (super-) classes with the ClassID from pClassIdVector are transferred to rRetValList.
Returns
A return < 0 indicates an error.

◆ getAllPersAttributesSortByID() [1/2]

int glo::BasePersistent::getAllPersAttributesSortByID ( std::map< AttributeID, BaseRecordAttribute *, std::less< AttributeID > > & rRetValMap,
const std::vector< unsigned long > * pClassIdVector = 0 ) const

Returns all GloBaseRecordAttributes from his record sorted by their AttributeID

Parameters
[in,out]rRetValMapThe attributes are appended to this map. The map is not cleaned up before.
[in]pClassIdVectorIf passed, only the attributes of the (super-) classes with the ClassID from pClassIdVector are transferred to rRetValMap.
Returns
A return < 0 indicates an error.
Attention
The objects returned in rRetValMap must be removed from memory by the calling instance using BaseRecordAttribute::forget().
Note
It is recommended, if possible, to consider using std::shared_ptr in conjunction with Forgetter and to use the method getAllPersAttributesSortByID(std::map<std::string,std::shared_ptr<BaseRecordAttribute>,std::less<std::string>>&,const std::vector<unsigned long>*)const.

◆ getAllPersAttributesSortByID() [2/2]

int glo::BasePersistent::getAllPersAttributesSortByID ( std::map< AttributeID, std::shared_ptr< BaseRecordAttribute >, std::less< AttributeID > > & rRetValMap,
const std::vector< unsigned long > * pClassIdVector = 0 ) const

Returns all GloBaseRecordAttributes from his record sorted by their AttributeID

Parameters
[in,out]rRetValMapThe attributes are appended to this map. The map is not cleaned up before.
[in]pClassIdVectorIf passed, only the attributes of the (super-) classes with the ClassID from pClassIdVector are transferred to rRetValMap.
Returns
A return < 0 indicates an error.

◆ getAllPersAttributesSortByName() [1/2]

int glo::BasePersistent::getAllPersAttributesSortByName ( std::map< std::string, BaseRecordAttribute *, std::less< std::string > > & rRetValMap,
const std::vector< unsigned long > * pClassIdVector = 0 ) const

Returns all GloBaseRecordAttributes from his record sorted by attribute name.

Parameters
[in,out]rRetValMapThe attributes are appended to this map. The map is not cleaned up before.
[in]pClassIdVectorIf passed, only the attributes of the (super-) classes with the ClassID from pClassIdVector are transferred to rRetValMap.
Returns
A return < 0 indicates an error.
Attention
The objects returned in rRetValMap must be removed from memory by the calling instance using BaseRecordAttribute::forget().
Note
It is recommended, if possible, to consider using std::shared_ptr in conjunction with Forgetter and to use the method getAllPersAttributesSortByName(std::map<std::string,std::shared_ptr<BaseRecordAttribute>,std::less<std::string>>&,const std::vector<unsigned long>*)const.

◆ getAllPersAttributesSortByName() [2/2]

int glo::BasePersistent::getAllPersAttributesSortByName ( std::map< std::string, std::shared_ptr< BaseRecordAttribute >, std::less< std::string > > & rRetValMap,
const std::vector< unsigned long > * pClassIdVector = 0 ) const

Returns all GloBaseRecordAttributes from his record sorted by attribute name.

Parameters
[in,out]rRetValMapThe attributes are appended to this map. The map is not cleaned up before.
[in]pClassIdVectorIf passed, only the attributes of the (super-) classes with the ClassID from pClassIdVector are transferred to rRetValMap.
Returns
A return < 0 indicates an error.

◆ getBase()

virtual Base * glo::BasePersistent::getBase ( ) const
overridevirtual
Returns
Returns pointers to the database.
Attention
The object returned must not be removed from memory by the calling instance.
See also
setBase(Base*)

Reimplemented from glo::CallBack.

◆ getClassInfo()

virtual int glo::BasePersistent::getClassInfo ( ClassInfo *& prClassInfo)
virtual

Returns the ClassInfo when connected to database.

Parameters
[in,out]prClassInfoThe ClassInfo of this object.
Returns
If return value < 0, then an error has occurred.
Attention
The supplied ClassInfo must be removed from memory by the calling instance.

◆ getCreateDate()

virtual std::time_t glo::BasePersistent::getCreateDate ( ) const
pure virtual

Returns in subclasses the date of creation in the database.

Returns
The creation date.

Implemented in glo::GenericPersistent, and glo::Persistent.

◆ getGloClassID()

virtual unsigned long glo::BasePersistent::getGloClassID ( ) const
pure virtual
Returns
Returns the own class ID.

Implemented in glo::GenericPersistent, and glo::Persistent.

◆ getLastChangeDate()

virtual std::time_t glo::BasePersistent::getLastChangeDate ( ) const
pure virtual

Returns in subclasses the date of the last change in the database.

Returns
The change date.

Implemented in glo::GenericPersistent, and glo::Persistent.

◆ getLinkCount()

unsigned int glo::BasePersistent::getLinkCount ( ) const
Returns
Supplies the number of referencing instances.
See also
remember() and forget()

◆ getObjID()

virtual ObjID glo::BasePersistent::getObjID ( ) const
virtual
Returns
Supplies the unique ObjID.

Reimplemented in glo::GenericPersistent, and glo::Persistent.

◆ getPersAttribute() [1/4]

int glo::BasePersistent::getPersAttribute ( BaseRecordAttribute *& prRetVal,
const AttributeID & rAttributeID ) const

Returns a BaseRecordAttribute from its data set, which corresponds to the passed attributeID.

Parameters
[in,out]prRetValThe attribute.
[in]rAttributeIDThe attribut ID.
Returns
A return < 0 indicates an error.
Attention
If prRetVal is valid, it must be removed from memory by the calling instance using BaseRecordAttribute::forget()
Note
It is recommended, if possible, to consider using std::shared_ptr in conjunction with Forgetter and to use the method getPersAttribute(std::shared_ptr<BaseRecordAttribute>&, const AttributeID&)const.

◆ getPersAttribute() [2/4]

int glo::BasePersistent::getPersAttribute ( BaseRecordAttribute *& prRetVal,
const std::string & sName ) const

Returns a BaseRecordAttribute from its data set, which corresponds to the transferred description (including the class description) (e.g.: "glo::Persistent.m_dtCreateDate").

Parameters
[in,out]prRetValThe attribute.
[in]sNameThe full name of the data set attribute searched for (e.g. "glo::Persistent.m_dtCreateDate").
Returns
A return < 0 indicates an error.
Attention
If prRetVal is valid, it must be removed from memory by the calling instance using BaseRecordAttribute::forget()
Note
It is recommended, if possible, to consider using std::shared_ptr in conjunction with Forgetter and to use the method getPersAttribute(std::shared_ptr<BaseRecordAttribute>&, const std::string&)const.

◆ getPersAttribute() [3/4]

int glo::BasePersistent::getPersAttribute ( std::shared_ptr< BaseRecordAttribute > & rRetVal,
const AttributeID & rAttributeID ) const

Returns a BaseRecordAttribute from its data set, which corresponds to the passed attributeID.

Parameters
[in,out]rRetValThe attribute in a std::shared_ptr.
[in]rAttributeIDThe attribut ID.
Returns
A return < 0 indicates an error.

◆ getPersAttribute() [4/4]

int glo::BasePersistent::getPersAttribute ( std::shared_ptr< BaseRecordAttribute > & rRetVal,
const std::string & sName ) const

Returns a BaseRecordAttribute from its data set, which corresponds to the transferred description (including the class description) (e.g.: "glo::Persistent.m_dtCreateDate").

Parameters
[in,out]rRetValThe attribute in a std::shared_ptr.
[in]sNameThe full name of the data set attribute searched for (e.g. "glo::Persistent.m_dtCreateDate").
Returns
A return < 0 indicates an error.

◆ getProcessingPossibilities()

virtual int glo::BasePersistent::getProcessingPossibilities ( LockPossibleSpecification & rLockPossibleSpec,
EnDeepMode eDeepMode = DM_SHALLOW ) const
virtual

Returns the allowed options for this object in the database.

Parameters
[in,out]rLockPossibleSpecThe possibility response.
[in]eDeepModeThe depth mode to check.
Returns
A return value < 0 indicates an error.
See also
Check object for locks or access possibilities.

◆ getRecord() [1/2]

int glo::BasePersistent::getRecord ( Record *& prRecord) const

Returns the data record of this object.

Parameters
[in,out]prRecordThe record, if available.
Returns
A return value < 0 indicates an error.
Attention
If prRecord is valid, it must be removed from memory by the calling instance using Record::forget().
Note
It is recommended, if possible, to consider using std::shared_ptr in conjunction with Forgetter and to use the method getRecord(std::shared_ptr<Record>&)const.

◆ getRecord() [2/2]

int glo::BasePersistent::getRecord ( std::shared_ptr< Record > & rRetVal) const

Returns the data record of this object.

Parameters
[in,out]rRetValThe record in a std::shared_ptr, if available.
Returns
A return value < 0 indicates an error.

◆ getTypeAsString()

virtual int glo::BasePersistent::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::CallBack.

Reimplemented in glo::GenericPersistent, and glo::Persistent.

◆ insertInObjectSpy()

virtual void glo::BasePersistent::insertInObjectSpy ( ) const
protectedpure virtual

Inserts the object into its ObjectSpy (in Unterklassen, weil Persistent und GenericPersistent unterschiedliche ObjectSpy's haben).

Implemented in glo::GenericPersistent, and glo::Persistent.

◆ isAssigned()

virtual bool glo::BasePersistent::isAssigned ( ) const
virtual
Returns
Returns true if object is logged on to a database.

◆ isDeletedInBase()

virtual bool glo::BasePersistent::isDeletedInBase ( )
virtual

Queries the database whether the object is deleted (not just any flag in memory, hence 'expensive').

Returns
If true, the object is not stored in the database.
Attention
Deleted objects can no longer be saved with their original ObjID.

◆ isLocked() [1/2]

virtual int glo::BasePersistent::isLocked ( const LockSpecification & rLockSpecification) const
virtual

Queries the database to see if the object is locked by another instance with a specific locking mode (not some flag in memory, so 'expensive').

Parameters
[in]rLockSpecificationThe lock and lock depth mode.
Returns
If > 0, the object is locked in the database with the passed lock mode. A return value < 0 indicates an error.
See also
Check object for locks or access possibilities.

◆ isLocked() [2/2]

virtual int glo::BasePersistent::isLocked ( EnLockMode eLockMode = LK_DELETEvWRITE,
EnDeepMode eDeepMode = DM_SHALLOW ) const
virtual

Queries the database whether the referenced object is locked by another instance with a specific locking mode (not some flag in memory, so 'expensive').

Parameters
[in]eLockModeThe lock mode.
[in]eDeepModeThe lock depth mode.
Returns
If > 0, the object is locked in the database with the passed lock mode. A return value < 0 indicates an error.
See also
Check object for locks or access possibilities.

◆ isPossible() [1/2]

virtual int glo::BasePersistent::isPossible ( bool bRead,
bool bWrite,
bool bDelete,
EnDeepMode eDeepMode = DM_SHALLOW ) const
virtual

The permitted actions for the object in the database are queried.

Parameters
[in]bReadIf true, the read permission is checked.
[in]bWriteIf true, the write permission is checked.
[in]bDeleteIf true, a check is made for delete permissions.
[in]eDeepModeThe depth mode for which it is checked.
Returns
. If return == 0, the respective action is allowed. A return < 0 indicates an error.
See also
Check object for locks or access possibilities.

◆ isPossible() [2/2]

virtual int glo::BasePersistent::isPossible ( const LockPossibleSpecification & rLockPossibleSpec,
EnDeepMode eDeepMode = DM_SHALLOW ) const
virtual

The permitted actions for the object in the database are queried.

Parameters
[in]rLockPossibleSpecThe possibility request.
[in]eDeepModeThe depth mode for which it is checked.
Returns
. If return == 0, the respective action in rLockPossibleSpec is allowed. A return < 0 indicates an error.
See also
Check object for locks or access possibilities.

◆ isStored()

virtual bool glo::BasePersistent::isStored ( )
virtual

Queries the database whether the object is stored (not just any flag in memory, hence 'expensive').

Returns
If true, object is stored in the database.

◆ lock() [1/2]

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

The object is locked in the database for other clients.

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.
Finally, the method Persistent::lock(EnLockMode,EnDeepMode) is called.
See also
Locking a persistent object.

◆ lock() [2/2]

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

The object is locked in the database for other clients.

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 a persistent object.

Reimplemented in glo::Persistent.

◆ operator!=()

bool glo::BasePersistent::operator!= ( const BasePersistent & rT) const

Comparison operator, all attributes are compared.

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

◆ operator=()

BasePersistent & glo::BasePersistent::operator= ( const BasePersistent & rT)

Assignment operator.

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

◆ operator==()

bool glo::BasePersistent::operator== ( const BasePersistent & rT) const

Comparison operator, all attributes are compared.

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

◆ refresh()

virtual int glo::BasePersistent::refresh ( )
virtual

Reads all persistent attributes of the object from the database again.

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 in glo::Persistent.

◆ relock() [1/2]

virtual int glo::BasePersistent::relock ( const LockSpecification & rLockSpecification)
virtual

This method executes an unlock(const LockSpecification&) and then a lock(const LockSpecification&) of an already locked object, whereby newly referenced objects are also locked, depending on the locking mode, if possible, and previously locked referenced objects are released. If newly referenced objects cannot be locked, the previous locked state is retained.

Parameters
[in]rLockSpecificationThe lock- and lock depth mode.
Returns
A return value < 0 indicates an error.
Note
To renew the lock, the same parameter values must be used as for the original lock. To remove the lock, the corresponding method unlock(const LockSpecification&) must be used with the same parameter values.
Finally, the method Persistent::lock(EnLockMode,EnDeepMode) is called.
See also
Locking a persistent object.

◆ relock() [2/2]

virtual int glo::BasePersistent::relock ( EnLockMode eLockMode = LK_DELETEvWRITE,
EnDeepMode eDeepMode = DM_SHALLOW )
virtual

This method executes an unlock(EnLockMode, EnDeepMode) and then a lock(EnLockMode, EnDeepMode) of an already locked object, whereby newly referenced objects are also locked, depending on the locking mode, if possible, and previously locked referenced objects are released. If newly referenced objects cannot be locked, the previous locked state is retained.

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

Reimplemented in glo::Persistent.

◆ remember()

virtual unsigned int glo::BasePersistent::remember ( )
virtual

Increments the reference counter. Should always be called when an object of this class is delivered. The delivered instance must then 'forget' the object with BasePersistent::forget().

Returns
The return value is the number of references to the object of this class.
Note
It is recommended, if possible, to consider using std::shared_ptr in conjunction with Forgetter.

Reimplemented in glo::GenericPersistent.

◆ removeBase()

virtual void glo::BasePersistent::removeBase ( )
virtual

Removes the reference to the database and sets it to nullptr

Reimplemented in glo::GenericPersistent, and glo::Persistent.

◆ removeInObjectSpy()

virtual void glo::BasePersistent::removeInObjectSpy ( ) const
protectedpure virtual

Removes the object from its ObjectSpy (in Unterklassen, weil Persistent und GenericPersistent unterschiedliche ObjectSpy's haben).

Implemented in glo::GenericPersistent, and glo::Persistent.

◆ setBase()

virtual int glo::BasePersistent::setBase ( Base * pBase)
overridevirtual

Sets the pointer to the database.

Parameters
[in]pBasePointer to the database.
Returns
If return value < 0, then an error has occurred.
Attention
The database remains the responsibility of the calling instance. If, for example, the database is removed from memory, setBase(Base*) must first be called with nullptr or removeBase().

Reimplemented from glo::CallBack.

◆ setCreateDate()

virtual void glo::BasePersistent::setCreateDate ( )
protectedpure virtual

Sets the creation date (in subclasses).

Implemented in glo::GenericPersistent, and glo::Persistent.

◆ setSpyaction()

void glo::BasePersistent::setSpyaction ( bool bSpyaction)
protected

Sets m_bSpyaction.

Parameters
[in]bSpyactionIf false, for example in dtor the object is not removed from ObjectSpy.

◆ setWatch() [1/2]

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

The object is 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&) const must be used with the same parameter values.
In principle, it is possible to cancel individual watching modes. Care should then be taken that all individual watching modes are also applied so that no watching remains in the memory until the program is terminated.
Finally, the method Persistent::setWatch(TdWatchNotifyMode,EnDeepMode,CallBack*) is called.
See also
Watch and notify.

◆ setWatch() [2/2]

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

The object is monitored in the database.

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.
In principle, it is possible to cancel individual watching modes. Care should then be taken that all individual watching modes are also applied so that no watching remains in the memory until the program is terminated.
Attention
Basically pCallBack must not be destroyed before the monitoring has been cancelled!
See also
Watch and notify.

Reimplemented in glo::Persistent.

◆ store()

virtual int glo::BasePersistent::store ( EnDeepMode eDeepMode = DM_SHALLOW)
virtual

The object respectively its persistent attributes are stored in the database.

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 in glo::Persistent.

◆ takeOverRecord()

virtual void glo::BasePersistent::takeOverRecord ( Record * pRecord)
virtual

Takes the Record over if not equal to nullptr. In any case, the own existing record in m_pRecord will be 'forgotten'.

Parameters
[in]pRecordThe record to be taken over.

Reimplemented in glo::GenericPersistent, and glo::Persistent.

◆ unlock() [1/2]

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

The object is 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&) const if the parameter has the same values.
Finally, the method Persistent::unLock(EnLockMode,EnDeepMode) is called.
See also
Locking a persistent object.

◆ unlock() [2/2]

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

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

Reimplemented in glo::Persistent.

◆ unsetWatch() [1/2]

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

The monitoring of the object in the database is terminated. 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
Clears the monitoring initiated by the corresponding method setWatch(const WatchSpecification&) const if the parameters have the same values.
In principle, it is possible to cancel individual watching modes. Care should then be taken that all individual watching modes are also applied so that no watching remains in the memory until the program is terminated.
Finally, the method Persistent::unsetWatch(TdWatchNotifyMode,EnDeepMode,CallBack*) is called.
See also
Watch and notify.

◆ unsetWatch() [2/2]

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

The monitoring of the object in the database is terminated. 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 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.
In principle, it is possible to cancel individual watching modes. Care should then be taken that all individual watching modes are also applied so that no watching remains in the memory until the program is terminated.
See also
Watch and notify.

Reimplemented in glo::Persistent.

Friends And Related Symbol Documentation

◆ PrivateBase

friend class PrivateBase
friend

Because of access to various methods.

Member Data Documentation

◆ m_bSpyaction

bool glo::BasePersistent::m_bSpyaction
protected

If false, the object in the destructor of the subclasses (see also there) is not removed from Objektspy (if necessary it should not exist there).
For example, is set to false by PrivateBase when reinstantiating an embedded object.
Default setting = true.

◆ m_LocalCriticalSection

eut::CriticalSection glo::BasePersistent::m_LocalCriticalSection
protected

To allow multiple threads to access BasePersistent::remember() and BasePersistent::forget(), access is synchronized with this CriticalSection.

◆ m_pBase

Base* glo::BasePersistent::m_pBase
protected

Persistend objects belong to a database.

◆ m_pRecord

Record* glo::BasePersistent::m_pRecord
protected

The data set of the object is merged from several data sets in these if necessary.

◆ m_uiReferenceCount

unsigned int glo::BasePersistent::m_uiReferenceCount
protected

The reference counter. See also the class description of BasePersistent.


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