iopc::CachePtr< T > Class Template Reference
[iopclib]

A cache pointer class. More...

#include <cachePtr.h>

List of all members.

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.
CacheLockcLock
 Cache item manipulator (NULL for transient instances).


Detailed Description

template<typename T>
class iopc::CachePtr< T >

A cache pointer class.

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.


Constructor & Destructor Documentation

template<typename T>
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.

Parameters:
conn A connection with an associated cache in which the object should be locked
persId Identity of the object to be locked


Member Function Documentation

template<typename T>
CountedPtr< T > iopc::CachePtr< T >::operator* (  )  const [inline]

Dereferences cache pointer.

Returns:
Counted pointer to the referenced object (points to NULL for invalid cache pointer).

template<typename T>
CountedPtr< T > iopc::CachePtr< T >::operator-> (  )  const [inline]

Dereferences cache pointer.

Returns:
Counted pointer to the referenced object (points to NULL for invalid cache pointer).

template<typename T>
CountedPtr< T > iopc::CachePtr< T >::getObjectPtr (  )  const [inline]

Dereferences cache pointer.

Returns:
Counted pointer to the referenced object (points to NULL for invalid cache pointer).


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

Generated on Tue Apr 14 16:46:47 2009 for IOPC 2 by  doxygen 1.5.6