GlobalObjects
|
Abstract base class for Persistent and the generic GenericPersistent. More...
#include <GloBasePersistent.h>
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 Base * | getBase () 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) |
BasePersistent & | operator= (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) |
CallBack & | operator= (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 |
Base * | m_pBase |
Record * | m_pRecord |
unsigned int | m_uiReferenceCount |
Friends | |
class | PrivateBase |
Additional Inherited Members | |
Public Attributes inherited from glo::CallBack | |
std::string | m_strDebugInfo |
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):
glo::BasePersistent::BasePersistent | ( | ) |
Standard constructor.
|
protectedvirtual |
Destructor, if necessary memory is cleared.
The destructor is not available. The object may only be removed from memory using forget().
glo::BasePersistent::BasePersistent | ( | const BasePersistent & | rT | ) |
Copy constructor. Only the pointer to the database is copied here.
|
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.
[in] | rBase | The database in which the object is to be stored. |
Reimplemented in glo::Persistent.
|
virtual |
The object respectively its persistent attributes are deleted in the database.
[in] | eDeepMode | The deleting depth mode. |
Reimplemented in glo::Persistent.
|
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.
eut::ErrorNException | An exception is thrown if the reference counter wants to go into minus. |
Reimplemented in glo::GenericPersistent.
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.
[in,out] | rRetValList | The list of all attribute names. |
[in] | pClassIdVector | If passed, only the attributes of the (super-) classes with the ClassID from pClassIdVector are transferred to rRetValMap. |
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.
[in,out] | rRetValMap | The list of all attribute names. |
[in] | pClassIdVector | If passed, only the attributes of the (super-) classes with the ClassID from pClassIdVector are transferred to rRetValMap. |
int glo::BasePersistent::getAllPersAttributes | ( | std::list< BaseRecordAttribute * > & | rRetValList, |
const std::vector< unsigned long > * | pClassIdVector = 0 ) const |
Returns all GloBaseRecordAttributes from his record.
[in,out] | rRetValList | The attributes are appended to this list. The list is not cleaned up before. |
[in] | pClassIdVector | If passed, only the attributes of the (super-) classes with the ClassID from pClassIdVector are transferred to rRetValList. |
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.
[in,out] | rRetValList | The attributes are appended to this list. The list is not cleaned up before. |
[in] | pClassIdVector | If passed, only the attributes of the (super-) classes with the ClassID from pClassIdVector are transferred to rRetValList. |
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
[in,out] | rRetValMap | The attributes are appended to this map. The map is not cleaned up before. |
[in] | pClassIdVector | If passed, only the attributes of the (super-) classes with the ClassID from pClassIdVector are transferred to rRetValMap. |
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
[in,out] | rRetValMap | The attributes are appended to this map. The map is not cleaned up before. |
[in] | pClassIdVector | If passed, only the attributes of the (super-) classes with the ClassID from pClassIdVector are transferred to rRetValMap. |
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.
[in,out] | rRetValMap | The attributes are appended to this map. The map is not cleaned up before. |
[in] | pClassIdVector | If passed, only the attributes of the (super-) classes with the ClassID from pClassIdVector are transferred to rRetValMap. |
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.
[in,out] | rRetValMap | The attributes are appended to this map. The map is not cleaned up before. |
[in] | pClassIdVector | If passed, only the attributes of the (super-) classes with the ClassID from pClassIdVector are transferred to rRetValMap. |
|
overridevirtual |
Reimplemented from glo::CallBack.
|
virtual |
|
pure virtual |
Returns in subclasses the date of creation in the database.
Implemented in glo::GenericPersistent, and glo::Persistent.
|
pure virtual |
Implemented in glo::GenericPersistent, and glo::Persistent.
|
pure virtual |
Returns in subclasses the date of the last change in the database.
Implemented in glo::GenericPersistent, and glo::Persistent.
unsigned int glo::BasePersistent::getLinkCount | ( | ) | const |
|
virtual |
Reimplemented in glo::GenericPersistent, and glo::Persistent.
int glo::BasePersistent::getPersAttribute | ( | BaseRecordAttribute *& | prRetVal, |
const AttributeID & | rAttributeID ) const |
Returns a BaseRecordAttribute from its data set, which corresponds to the passed attributeID.
[in,out] | prRetVal | The attribute. |
[in] | rAttributeID | The attribut ID. |
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").
[in,out] | prRetVal | The attribute. |
[in] | sName | The full name of the data set attribute searched for (e.g. "glo::Persistent.m_dtCreateDate"). |
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.
[in,out] | rRetVal | The attribute in a std::shared_ptr. |
[in] | rAttributeID | The attribut ID. |
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").
[in,out] | rRetVal | The attribute in a std::shared_ptr. |
[in] | sName | The full name of the data set attribute searched for (e.g. "glo::Persistent.m_dtCreateDate"). |
|
virtual |
Returns the allowed options for this object in the database.
[in,out] | rLockPossibleSpec | The possibility response. |
[in] | eDeepMode | The depth mode to check. |
int glo::BasePersistent::getRecord | ( | Record *& | prRecord | ) | const |
Returns the data record of this object.
[in,out] | prRecord | The record, if available. |
int glo::BasePersistent::getRecord | ( | std::shared_ptr< Record > & | rRetVal | ) | const |
Returns the data record of this object.
[in,out] | rRetVal | The record in a std::shared_ptr, if available. |
|
overridevirtual |
Returns the class name.
[in,out] | rsTypeName | The type name. |
Reimplemented from glo::CallBack.
Reimplemented in glo::GenericPersistent, and glo::Persistent.
|
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.
|
virtual |
|
virtual |
Queries the database whether the object is deleted (not just any flag in memory, hence 'expensive').
|
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').
[in] | rLockSpecification | The lock and lock depth mode. |
|
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').
[in] | eLockMode | The lock mode. |
[in] | eDeepMode | The lock depth mode. |
|
virtual |
The permitted actions for the object in the database are queried.
[in] | bRead | If true, the read permission is checked. |
[in] | bWrite | If true, the write permission is checked. |
[in] | bDelete | If true, a check is made for delete permissions. |
[in] | eDeepMode | The depth mode for which it is checked. |
|
virtual |
The permitted actions for the object in the database are queried.
[in] | rLockPossibleSpec | The possibility request. |
[in] | eDeepMode | The depth mode for which it is checked. |
|
virtual |
Queries the database whether the object is stored (not just any flag in memory, hence 'expensive').
|
virtual |
The object is locked in the database for other clients.
[in] | rLockSpecification | The lock- and lock depth mode. |
|
virtual |
The object is locked in the database for other clients.
[in] | eLockMode | The lock mode. |
[in] | eDeepMode | The lock depth mode. |
Reimplemented in glo::Persistent.
bool glo::BasePersistent::operator!= | ( | const BasePersistent & | rT | ) | const |
Comparison operator, all attributes are compared.
[in] | rT | The object to be compared with this one. |
BasePersistent & glo::BasePersistent::operator= | ( | const BasePersistent & | rT | ) |
Assignment operator.
[in] | rT | The data is transferred from this object. |
bool glo::BasePersistent::operator== | ( | const BasePersistent & | rT | ) | const |
Comparison operator, all attributes are compared.
[in] | rT | The object to be compared with this one. |
|
virtual |
Reads all persistent attributes of the object from the database again.
Reimplemented in glo::Persistent.
|
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.
[in] | rLockSpecification | The lock- and lock depth mode. |
|
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.
[in] | eLockMode | The lock mode. |
[in] | eDeepMode | The lock depth mode. |
Reimplemented in glo::Persistent.
|
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().
Reimplemented in glo::GenericPersistent.
|
virtual |
Removes the reference to the database and sets it to nullptr
Reimplemented in glo::GenericPersistent, and glo::Persistent.
|
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.
|
overridevirtual |
Sets the pointer to the database.
[in] | pBase | Pointer to the database. |
Reimplemented from glo::CallBack.
|
protectedpure virtual |
Sets the creation date (in subclasses).
Implemented in glo::GenericPersistent, and glo::Persistent.
|
protected |
Sets m_bSpyaction.
[in] | bSpyaction | If false, for example in dtor the object is not removed from ObjectSpy. |
|
virtual |
The object is monitored in the database.
[in] | rWatchSpec | The monitoring specification. |
|
virtual |
The object is monitored in the database.
[in] | ulWatchMode | The watch mode. Allowed watch modes:
|
[in] | eDeepMode | The watching depth mode. |
[in] | pCallBack | The 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. |
Reimplemented in glo::Persistent.
|
virtual |
The object respectively its persistent attributes are stored in the database.
[in] | eDeepMode | The storage depth mode. |
Reimplemented in glo::Persistent.
|
virtual |
Takes the Record over if not equal to nullptr. In any case, the own existing record in m_pRecord will be 'forgotten'.
[in] | pRecord | The record to be taken over. |
Reimplemented in glo::GenericPersistent, and glo::Persistent.
|
virtual |
The object is released in the database. A lock release must be called with the same parameters as the previous lock call.
[in] | rLockSpecification | The original lock and lock depth mode. |
|
virtual |
The object is released in the database. A lock release must be called with the same parameters as the previous lock call.
[in] | eLockMode | The original lock mode. |
[in] | eDeepMode | The original lock depth mode. |
Reimplemented in glo::Persistent.
|
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.
[in] | rWatchSpec | The original monitoring specification. |
|
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.
[in] | ulWatchMode | The original watch mode. Allowed watch modes:
|
[in] | eDeepMode | The original monitoring depth mode. |
[in] | pCallBack | The 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. |
Reimplemented in glo::Persistent.
|
friend |
Because of access to various methods.
|
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.
|
protected |
To allow multiple threads to access BasePersistent::remember() and BasePersistent::forget(), access is synchronized with this CriticalSection.
|
protected |
Persistend objects belong to a database.
|
protected |
The data set of the object is merged from several data sets in these if necessary.
|
protected |
The reference counter. See also the class description of BasePersistent.