The base class of a reference attribute from persistent objects to other persistent objects in the database.
More...
#include <GloReference.h>
|
| Reference () |
|
| Reference (const ObjID &rObjID) |
|
| Reference (Base &rBase) |
|
| Reference (const ObjID &rObjID, Base &rBase) |
|
| Reference (const Reference &rT) |
|
virtual | ~Reference () |
|
virtual int | getTypeAsString (std::string &rsTypeName) override |
|
bool | isNULL () const |
|
void | setNULL () |
|
ObjID | getObjID () const |
|
const ObjID * | getObjIDAsPointer () const |
|
virtual void | setReference (const ObjID &rObjID) |
|
int | setReference (const BasePersistent *pObj) |
|
int | setReference (const BasePersistent &rObj) |
|
int | getReference (BasePersistent *&prRetVal) const |
|
int | getReference (std::shared_ptr< BasePersistent > &sprRetVal) const |
|
virtual int | deleteInBase (EnDeepMode eDeepMode=DM_SHALLOW) |
|
virtual int | lock (EnLockMode eLockMode=LK_DELETEvWRITE, EnDeepMode eDeepMode=DM_SHALLOW) const |
|
virtual int | lock (const LockSpecification &rLockSpecification) const |
|
virtual int | unlock (EnLockMode eLockMode=LK_DELETEvWRITE, EnDeepMode eDeepMode=DM_SHALLOW) const |
|
virtual int | unlock (const LockSpecification &rLockSpecification) const |
|
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 | setWatch (TdWatchNotifyMode ulWatchMode, EnDeepMode eDeepMode, CallBack *pCallBack=0) const |
|
virtual int | setWatch (const WatchSpecification &rWatchSpec) const |
|
virtual int | unsetWatch (TdWatchNotifyMode ulWatchMode, EnDeepMode eDeepMode, CallBack *pCallBack) const |
|
virtual int | unsetWatch (const WatchSpecification &rWatchSpec) const |
|
Reference & | operator= (const Reference &rT) |
|
|
bool | operator== (const Reference &rT) const |
| Comparison operator.
|
|
bool | operator!= (const Reference &rT) const |
| Comparison operator.
|
|
| CallBack () |
|
| CallBack (Base &rBase) |
|
virtual | ~CallBack () |
|
virtual void | notify (NotifyNote &rNote) |
|
virtual void | setBase (Base *pBase) |
|
Base * | getBase () const |
|
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.
|
|
The base class of a reference attribute from persistent objects to other persistent objects in the database.
- Copyright
- © 2010 Helmut Jakoby
- Author
- Helmut Jakoby
◆ Reference() [1/5]
glo::Reference::Reference |
( |
| ) |
|
◆ Reference() [2/5]
glo::Reference::Reference |
( |
const ObjID & | rObjID | ) |
|
Constructor with parameter passing.
- Parameters
-
[in] | rObjID | The object ID of the object to be referenced can be specified during creation. |
◆ Reference() [3/5]
glo::Reference::Reference |
( |
Base & | rBase | ) |
|
Constructor with parameter passing.
- Parameters
-
[in] | rBase | The authoritative database can be specified during the creation. |
◆ Reference() [4/5]
glo::Reference::Reference |
( |
const ObjID & | rObjID, |
|
|
Base & | rBase ) |
Constructor with parameter passing.
- Parameters
-
[in] | rObjID | The object ID of the object to be referenced and... |
[in] | rBase | ...the relevant database can be specified during creation. |
◆ Reference() [5/5]
glo::Reference::Reference |
( |
const Reference & | rT | ) |
|
Copy constructor.
- Parameters
-
[in] | rT | The data is copied from this object. |
◆ ~Reference()
virtual glo::Reference::~Reference |
( |
| ) |
|
|
virtual |
◆ deleteInBase()
virtual int glo::Reference::deleteInBase |
( |
EnDeepMode | eDeepMode = DM_SHALLOW | ) |
|
|
virtual |
Referenced object is deleted from the database.
- Parameters
-
[in] | eDeepMode | The Deep Mode |
- Returns
- A return < 0 indicates an error.
◆ getObjID()
ObjID glo::Reference::getObjID |
( |
| ) |
const |
Returns the object ID of the reference.
- Returns
- See above.
◆ getObjIDAsPointer()
const ObjID * glo::Reference::getObjIDAsPointer |
( |
| ) |
const |
Returns the object ID of the reference as pointer.
- Returns
- See above.
◆ getReference() [1/2]
Returns the referenced object from the database (or from memory if already loaded).
- Parameters
-
[in,out] | prRetVal | 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().
◆ getReference() [2/2]
int glo::Reference::getReference |
( |
std::shared_ptr< BasePersistent > & | sprRetVal | ) |
const |
Returns the referenced object from the database (or from memory if already loaded).
- Parameters
-
[in,out] | sprRetVal | The referenced object. |
- Returns
- A return value < 0 indicates an error.
◆ getTypeAsString()
virtual int glo::Reference::getTypeAsString |
( |
std::string & | rsTypeName | ) |
|
|
overridevirtual |
Returns the type of the reference, i.e. the class name as string when connected to the database.
- Parameters
-
[in,out] | rsTypeName | The type name. |
- Returns
- If return value < 0, then an error has occurred.
Reimplemented from glo::CallBack.
◆ isLocked() [1/2]
virtual int glo::Reference::isLocked |
( |
const LockSpecification & | rLockSpecification | ) |
const |
|
virtual |
Checks if referenced object is locked in the database with the passed parameters.
- Parameters
-
[in] | rLockSpecification | The lock and lock depth mode. |
- Returns
- If > 0, the object is locked in the database. A return value < 0 indicates an error.
- See also
- Check object for locks or access possibilities.
◆ isLocked() [2/2]
virtual int glo::Reference::isLocked |
( |
EnLockMode | eLockMode = LK_DELETEvWRITE, |
|
|
EnDeepMode | eDeepMode = DM_SHALLOW ) const |
|
virtual |
Checks if referenced object is locked in the database with the passed parameters.
- Parameters
-
[in] | eLockMode | The lock mode. |
[in] | eDeepMode | The lock depth mode. |
- Returns
- If > 0, the object is locked in the database. A return value < 0 indicates an error.
- See also
- Check object for locks or access possibilities.
◆ isNULL()
bool glo::Reference::isNULL |
( |
| ) |
const |
Checks if the reference is formally valid.
- Returns
- Returns true if the reference is formally invalid.
◆ isPossible() [1/2]
virtual int glo::Reference::isPossible |
( |
bool | bRead, |
|
|
bool | bWrite, |
|
|
bool | bDelete, |
|
|
EnDeepMode | eDeepMode = DM_SHALLOW ) const |
|
virtual |
Checks the allowed actions for the referenced object in the database.
- Parameters
-
[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. |
- 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::Reference::isPossible |
( |
const LockPossibleSpecification & | rLockPossibleSpec, |
|
|
EnDeepMode | eDeepMode = DM_SHALLOW ) const |
|
virtual |
Checks the allowed actions for the referenced object in the database.
- Parameters
-
[in] | rLockPossibleSpec | The possibility request. |
[in] | eDeepMode | The 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.
◆ lock() [1/2]
virtual int glo::Reference::lock |
( |
const LockSpecification & | rLockSpecification | ) |
const |
|
virtual |
The referenced object is locked in the database for other clients.
- Parameters
-
[in] | rLockSpecification | The lock- and lock depth mode. |
- Returns
- A return value < 0 indicates an error.
- Note
- To unlock the lock, the corresponding method unlock(const LockSpecification&) const with the same parameter value must be used.
- See also
- Locking a persistent object.
◆ lock() [2/2]
virtual int glo::Reference::lock |
( |
EnLockMode | eLockMode = LK_DELETEvWRITE, |
|
|
EnDeepMode | eDeepMode = DM_SHALLOW ) const |
|
virtual |
The referenced object is locked in the database for other clients.
- Parameters
-
[in] | eLockMode | The lock mode. |
[in] | eDeepMode | The lock depth mode. |
- Returns
- A return value < 0 indicates an error.
- Note
- To unlock the lock, the corresponding method unlock(EnLockMode, EnDeepMode) const with the same parameter values must be used.
- See also
- Locking a persistent object.
◆ operator!=()
bool glo::Reference::operator!= |
( |
const Reference & | rT | ) |
const |
Comparison operator.
- Parameters
-
[in] | rT | The object to be compared with this one. |
◆ operator=()
Assignment operator.
- Parameters
-
[in] | rT | The data is transferred from this object. |
◆ operator==()
bool glo::Reference::operator== |
( |
const Reference & | rT | ) |
const |
Comparison operator.
- Parameters
-
[in] | rT | The object to be compared with this one. |
◆ setNULL()
void glo::Reference::setNULL |
( |
| ) |
|
Sets the reference to formally invalid.
◆ setReference() [1/3]
Adopts the object ID of the passed object as reference. Both objects, this and the object to be referenced must be logged on to the same database.
- Parameters
-
[in] | rObj | The object ID of the object to be referenced. |
- Returns
- A return value < 0 indicates an error.
◆ setReference() [2/3]
Adopts the object ID of the passed object as reference. Both objects, this and the object to be referenced must be logged on to the same database.
- Parameters
-
[in] | pObj | The object ID of the object to be referenced. |
- Returns
- A return value < 0 indicates an error.
◆ setReference() [3/3]
virtual void glo::Reference::setReference |
( |
const ObjID & | rObjID | ) |
|
|
virtual |
Adopts the object ID.
- Parameters
-
[in] | rObjID | The object ID of the object to be referenced. |
Reimplemented in glo::TOndemand< T >.
◆ setWatch() [1/2]
virtual int glo::Reference::setWatch |
( |
const WatchSpecification & | rWatchSpec | ) |
const |
|
virtual |
The referenced object is monitored in the database.
- Parameters
-
[in] | rWatchSpec | The 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.
- See also
- Watch and notify.
◆ setWatch() [2/2]
virtual int glo::Reference::setWatch |
( |
TdWatchNotifyMode | ulWatchMode, |
|
|
EnDeepMode | eDeepMode, |
|
|
CallBack * | pCallBack = 0 ) const |
|
virtual |
The referenced object is monitored in the database.
- Parameters
-
[in] | ulWatchMode | The watch mode.
Allowed watch modes:
- ::WNM_READ = read is reported
- ::WNM_READ_TRANSACTION = like ::WNM_READ, but triggered in a transaction
- ::WNM_WRITE = writing is reported
- ::WNM_WRITE_TRANSACTION = like ::WNM_WRITE, but triggered in a transaction
- ::WNM_DELETE = delete is reported
- ::WNM_DELETE_TRANSACTION = like ::WNM_DELETE, but triggered in a transaction
- ::WNM_LOCK = lock is reported
- ::WNM_UNLOCK = release is reported
|
[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. |
- Returns
- A return value < 0 indicates an error.
- Note
- To remove the monitoring, the corresponding method unsetWatchObject(TdWatchNotifyMode, EnDeepMode, CallBack*) const with same parameter values can be used.
- Attention
- Basically pCallBack must not be destroyed before the monitoring has been cancelled!
- See also
- Watch and notify.
◆ unlock() [1/2]
virtual int glo::Reference::unlock |
( |
const LockSpecification & | rLockSpecification | ) |
const |
|
virtual |
The referenced object is released in the database. A lock release must be called with the same parameters as the previous lock call.
- Parameters
-
[in] | rLockSpecification | The 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.
- See also
- Locking a persistent object.
◆ unlock() [2/2]
virtual int glo::Reference::unlock |
( |
EnLockMode | eLockMode = LK_DELETEvWRITE, |
|
|
EnDeepMode | eDeepMode = DM_SHALLOW ) const |
|
virtual |
The referenced object is released in the database. A lock release must be called with the same parameters as the previous lock call.
- Parameters
-
[in] | eLockMode | The original lock mode. |
[in] | eDeepMode | The 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.
◆ unsetWatch() [1/2]
virtual int glo::Reference::unsetWatch |
( |
const WatchSpecification & | rWatchSpec | ) |
const |
|
virtual |
The monitoring of the referenced object in the database is terminated. A monitoring termination must be called with the same parameters as the previous monitoring.
- Parameters
-
[in] | rWatchSpec | The 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.
- See also
- Watch and notify.
◆ unsetWatch() [2/2]
virtual int glo::Reference::unsetWatch |
( |
TdWatchNotifyMode | ulWatchMode, |
|
|
EnDeepMode | eDeepMode, |
|
|
CallBack * | pCallBack ) const |
|
virtual |
The monitoring of the referenced object in the database is terminated. A monitoring termination must be called with the same parameters as the previous monitoring.
- Parameters
-
[in] | ulWatchMode | The original watch mode.
Allowed watch modes:
- ::WNM_READ = read is reported
- ::WNM_READ_TRANSACTION = like ::WNM_READ, but triggered in a transaction
- ::WNM_WRITE = writing is reported
- ::WNM_WRITE_TRANSACTION = like ::WNM_WRITE, but triggered in a transaction
- ::WNM_DELETE = delete is reported
- ::WNM_DELETE_TRANSACTION = like ::WNM_DELETE, but triggered in a transaction
- ::WNM_LOCK = lock is reported
- ::WNM_UNLOCK = release is reported
|
[in] | eDeepMode | The original monitoring 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. |
- Returns
- A return value < 0 indicates an error.
- Note
- Clears the monitoring initiated by the corresponding method setWatchObject(TdWatchNotifyMode, EnDeepMode, CallBack*) const if the parameters have the same values.
- See also
- Watch and notify.
◆ Base
◆ BaseAllSet
◆ ObjectMaker
◆ OdRefRecordAttribute
friend class OdRefRecordAttribute |
|
friend |
◆ OndemandList
friend class OndemandList |
|
friend |
◆ OndemandLot
◆ OndemandSet
◆ TableReaderInterface
friend class TableReaderInterface |
|
friend |
◆ m_RefObjID
ObjID glo::Reference::m_RefObjID |
|
private |
The reference to a persistent object as object ID.
The documentation for this class was generated from the following file: