Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

d_Object Class Reference

#include <d_Object.h>

Inheritance diagram for d_Object:

d_Collection< T > d_Collection< d_Association< K, V > > oSysClass oSysDatabase oSysLog oSysProperty oSysSegment oSysTxLog oSysTxObject List of all members.

Public Types

enum  statuses {
  stStatic, stLoad, stNew, stCreated,
  stReserved, stUpdated, stDeleted, stCheckpointed
}
enum  txmode { TRANSACTIONAL, NO_TRANSACTIONAL }

Public Methods

 d_Object ()
virtual ~d_Object ()
void * operator new (size_t iSize)
void * operator new (size_t iSize, d_Database *iDb, const char *iClassName, int iTxMode=TRANSACTIONAL)
void * operator new (size_t iSize, oStorage *iStorage, const char *iClassName, int iTxMode=TRANSACTIONAL)
void * operator new (size_t iSize, oObjectId &iOid, int iTxMode)
void operator delete (void *iAddress)
void delete_object ()
void mark_modified ()
virtual void d_activate ()
virtual void d_deactivate ()
void store ()
void setStreamProtocol (const char *iProtName)
virtual void toStream (oObjectStream &ioBuffer)
virtual void fromStream (oObjectStream &iBuffer)
oStoragegetStorage () const
oClassgetClass () const
bool is_reserved ()
bool isInCache ()
oObjectId & get_oid ()
void setOid (oObjectId &iOid)
void pin ()
void unpin ()
virtual bool d_beforeNew ()
virtual bool d_onUpdate ()
virtual bool d_beforeUpdate ()
void makeTransactional ()
void makeNoTransactional ()
oContextgetContext () const

Static Public Methods

void free (d_Object *iObject, bool removeAlsoInContext=true)
d_Object * newObject (const size_t iSize)
bool assignContext (d_Object *iObject, int iTxMode, bool iMandatory)

Public Attributes

int status
oObjectStream * origin
oClassmetaClass

Friends

class _ODLL d_Transaction

Detailed Description

The d_Object class is the base class for each persistent object.

Every user objects that want to be persistent had to inherit this class.

It's an abstract class therefore cannot be instantiated.

You had to use the d_Ref template class for referencing persistent objects rather than C++ pointers [see d_Ref].

LOCATION: d_Object.h

USAGE: class <user-class-name> : public d_Object { ... }

Where:

<user-class-name>: is the name of user class

EXAMPLES: class Invoice : public d_Object * Persistent class { d_ULong number; d_Ref<Customer> customer; d_Set< d_Ref<Product> > products; };

SEE ALSO: d_Ref, d_Ref_Any

ODMG: Compliant


Member Enumeration Documentation

enum d_Object::statuses
 

Enumeration values:
stStatic 
stLoad 
stNew 
stCreated 
stReserved 
stUpdated 
stDeleted 
stCheckpointed 

enum d_Object::txmode
 

Enumeration values:
TRANSACTIONAL 
NO_TRANSACTIONAL 


Constructor & Destructor Documentation

d_Object::d_Object  
 

Default constructor.

ODMG : Compliant

d_Object::~d_Object   [inline, virtual]
 

Destructor.

ODMG : Compliant


Member Function Documentation

bool d_Object::assignContext d_Object *    iObject,
int    iTxMode,
bool    iMandatory
[static]
 

void d_Object::d_activate   [inline, virtual]
 

Object activation trigger.

It's the trigger called asynchronously by Orient ODBMS when the object is requested by a context. It can be defined as a special "cache constructor".

It's useful for reset transient members before the use.

If the user class, inherited by d_Object, doesn't define a own d_activate virtual method, by default is called the d_Object::d_activate() that doesn't execute any operation.

SEE ALSO: d_deactivate() ODMG : Compliant

Reimplemented in oSysClass, and oSysDatabase.

bool d_Object::d_beforeNew   [inline, virtual]
 

Trigger called before to store a new persistent object.

It's the trigger called asynchronously by Orient ODBMS on context commit before that new object is stored in database.

Inherited class must return a boolean value: true for success, false for error. If error is returned, a d_Error_TriggerBeforeNew exception is thrown.

It's useful when it needs to validate objects attributes.

If the user class, inherited by d_Object, doesn't define a own d_beforerNew virtual method, by default is called the d_Object::d_beforeNew() that doesn't execute any operation.

ODMG : Extension

bool d_Object::d_beforeUpdate   [inline, virtual]
 

Trigger called before to store an updated persistent object.

It's the trigger called asynchronously by Orient ODBMS on context commit before that updated object is stored in database.

Inherited class must return a boolean value: true for success, false for error. If error is returned, a d_Error_TriggerBeforeUpdate exception is thrown.

If the user class, inherited by d_Object, doesn't define a own d_beforeUpdate virtual method, by default is called the d_Object::d_beforeUpdate() that doesn't execute any operation.

SEE ALSO: d_onUpdate() ODMG : Extension

void d_Object::d_deactivate   [inline, virtual]
 

Object deactivation trigger.

It's the trigger called asynchronously by Orient ODBMS when the object is freed in memory. It can be defined as a special "cache destructor".

It's useful when an object had to free some memory (transient members) before to die.

If the user class, inherited by d_Object, doesn't define a own d_deactivate virtual method, by default is called the d_Object::d_deactivate() that doesn't execute any operation.

SEE ALSO: d_activate() ODMG : Compliant

Reimplemented in d_Collection< T >, oSysClass, oSysDatabase, oSysLog, oSysProperty, oSysSegment, oSysTxLog, oSysTxObject, d_Collection< d_Association< K, V > >, d_Collection< d_Association< d_String, d_String > >, d_Collection< d_Association< d_String, d_Ref< oSysProperty > > >, and d_Collection< d_Association< d_String, d_Ref< oSysClass > > >.

bool d_Object::d_onUpdate   [inline, virtual]
 

Trigger called after when a persistent object is update.

It's the trigger called asynchronously by Orient ODBMS immediately after the mark_modified() method is called on the object.

Inherited class must return a boolean value: true for success, false for error. If error is returned, a d_Error_TriggerOnUpdate exception is thrown.

If the user class, inherited by d_Object, doesn't define a own d_onUpdate virtual method, by default is called the d_Object::d_onUpdate () that doesn't execute any operation.

SEE ALSO: d_beforeUpdate() ODMG : Extension

void d_Object::delete_object  
 

Remove the object permanently in database and memory.

This method is needed by collections deletion

ODMG : Extension

void d_Object::free d_Object *    iObject,
bool    removeAlsoInContext = true
[static]
 

void d_Object::fromStream oObjectStream &    iBuffer [virtual]
 

oObjectId & d_Object::get_oid   [inline]
 

Get the oid associated with the object.

ODMG : Extension

oClass * d_Object::getClass   const [inline]
 

oContext * d_Object::getContext   const [inline]
 

oStorage * d_Object::getStorage   const
 

bool d_Object::is_reserved   [inline]
 

bool d_Object::isInCache  
 

void d_Object::makeNoTransactional  
 

Make the object no transactional.

SEE ALSO: makeTransactional() ODMG : Extension

void d_Object::makeTransactional  
 

Make the object transactional.

SEE ALSO: makeNoTransactional() ODMG : Extension

void d_Object::mark_modified  
 

Mark the object as modified.

When context commits the object will be updated on storage.

Enterprise Edition: This operation requires an exclusive lock to the server.

ODMG : Compliant

d_Object * d_Object::newObject const size_t    iSize [static]
 

void d_Object::operator delete void *    iAddress
 

Remove the object permanently in database and memory.

ODMG : Compliant

void * d_Object::operator new size_t    iSize,
oObjectId &    iOid,
int    iTxMode
 

void * d_Object::operator new size_t    iSize,
oStorage   iStorage,
const char *    iClassName,
int    iTxMode = TRANSACTIONAL
 

void * d_Object::operator new size_t    iSize,
d_Database   iDb,
const char *    iClassName,
int    iTxMode = TRANSACTIONAL
 

Create a persistent object.

Allocates a persistent object of class into database. The database must be opened as read_write [see d_Database], a transaction must be opened and the class must be defined as persistent class.

ODMG : Compliant+ (with optional Extension)

void * d_Object::operator new size_t    iSize
 

Create a transient object.

It allocates memory for transient (not persistent) object. This is the redefinition of C++ new operator.

ODMG : Compliant

void d_Object::pin   [inline]
 

Pin the object.

Use this method to mark the most used objects. The Orient Object Manager doesn't remove this object when the context is committed.

Using this feature avoid loads of the same object from different contexts.

SEE ALSO: unpin() ODMG : Extension

void d_Object::setOid oObjectId &    iOid
 

void d_Object::setStreamProtocol const char *    iProtName
 

void d_Object::store  
 

STORE A NON-TRANSACTIONAL OBJECT

void d_Object::toStream oObjectStream &    ioBuffer [virtual]
 

void d_Object::unpin   [inline]
 

Unpin the object.

Unpin the object marked with d_Object::pin() method. Objects are unpinned by default.

SEE ALSO: pin() ODMG : Extension


Friends And Related Function Documentation

friend class _ODLL d_Transaction [friend]
 


Member Data Documentation

oClass* d_Object::metaClass
 

oObjectStream* d_Object::origin
 

int d_Object::status
 


The documentation for this class was generated from the following files:
Generated on Fri Nov 29 17:12:14 2002 for Orient ODBMS Just Edition v. 2.0e by doxygen1.3-rc1