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

Generic persistent class. Does not require ObjCreator or ObjectMaker. Objects from the database can be edited without having to know their type. More...

#include <GloGenericPersistent.h>

Inheritance diagram for glo::GenericPersistent:

Public Member Functions

 GenericPersistent (unsigned long ulDBClassID)
 
virtual unsigned int forget () override
 
virtual std::time_t getCreateDate () const override
 
virtual unsigned long getGloClassID () const override
 
virtual std::time_t getLastChangeDate () const override
 
ObjID getObjID () const override
 
virtual int getTypeAsString (std::string &rsTypeName) override
 
virtual unsigned int remember () override
 
virtual void removeBase () override
 
virtual void takeOverRecord (Record *pRecord) override
 
bool operator== (const GenericPersistent &rT) const
 Comparison operator.
 
bool operator!= (const GenericPersistent &rT) const
 Comparison operator.
 
- Public Member Functions inherited from glo::BasePersistent
 BasePersistent ()
 
 BasePersistent (const BasePersistent &rT)
 
virtual int assign (Base &rBase)
 
virtual int deleteInBase (EnDeepMode eDeepMode=DM_SHALLOW)
 
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)
 
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)
 
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 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 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 ~GenericPersistent ()
 
virtual void insertInObjectSpy () const override
 
virtual void removeInObjectSpy () const override
 
virtual void setCreateDate () override
 
- Protected Member Functions inherited from glo::BasePersistent
virtual ~BasePersistent ()
 
void setSpyaction (bool bSpyaction)
 
- Protected Member Functions inherited from glo::CallBack
 CallBack (const CallBack &rT)
 
void deinit ()
 
void init ()
 

Private Member Functions

 GenericPersistent ()
 
 GenericPersistent (const GenericPersistent &)
 
GenericPersistentoperator= (const GenericPersistent &)
 

Private Attributes

unsigned long m_ulClassID
 

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
 
Basem_pBase
 
Recordm_pRecord
 
unsigned int m_uiReferenceCount
 

Detailed Description

Generic persistent class. Does not require ObjCreator or ObjectMaker. Objects from the database can be edited without having to know their type.

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 GenericPersistent::remember().
If the owning instance no longer needs the object, the reference counter is decremented via GenericPersistent::forget().
When the reference counter runs to 0, the destructor is called automatically.

Author
Helmut Jakoby

Constructor & Destructor Documentation

◆ GenericPersistent() [1/3]

glo::GenericPersistent::GenericPersistent ( )
private

The standard constructor is not available.

◆ GenericPersistent() [2/3]

glo::GenericPersistent::GenericPersistent ( unsigned long ulDBClassID)

Objects of this class must be instantiated with a class ID from the schema.

Parameters
[in]ulDBClassIDThe class ID from the schema.
Exceptions
eut::ErrorNExceptionIf ulDBClassID <= 0 an exception is thrown

◆ ~GenericPersistent()

virtual glo::GenericPersistent::~GenericPersistent ( )
protectedvirtual

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

◆ GenericPersistent() [3/3]

glo::GenericPersistent::GenericPersistent ( const GenericPersistent & )
private

The copy constructor is not available.

Member Function Documentation

◆ forget()

virtual unsigned int glo::GenericPersistent::forget ( )
overridevirtual

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 from glo::BasePersistent.

◆ getCreateDate()

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

Returns the date of creation in the database.

Returns
The creation date.

Implements glo::BasePersistent.

◆ getGloClassID()

virtual unsigned long glo::GenericPersistent::getGloClassID ( ) const
overridevirtual
Returns
The class ID

Implements glo::BasePersistent.

◆ getLastChangeDate()

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

Returns the date of the last change in the database.

Returns
The change date.

Implements glo::BasePersistent.

◆ getObjID()

ObjID glo::GenericPersistent::getObjID ( ) const
overridevirtual

Returns the object ID if available.

Returns
The ObjID, is NULL if not available or object not logged on to database.

Reimplemented from glo::BasePersistent.

◆ getTypeAsString()

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

Returns the class name when connected to the database.

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

Reimplemented from glo::BasePersistent.

◆ insertInObjectSpy()

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

Pastes the object into its ObjectSpy.

Implements glo::BasePersistent.

◆ operator!=()

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

Comparison operator.

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

◆ operator=()

GenericPersistent & glo::GenericPersistent::operator= ( const GenericPersistent & )
private

The assignment operator is not available.

◆ operator==()

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

Comparison operator.

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

◆ remember()

virtual unsigned int glo::GenericPersistent::remember ( )
overridevirtual

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 from glo::BasePersistent.

◆ removeBase()

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

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

Reimplemented from glo::BasePersistent.

◆ removeInObjectSpy()

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

Removes the object from its ObjectSpy.

Implements glo::BasePersistent.

◆ setCreateDate()

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

Sets the creation date to 'now'.

Implements glo::BasePersistent.

◆ takeOverRecord()

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

Transfers the attribute data from the transferred record to its own record, if not equal to nullptr.

Parameters
[in]pRecordThe data record with the attributes to be transferred.

Reimplemented from glo::BasePersistent.

Member Data Documentation

◆ m_ulClassID

unsigned long glo::GenericPersistent::m_ulClassID
private

The class ID of the object from the database.


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