iopc::DbPtrBase Class Reference
[iopclib]

Database pointer DbPtr<T> base class. More...

#include <dbPtrBase.h>

Inheritance diagram for iopc::DbPtrBase:

Inheritance graph
[legend]

List of all members.

Public Types

enum  DbPtrState { TRANSIENT = 0, PERSISTENT = 1 }
 State of the databae pointer. More...

Public Member Functions

 operator bool () const
 Inspects database pointer validity.
CacheLockbePersistent (CachedConnection *conn)
 Makes the referenced object persistent.
void dbDelete ()
 Removes referenced object from database and from an associated cache.
void cacheDelete () const
 Hints cache to drop its copy of referenced object.
bool isValid () const
 Inspects database pointer validity.
bool isPersistent () const
 Returns true if the database pointer is in the DbPtrBase::PERSISTENT state.
CachedConnectiongetConnection () const
virtual void * externalizeCopy (unsigned int maxlength=0)
 Creates a copy of this object's value and returns a pointer to it.
virtual void * externalizeEmptyBuffer (unsigned int length=0)
 Creates an empty buffer for obtaining the value.
virtual void updateFromExternalized ()
 Updates this object's value from the externalized buffer.
virtual unsigned int getBufferSize ()
 Returns externalized buffer size in bytes.
virtual const TypegetInnerType () const
 Returns inner type for specified enhanced type.

Protected Member Functions

virtual void replaceWith (const DbPtrBase &src)

Protected Attributes

CachedConnectionconn
PersIdentification persId


Detailed Description

Database pointer DbPtr<T> base class.

Member Enumeration Documentation

State of the databae pointer.

Enumerator:
TRANSIENT  Referenced object is owned by this pointer and has no database representation.
PERSISTENT  Referenced object is owned by a cache and may already have a database representation.


Member Function Documentation

CacheLock & iopc::DbPtrBase::bePersistent ( CachedConnection conn  ) 

Makes the referenced object persistent.

Generates a new identity for the object and transfers the referenced object ownership to an cache associated with the connection

Parameters:
conn Connection on which the object should be cached and persisted

Reimplemented in iopc::DbPtr< T >.

void iopc::DbPtrBase::dbDelete (  ) 

Removes referenced object from database and from an associated cache.

Exceptions:
IopcIncorrectUsageException If the object is not in DbPtrBase::PERSISTENT state.

bool iopc::DbPtrBase::isValid (  )  const [inline]

Inspects database pointer validity.

Database pointer is valid if it has an associated connection and if it refers to a valid object.

void iopc::DbPtrBase::replaceWith ( const DbPtrBase src  )  [protected, virtual]

Replaces content of this instance with the content of the src.

Called from the = operator

CachedConnection & iopc::DbPtrBase::getConnection (  )  const

Connection can be get only for persistent objects

void * iopc::DbPtrBase::externalizeCopy ( unsigned int  maxlength = 0  )  [virtual]

Creates a copy of this object's value and returns a pointer to it.

Type of the copy is the type of the wrapped value (numbers) or char/wchar_t* for EString or EWString.

Parameters:
maxlength Maximum allocated length of externalised copy. For numbers this value is ignored. For strings this value must by greater than 0.

Implements iopc::EnhancedTypeBase.

void * iopc::DbPtrBase::externalizeEmptyBuffer ( unsigned int  length = 0  )  [virtual]

Creates an empty buffer for obtaining the value.

Parameters:
length Allocated length of externalised copy. For numbers this value is ignored. For strings this value must by greater than 0.

Implements iopc::EnhancedTypeBase.

const Type & iopc::DbPtrBase::getInnerType (  )  const [virtual]

Returns inner type for specified enhanced type.

Inner type represents a type that is wrapped by the enhanced data type. It should be one of the basic C++ types or STL strings.

Implements iopc::EnhancedTypeBase.


Member Data Documentation

The connection used for manipulation with persistent copy of referenced object.

ID of referenced instance (used for persistent objects).


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

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