#include <cachePtr.h>
Public Member Functions | |
CachePtr () | |
Creates an invalid cache pointer. | |
CachePtr (CachedConnection &conn, const PersIdentification &persId) | |
Crates a cache pointer to a persistent object. | |
CachePtr (CountedPtr< T > objectPtr) | |
Creates a cache pointer to a transient object owned by the DbPtr<T>. | |
CachePtr (CacheLock &cLock) | |
Crates a cache pointer from an already locked object. | |
CachePtr (const CachePtr< T > &cptr) | |
Copy constructor. | |
CachePtr< T > & | operator= (const CachePtr< T > &src) |
Copy operator. | |
void | release () |
Releases the lock and invalidates the cache pointer. | |
bool | isValid () const |
Determines whether the pointer is valid or not. (Points to a cache-locked instance). | |
operator bool () const | |
Determines whether the pointer is valid or not. (Points to a cache-locked instance). | |
CountedPtr< T > | operator* () const |
Dereferences cache pointer. | |
CountedPtr< T > | operator-> () const |
Dereferences cache pointer. | |
CountedPtr< T > | getObjectPtr () const |
Dereferences cache pointer. | |
Protected Attributes | |
CountedPtr< T > | objectPtr |
Counted pointer, for both persistent and transient instances. | |
CacheLock * | cLock |
Cache item manipulator (NULL for transient instances). |
The existence of the cache pointer guarantees that the object is loaded into the memory and that the memory address of the object will not change until the instance of the cache pointer is destroyed (unlocked). Such process locks the objects in the cache so they can't be removed unless they are unlocked.
iopc::CachePtr< T >::CachePtr | ( | CachedConnection & | conn, | |
const PersIdentification & | persId | |||
) | [inline] |
Crates a cache pointer to a persistent object.
Requested object is looked up in the cache associated with the conn connection and if not found the object is loaded from the underlying database.
conn | A connection with an associated cache in which the object should be locked | |
persId | Identity of the object to be locked |
CountedPtr< T > iopc::CachePtr< T >::operator* | ( | ) | const [inline] |
Dereferences cache pointer.
CountedPtr< T > iopc::CachePtr< T >::operator-> | ( | ) | const [inline] |
Dereferences cache pointer.
CountedPtr< T > iopc::CachePtr< T >::getObjectPtr | ( | ) | const [inline] |
Dereferences cache pointer.