#include <dbPtrBase.h>
Public Types | |
enum | DbPtrState { TRANSIENT = 0, PERSISTENT = 1 } |
State of the databae pointer. More... | |
Public Member Functions | |
operator bool () const | |
Inspects database pointer validity. | |
CacheLock & | bePersistent (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. | |
CachedConnection & | getConnection () 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 Type & | getInnerType () const |
Returns inner type for specified enhanced type. | |
Protected Member Functions | |
virtual void | replaceWith (const DbPtrBase &src) |
Protected Attributes | |
CachedConnection * | conn |
PersIdentification | persId |
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
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.
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.
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.
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.
CachedConnection* iopc::DbPtrBase::conn [protected] |
The connection used for manipulation with persistent copy of referenced object.
PersIdentification iopc::DbPtrBase::persId [protected] |
ID of referenced instance (used for persistent objects).