rasdaman client API 10.6.3
The Array Analytics Engine: Datacubes at Your Fingertips
object.hh
Go to the documentation of this file.
1/*
2* This file is part of rasdaman community.
3*
4* Rasdaman community is free software: you can redistribute it and/or modify
5* it under the terms of the GNU General Public License as published by
6* the Free Software Foundation, either version 3 of the License, or
7* (at your option) any later version.
8*
9* Rasdaman community is distributed in the hope that it will be useful,
10* but WITHOUT ANY WARRANTY; without even the implied warranty of
11* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12* GNU General Public License for more details.
13*
14* You should have received a copy of the GNU General Public License
15* along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
16*
17* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
18rasdaman GmbH.
19*
20* For more information please see <http://www.rasdaman.org>
21* or contact Peter Baumann via <baumann@rasdaman.com>.
22*/
33#ifndef _D_OBJECT_
34#define _D_OBJECT_
35
36#include "raslib/oid.hh"
37
38#include <cstdlib>
39
40// forward declarations
41class r_Database;
42class r_Transaction;
43class r_Type;
44
45//@ManMemo: Module: {\bf rasodmg}
46
62{
63public:
66
68 r_Object(unsigned short objType, r_Transaction *transaction = NULL);
76 r_Object(const r_Object &, unsigned short objType = 0, r_Transaction *transaction = NULL);
84 virtual ~r_Object();
85
88
90 void *operator new(size_t size);
91
93 void *operator new(size_t size, r_Database *database, const char *type_name = 0);
94
96 void *operator new(size_t size, const char *type_name);
97
99 void operator delete(void *obj_ptr);
100
102 void set_type_by_name(const char *name);
114 void set_type_structure(const char *name);
115
117 const char *get_type_name() const;
118
120 const char *get_type_structure() const;
121
123 const r_OId &get_oid() const;
124
127
128 void set_type_schema(const r_Type *type);
129
130 //@Man: Methods and types for internal use only:
132
133
161
164 virtual void insert_obj_into_db() = 0;
166 virtual void insert_obj_into_db(const char *) = 0;
168 virtual void update_obj_in_db();
170 virtual void load_obj_from_db();
173
176 void initialize_oid(const r_OId &initOId);
177
180 virtual void r_activate()
181 {
182 ;
183 }
185 virtual void r_deactivate();
186
192
195 void set_object_name(const char *name);
197 const char *get_object_name() const;
198
201 void *operator new(size_t size, r_Database *database, ObjectStatus status, const r_OId &oid);
202
204
205
207
208protected:
211
214
216 char *object_name{0};
217
219 char *type_name{0};
220
223
226
228 unsigned short internal_obj_type{0};
229
233
234private:
236 ObjectStatus object_status;
237
239 ObjectType object_type;
240
242 r_OId oid;
243
245 static ObjectType next_object_type;
246
248 static ObjectStatus next_object_status;
249
251 static char *next_object_type_name;
252
254 static r_OId next_object_oid;
255
257 static ObjectType last_object_type;
258};
259
260#endif
A database object must be instantiated and opened before starting any transaction which uses the data...
Definition database.hh:60
Class r_OId represents an object identifier.
Definition oid.hh:39
Through inheritance of this class, the type definer specifies that the subclass is capable of having ...
Definition object.hh:62
r_Type * type_schema
pointer to type schema (built on request)
Definition object.hh:225
virtual void insert_obj_into_db(const char *)=0
inserts an object into a specific collection in the database
void update_transaction()
resets to the global r_Transaction::actual_transaction if necessary
ObjectStatus
object life status
Definition object.hh:136
@ no_status
Definition object.hh:137
@ modified
Definition object.hh:140
@ transient
Definition object.hh:142
@ read
Definition object.hh:141
@ created
Definition object.hh:139
@ deleted
Definition object.hh:138
void set_object_name(const char *name)
set object name. object name should contain only [a-zA-Z0-9_]
void delete_obj_from_db()
deletes an object from the database
ObjectType
created - The object was created in the current transaction and has to be stored in the database.
Definition object.hh:156
@ persistent_object
Definition object.hh:158
@ no_object
Definition object.hh:157
@ transient_object
Definition object.hh:159
const char * get_object_name() const
get object name
virtual ~r_Object()
objType specifies the type of the object (1=Marray, 2=Collection).
const r_Type * get_type_schema()
get type schema. returns NULL in case of error
char * type_structure
store type structure as string if it has one
Definition object.hh:222
char * object_name
stores object name if it has one
Definition object.hh:216
unsigned short internal_obj_type
internal object type (1 marray, 2 collection)
Definition object.hh:228
char * type_name
stores object type name if it has one
Definition object.hh:219
void set_type_schema(const r_Type *type)
const char * get_type_structure() const
get object type structure
r_Object(const r_Object &, unsigned short objType=0, r_Transaction *transaction=NULL)
objType specifies the type of the object (1=Marray, 2=Collection).
void mark_modified()
mark the object as modified
virtual void update_obj_in_db()
updates an object in database
ObjectStatus get_status() const
gets the status of the object
const char * get_type_name() const
get object type name
void set_type_by_name(const char *name)
set object type by name
virtual void insert_obj_into_db()=0
inserts an object into the database
bool test_type(ObjectType type)
test object type returns 1 if it matches
virtual void r_activate()
it is called when an object comes into transient memory
Definition object.hh:180
virtual void r_deactivate()
it is called when an object leaves transient memory
const r_OId & get_oid() const
get oid
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 persi...
r_Transaction * transaction
pointer to the transaction this object belongs to.
Definition object.hh:232
void initialize_oid(const r_OId &initOId)
initialize oid of the object
virtual void load_obj_from_db()
load an object from the database
r_Object(unsigned short objType, r_Transaction *transaction=NULL)
constructor getting objType
r_Transaction * get_transaction() const
bool test_status(ObjectStatus status)
test object status returns 1 if it matches
r_Object(r_Transaction *transaction=NULL)
default constructor
Transactions can be started, committed, aborted, and checkpointed.
Definition transaction.hh:50
This class the superclass for all types in the ODMG conformant representation of the RasDaMan type sy...
Definition type.hh:51