rasdaman client API 10.6.3
The Array Analytics Engine: Datacubes at Your Fingertips
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
r_Object Class Referenceabstract

Through inheritance of this class, the type definer specifies that the subclass is capable of having persistent as well as transient instances. More...

#include <object.hh>

Inheritance diagram for r_Object:
r_Collection< r_GMarray * > r_Collection< r_Ref< r_Object > > r_Collection< GenRefElement * > r_Collection< T > r_GMarray r_Set< r_GMarray * > r_Set< r_Ref< r_Object > > r_Set< GenRefElement * > r_Set< T > r_Marray< T >

Public Types

enum  ObjectStatus {
  no_status , deleted , created , modified ,
  read , transient
}
 object life status More...
 
enum  ObjectType { no_object , persistent_object , transient_object }
 created - The object was created in the current transaction and has to be stored in the database. More...
 

Public Member Functions

 r_Object (r_Transaction *transaction=NULL)
 default constructor
 
 r_Object (unsigned short objType, r_Transaction *transaction=NULL)
 constructor getting objType
 
 r_Object (const r_Object &, unsigned short objType=0, r_Transaction *transaction=NULL)
 objType specifies the type of the object (1=Marray, 2=Collection).
 
virtual ~r_Object ()
 objType specifies the type of the object (1=Marray, 2=Collection).
 
void mark_modified ()
 mark the object as modified
 
void * operator new (size_t size)
 new operator for transient objects
 
void * operator new (size_t size, r_Database *database, const char *type_name=0)
 new operator for persistent objects
 
void * operator new (size_t size, const char *type_name)
 new operator for transient objects carrying type information
 
void operator delete (void *obj_ptr)
 delete operator
 
void set_type_by_name (const char *name)
 set object type by name
 
void set_type_structure (const char *name)
 With this method a type name has to be given by the user for each object which he wants to make persistent.
 
const char * get_type_name () const
 get object type name
 
const char * get_type_structure () const
 get object type structure
 
const r_OIdget_oid () const
 get oid
 
const r_Typeget_type_schema ()
 get type schema. returns NULL in case of error
 
void set_type_schema (const r_Type *type)
 
virtual void insert_obj_into_db ()=0
 inserts an object into the database
 
virtual void insert_obj_into_db (const char *)=0
 inserts an object into a specific collection in the database
 
virtual void update_obj_in_db ()
 updates an object in database
 
virtual void load_obj_from_db ()
 load an object from the database
 
void delete_obj_from_db ()
 deletes an object from the database
 
void initialize_oid (const r_OId &initOId)
 initialize oid of the object
 
virtual void r_activate ()
 it is called when an object comes into transient memory
 
virtual void r_deactivate ()
 it is called when an object leaves transient memory
 
bool test_status (ObjectStatus status)
 test object status returns 1 if it matches
 
ObjectStatus get_status () const
 gets the status of the object
 
void set_object_name (const char *name)
 set object name. object name should contain only [a-zA-Z0-9_]
 
const char * get_object_name () const
 get object name
 
void * operator new (size_t size, r_Database *database, ObjectStatus status, const r_OId &oid)
 new operator for activating an object (status = read)
 
r_Transactionget_transaction () const
 

Protected Member Functions

void update_transaction ()
 resets to the global r_Transaction::actual_transaction if necessary
 
bool test_type (ObjectType type)
 test object type returns 1 if it matches
 

Protected Attributes

char * object_name {0}
 stores object name if it has one
 
char * type_name {0}
 stores object type name if it has one
 
char * type_structure {0}
 store type structure as string if it has one
 
r_Typetype_schema {0}
 pointer to type schema (built on request)
 
unsigned short internal_obj_type {0}
 internal object type (1 marray, 2 collection)
 
r_Transactiontransaction {NULL}
 pointer to the transaction this object belongs to.
 

Detailed Description

Through inheritance of this class, the type definer specifies that the subclass is capable of having persistent as well as transient instances.

Attention: Right now, just the classes r_Set and r_Marray inherit from r_Object which, therefore, are the only persistent capable classes. In fact, just objects of type r_Set<r_Ref<r_Marray<...>>> can be made persitent right now.

Member Enumeration Documentation

◆ ObjectStatus

object life status

Enumerator
no_status 
deleted 
created 
modified 
read 
transient 

◆ ObjectType

created - The object was created in the current transaction and has to be stored in the database.

deleted - The object was deleted. It is still in main memory and in the database. It is going to be removed at the end of the transaction. modified - Object was modified and has to be updated in the database. read - The object was read from the database without modifying it afterwards. transient - The object belongs to a declarative query result. In most cases, it has no persistent counterpart in the db. It is NOT considered in the update phase. object types

Enumerator
no_object 
persistent_object 
transient_object 

Constructor & Destructor Documentation

◆ r_Object() [1/3]

r_Object::r_Object ( r_Transaction transaction = NULL)

default constructor

◆ r_Object() [2/3]

r_Object::r_Object ( unsigned short  objType,
r_Transaction transaction = NULL 
)

constructor getting objType

◆ r_Object() [3/3]

r_Object::r_Object ( const r_Object ,
unsigned short  objType = 0,
r_Transaction transaction = NULL 
)

objType specifies the type of the object (1=Marray, 2=Collection).

transaction the transaction object under which this object is registered. Internal casting to void is necesarry due to circural referencing. This is needed for oid allocation and propably dropped in future. copy constructor

◆ ~r_Object()

virtual r_Object::~r_Object ( )
virtual

objType specifies the type of the object (1=Marray, 2=Collection).

transaction the transaction object under which this object is registered. Internal casting to void is necesarry due to circural referencing. This is needed for oid allocation and propably dropped in future. virtual destructor

Member Function Documentation

◆ delete_obj_from_db()

void r_Object::delete_obj_from_db ( )

deletes an object from the database

◆ get_object_name()

const char * r_Object::get_object_name ( ) const

get object name

◆ get_oid()

const r_OId & r_Object::get_oid ( ) const

get oid

◆ get_status()

ObjectStatus r_Object::get_status ( ) const

gets the status of the object

◆ get_transaction()

r_Transaction * r_Object::get_transaction ( ) const

◆ get_type_name()

const char * r_Object::get_type_name ( ) const

get object type name

◆ get_type_schema()

const r_Type * r_Object::get_type_schema ( )

get type schema. returns NULL in case of error

◆ get_type_structure()

const char * r_Object::get_type_structure ( ) const

get object type structure

◆ initialize_oid()

void r_Object::initialize_oid ( const r_OId initOId)

initialize oid of the object

◆ insert_obj_into_db() [1/2]

virtual void r_Object::insert_obj_into_db ( )
pure virtual

◆ insert_obj_into_db() [2/2]

virtual void r_Object::insert_obj_into_db ( const char *  )
pure virtual

inserts an object into a specific collection in the database

Implemented in r_Collection< T >, r_Collection< GenRefElement * >, r_Collection< r_GMarray * >, r_Collection< r_Ref< r_Object > >, and r_GMarray.

◆ load_obj_from_db()

virtual void r_Object::load_obj_from_db ( )
virtual

load an object from the database

◆ mark_modified()

void r_Object::mark_modified ( )

mark the object as modified

◆ operator delete()

void r_Object::operator delete ( void *  obj_ptr)

delete operator

◆ operator new() [1/4]

void * r_Object::operator new ( size_t  size)

new operator for transient objects

◆ operator new() [2/4]

void * r_Object::operator new ( size_t  size,
const char *  type_name 
)

new operator for transient objects carrying type information

◆ operator new() [3/4]

void * r_Object::operator new ( size_t  size,
r_Database database,
const char *  type_name = 0 
)

new operator for persistent objects

◆ operator new() [4/4]

void * r_Object::operator new ( size_t  size,
r_Database database,
ObjectStatus  status,
const r_OId oid 
)

new operator for activating an object (status = read)

◆ r_activate()

virtual void r_Object::r_activate ( )
inlinevirtual

it is called when an object comes into transient memory

◆ r_deactivate()

virtual void r_Object::r_deactivate ( )
virtual

it is called when an object leaves transient memory

Reimplemented in r_Collection< T >, r_Collection< GenRefElement * >, r_Collection< r_GMarray * >, r_Collection< r_Ref< r_Object > >, and r_GMarray.

◆ set_object_name()

void r_Object::set_object_name ( const char *  name)

set object name. object name should contain only [a-zA-Z0-9_]

◆ set_type_by_name()

void r_Object::set_type_by_name ( const char *  name)

set object type by name

◆ set_type_schema()

void r_Object::set_type_schema ( const r_Type type)

◆ set_type_structure()

void r_Object::set_type_structure ( const char *  name)

With this method a type name has to be given by the user for each object which he wants to make persistent.

If an object without a valid type name is made persistent, an error occurs while committing the transaction.

NOTE: This method is updated. Use void* operator new( size_t size, r_Database database, const char type_name ) instead. set object type by name

◆ test_status()

bool r_Object::test_status ( ObjectStatus  status)

test object status returns 1 if it matches

◆ test_type()

bool r_Object::test_type ( ObjectType  type)
protected

test object type returns 1 if it matches

◆ update_obj_in_db()

virtual void r_Object::update_obj_in_db ( )
virtual

◆ update_transaction()

void r_Object::update_transaction ( )
protected

resets to the global r_Transaction::actual_transaction if necessary

Member Data Documentation

◆ internal_obj_type

unsigned short r_Object::internal_obj_type {0}
protected

internal object type (1 marray, 2 collection)

◆ object_name

char* r_Object::object_name {0}
protected

stores object name if it has one

◆ transaction

r_Transaction* r_Object::transaction {NULL}
protected

pointer to the transaction this object belongs to.

Void* to avoid compilation errors caused by cyclic dependencies in the raslib between transaction, database and r_Object

◆ type_name

char* r_Object::type_name {0}
protected

stores object type name if it has one

◆ type_schema

r_Type* r_Object::type_schema {0}
protected

pointer to type schema (built on request)

◆ type_structure

char* r_Object::type_structure {0}
protected

store type structure as string if it has one


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