#include <cRefBase.h>
Inheritance diagram for RefBase:
Public Member Functions | |
RefBase () | |
RefBase (const RefBase &Dbp) | |
RefBase (const Object *const DbObj) | |
RefBase (class Connection *aConnection, class ProtoBase *aPrototype, char *aSelectKeyValues, unsigned short aStrategies) | |
RefBase (class Connection *aConnection, class ProtoBase *aPrototype, const OidType oid, unsigned short aStrategies) | |
RefBase (class Connection *aConnection, ObjectIdentification *anIdentification) | |
RefBase (class Connection *aConnection, const long anOid, class ProtoBase *aPrototype) | |
virtual | ~RefBase () |
virtual bool | Init (class Connection *aConnection, class ProtoBase *aPrototype, char *aSelectKeyValues) |
virtual Object & | ReferencedObject () const |
Object * | IsInMemory () const |
ObjectIdentification | ObjectID () const |
virtual class ProtoBase * | Prototype () const |
virtual bool | IsDirty () const |
virtual bool | MarkAsDirty () |
virtual bool | Refresh () |
virtual bool | Update () |
virtual bool | Free () |
virtual bool | Delete () |
Object * | MemoryLock () |
bool | MemoryUnlock () |
virtual unsigned int | MemoryLocked () const |
virtual bool | RemoveAllMemoryLocks () |
virtual class RefBase | BePersistent (class Connection *DbCon) |
bool | operator== (const class RefBase &DbPtr) const |
bool | operator!= (const class RefBase &DbPtr) const |
ResultBase * | ExecuteQuery (const char *className, const QueRefProto &query, class Connection *connection, ResultBase *result) |
OidType | getOID () const |
Protected Member Functions | |
virtual class Object * | _Object () |
virtual class RefBase & | _Virtualise () |
virtual char * | _KeyValues () const |
virtual bool | _MarkAsClean () |
virtual bool | _Free () |
void | setOID (const OidType oid, const char *className, class Connection *connection) |
Protected Attributes | |
ObjectIdentification | _ObjectIdentification |
RefBase descendants, instances of template Ref<T> are used as references to persistent objects. The descendant can points to one object in one specific database, thus RefBase contains both _Connection and _ObjectIdentification.
When accessing the object, the reference is automatically dereferenced and the object is retrieved (if necessary) from database and placed into the memory. To minimise the amount of database accesses all persistent objects contained currently in memory are registered in the library persistent objects cache - ObjectCache.
Objects of type Ref<T> can be used as persistent attributes in IOPC-style persistent objects (IopcPersistentObject descendants), see getOID() and setOID().
This class was partially documented in POLiTe - I (Josef Troch) have put the comments from source files to doxygen, extended them and commented what wasn't commented. I have also commented the new methods I had added.
|
Empty constructor - constructs DBNULL pointer.
|
|
Copy constructor.
|
|
Constructor taking pointer to the object.
|
|
Constructor taking object's connection, prototype, encoded key values ( |
|
New constructor added by Josef Troch. Takes object's connection, prototype, OID and locking/waiting strategies. |
|
Constructor that takes object's connection and identification.
|
|
Old constructor (POLiTe-style) that takes object's connection, OID and prototype. This constructor encodes the OID to get string, doesn't uses OID directly (see ObjectIdentification). |
|
Destructor.
|
|
Reinitializes already existing reference - takes connection, prototype and encoded key values (
|
|
Returns pointer to object stored in the _ObjectIdentification.
|
|
Typecasts RefBase to class A to RefBase to correct A's subclass B. Does nothing in other derived classes.
|
|
Returns pointed object's encoded key values (NULL for IopcPersistentObject descendants).
Implements ObjRef. |
|
Returns C++ reference to the pointed object. The object is read from the database, if the object is not present in memory yet. |
|
Test whether referenced object is in memory. If so, returns pointer to it, if not, returns NULL.
Implements ObjRef. |
|
Returns object identification.
Implements ObjRef. |
|
Returns a reference to the prototype of the referenced class. If the reference points to IopcPersistentObject descendant and ObjectIdentification::_prototype is NULL, calls IopcClassObjectImpl::getClassIDForOid() and IopcClassObjectContainer::getClassObjectFromClassID() to load class's Class ID from database and convert it to IopcClassObjectImpl / IopcProtoBaseAdaptor. Implements ObjRef. |
|
Returns true, if the object is marked as dirty (i.e. the object was changed in the memory). Calls the same named method on referenced object.
Implements ObjRef. |
|
Marks the persistent object as dirty. Calls the same named method on referenced object.
Implements ObjRef. |
|
Marks the persistent object as clean (not changed). Calls the same named method on referenced object.
Implements ObjRef. |
|
Refreshes the object in memory - loads it from database to memory again.
Implements ObjRef. |
|
Writes the referenced object from the memory to the database. Does nothing if the object is not persistent or not dirty. Implements ObjRef. |
|
Removes the referenced object from memory only.
Implements ObjRef. |
|
Removes the referenced object from memory only. The same as Free().
Implements ObjRef. |
|
Removes the referenced object both from the memory and from the database.
Implements ObjRef. |
|
Locks a persistent object. Multiple locks can be placed on the object. The object can be removed from memory only when all the locks are released. Implements ObjRef. |
|
Unlocks a persistent object in memory. See MemoryLock().
Implements ObjRef. |
|
Returns the number of memory locks on referenced object or zero if it is not locked.
Implements ObjRef. |
|
Removes all memory locks on the referenced object.
Reimplemented from ObjRef. |
|
Makes the object persistent (if it was transient). This function didn't do anything in POLiTe. I (Josef Troch) think it is a bug, but I retained this behaviour for POLiTe-style persistent objects. For IopcPersistentObject ancestors it calls BePersistent() on the referenced object (if the object was transient).
Implements ObjRef. |
|
Tests whether the two references reference the same object.
Reimplemented in ResultBase. |
|
Tests whether the two referenced objects are different.
Reimplemented in ResultBase. |
|
Executes given query. Added by Josef Troch to suppress include dependency of Ref<T> on ProtoBase / ClassRegister.
Executes query on Called from Ref<T>::Ref(class Connection *, const char *).
|
|
If the referenced object is IopcPersistentObject descendant, returns OID of the referenced object. This function was added by Josef Troch to support persistence of attributes of type Ref<T>. It is called from persistent object's iopcExportAttributes() function.
|
|
Sets _ObjectIdentification and _Connection to point to object with OID This function was added by Josef Troch to support persistence of attributes of type Ref<T>. It is called from persistent object's iopcImportAttributes() function.
|
|
Object identification, see RefBase class description.
|