GlobalObjects
Loading...
Searching...
No Matches
glo::TOndemand< T > Class Template Reference

A reference (as attribute) of a persistent object to another persistent object in the database. More...

#include <GloTOndemand.h>

Inheritance diagram for glo::TOndemand< T >:

Public Member Functions

 TOndemand ()
 
 TOndemand (Base &rBase)
 
 TOndemand (const ObjID &rObjID)
 
 TOndemand (const ObjID &rObjID, Base &rBase)
 
 TOndemand (const TOndemand &rT)
 
virtual ~TOndemand ()
 
int get (std::shared_ptr< T > &rRetVal) const
 
int get (T *&prObj) const
 
int set (const std::shared_ptr< T > &spObj)
 
int set (const T &rObj)
 
int set (const T *pObj)
 
virtual void setReference (const ObjID &rObjID)
 
TOndemand< T > & operator= (const TOndemand &rT)
 Assignment operator.
 
TOndemand< T > & operator= (const Reference &rT)
 Assignment operator.
 
bool operator== (const TOndemand &rT) const
 Comparison operator.
 
bool operator!= (const TOndemand &rT) const
 Comparison operator.
 
- Public Member Functions inherited from glo::Reference
 Reference ()
 
 Reference (Base &rBase)
 
 Reference (const ObjID &rObjID)
 
 Reference (const ObjID &rObjID, Base &rBase)
 
 Reference (const Reference &rT)
 
virtual ~Reference ()
 
virtual int deleteInBase (EnDeepMode eDeepMode=DM_SHALLOW)
 
ObjID getObjID () const
 
const ObjIDgetObjIDAsPointer () const
 
int getReference (BasePersistent *&prRetVal) const
 
int getReference (std::shared_ptr< BasePersistent > &sprRetVal) const
 
virtual int getTypeAsString (std::string &rsTypeName) override
 
virtual int isLocked (const LockSpecification &rLockSpecification) const
 
virtual int isLocked (EnLockMode eLockMode=LK_DELETEvWRITE, EnDeepMode eDeepMode=DM_SHALLOW) const
 
bool isNULL () 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 lock (const LockSpecification &rLockSpecification) const
 
virtual int lock (EnLockMode eLockMode=LK_DELETEvWRITE, EnDeepMode eDeepMode=DM_SHALLOW) const
 
Referenceoperator= (const Reference &rT)
 
void setNULL ()
 
int setReference (const BasePersistent &rObj)
 
int setReference (const BasePersistent *pObj)
 
virtual int setWatch (const WatchSpecification &rWatchSpec) const
 
virtual int setWatch (TdWatchNotifyMode ulWatchMode, EnDeepMode eDeepMode, CallBack *pCallBack=0) const
 
virtual int unlock (const LockSpecification &rLockSpecification) const
 
virtual int unlock (EnLockMode eLockMode=LK_DELETEvWRITE, EnDeepMode eDeepMode=DM_SHALLOW) const
 
virtual int unsetWatch (const WatchSpecification &rWatchSpec) const
 
virtual int unsetWatch (TdWatchNotifyMode ulWatchMode, EnDeepMode eDeepMode, CallBack *pCallBack) const
 
bool operator== (const Reference &rT) const
 Comparison operator.
 
bool operator!= (const Reference &rT) const
 Comparison operator.
 
- 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.
 

Additional Inherited Members

- Public Attributes inherited from glo::CallBack
std::string m_strDebugInfo
 
- Protected Member Functions inherited from glo::CallBack
 CallBack (const CallBack &rT)
 

Detailed Description

template<class T>
class glo::TOndemand< T >

A reference (as attribute) of a persistent object to another persistent object in the database.

In contrast to a pointer to a persistent object (where the referenced object is loaded with the referencing object), TOndemand is a reference to a persistent object via the object ID; it is not loaded with the referencing object from the database, but can be 'reloaded' if needed.

It makes sense to use TOndemand whenever an object references a 'large' object that is not necessarily available in memory.

E.g. in an image management system an image object could contain textual information, a thumpnail and a 'large' image. For some views it may not be useful to get the 'large' image from the database for every display due to speed reasons. In this case a reference via a TOndemand would be useful.

sinnvoll.

Author
Helmut Jakoby

Constructor & Destructor Documentation

◆ TOndemand() [1/5]

template<class T >
glo::TOndemand< T >::TOndemand ( )

Standard constructor.

◆ TOndemand() [2/5]

template<class T >
glo::TOndemand< T >::TOndemand ( const ObjID & rObjID)

Constructor with parameter passing.

Parameters
[in]rObjIDThe object ID of the object to be referenced can be specified during creation.

◆ TOndemand() [3/5]

template<class T >
glo::TOndemand< T >::TOndemand ( Base & rBase)

Constructor with parameter passing.

Parameters
[in]rBaseThe authoritative database can be specified during the creation.

◆ TOndemand() [4/5]

template<class T >
glo::TOndemand< T >::TOndemand ( const ObjID & rObjID,
Base & rBase )

Constructor with parameter passing.

Parameters
[in]rObjIDThe object ID of the object to be referenced and...
[in]rBase...the relevant database can be specified during creation.

◆ TOndemand() [5/5]

template<class T >
glo::TOndemand< T >::TOndemand ( const TOndemand< T > & rT)

Copy constructor.

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

◆ ~TOndemand()

template<class T >
glo::TOndemand< T >::~TOndemand ( )
virtual

Destructor

Member Function Documentation

◆ get() [1/2]

template<class T >
int glo::TOndemand< T >::get ( std::shared_ptr< T > & rRetVal) const

Returns the referenced object from the database (or from memory if already loaded) in a std::shared_ptr.

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

◆ get() [2/2]

template<class T >
int glo::TOndemand< T >::get ( T *& prObj) const

Returns the referenced object from the database (or from memory if already loaded).

Parameters
[in,out]prObjThe pointer reference to the referenced object.
Returns
A return value < 0 indicates an error.
Attention
The returned object must be removed from memory by the calling instance using BasePersistent::forget().

◆ operator!=()

template<class T >
bool glo::TOndemand< T >::operator!= ( const TOndemand< T > & rT) const

Comparison operator.

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

◆ operator=() [1/2]

template<class T >
TOndemand< T > & glo::TOndemand< T >::operator= ( const Reference & rT)

Assignment operator.

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

◆ operator=() [2/2]

template<class T >
TOndemand< T > & glo::TOndemand< T >::operator= ( const TOndemand< T > & rT)

Assignment operator.

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

◆ operator==()

template<class T >
bool glo::TOndemand< T >::operator== ( const TOndemand< T > & rT) const

Comparison operator.

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

◆ set() [1/3]

template<class T >
int glo::TOndemand< T >::set ( const std::shared_ptr< T > & spObj)

Adopts the object ID of the passed object as reference.

Parameters
[in]spObjThe object to be referenced.
Returns
A return value < 0 indicates an error.
Note
Both objects, this one and the one to be referenced must be logged on to the same database.

◆ set() [2/3]

template<class T >
int glo::TOndemand< T >::set ( const T & rObj)

Adopts the object ID of the passed object as reference.

Parameters
[in]rObjThe object to be referenced.
Returns
A return value < 0 indicates an error.
Note
Both objects, this one and the one to be referenced must be logged on to the same database.

◆ set() [3/3]

template<class T >
int glo::TOndemand< T >::set ( const T * pObj)

Adopts the object ID of the passed object as reference.

Parameters
[in]pObjThe pointer to the object to be referenced.
Returns
A return value < 0 indicates an error.
Note
Both objects, this one and the one to be referenced must be logged on to the same database.

◆ setReference()

template<class T >
void glo::TOndemand< T >::setReference ( const ObjID & rObjID)
virtual

Adopts the object ID as reference.

Parameters
[in]rObjIDThe object ID to be referenced.
Note
Both objects, this one and the one to be referenced must be logged on to the same database.

Reimplemented from glo::Reference.


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