rasdaman client API 10.6.3
The Array Analytics Engine: Datacubes at Your Fingertips
ref.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_REF_
34#define _D_REF_
35
36#include "raslib/oid.hh"
37
38class r_Object;
39class r_Point;
40class r_Sinterval;
41class r_Minterval;
42class r_Scalar;
43class r_Primitive;
44class r_Structure;
45class r_Transaction;
46
47//@ManMemo: Module: <b>rasodmg</b>
48
65{
66public:
69
72
74 r_Ref_Any(const r_OId &initOId, r_Transaction *ta = NULL);
81
83 r_Ref_Any(void *);
84
87
90
93
95 void destroy();
96
99
100 //@Man: Cast operators:
102
103
105 operator const void *() const;
107 operator void *();
109 operator r_Point *();
111 operator r_Sinterval *();
113 operator r_Minterval *();
115 operator r_OId *();
117 operator r_Scalar *();
119 operator r_Structure *();
121 operator r_Primitive *();
122
124
125
127 int operator!() const;
128
130 int is_null() const;
135 //@Man: Comparison operators:
137
138
140 int operator==(const r_Ref_Any &) const;
142 int operator!=(const r_Ref_Any &) const;
144 int operator==(const r_Object *) const;
146 int operator!=(const r_Object *) const;
147
149
150
152 const r_OId &get_oid() const;
153
154 //@Man: Methods for internal use only
156
160 unsigned int is_oid_valid() const;
162 void *get_memory_ptr() const;
166
167
168protected:
170
171private:
173 void *memptr{NULL};
174
176 r_OId oid;
177};
178
179//@ManMemo: Module: <b>rasodmg</b>
180
196template <class T>
197class r_Ref
198{
199public:
202
204 r_Ref(const r_Ref_Any &);
205
207 r_Ref(const r_OId &initOId, r_Transaction *ta = NULL);
213 r_Ref(const r_Ref<T> &);
214
217
219 operator r_Ref_Any() const;
220
221 // cast to const r_Ref_Any
222 // operator const r_Ref_Any() const;
223
226
229
230 // assignment operator for assigning a r_Ref pointer
231 // r_Ref<T>& operator=( r_Ref<T>& );
232
235
237 const T &operator*() const;
238
246 const T *operator->() const;
247
255 const T *ptr() const;
256
258 T *ptr();
265 int operator!() const;
266
268 int is_null() const;
273 //@Man: Comparison operators:
275
276
278 int operator==(const r_Ref<T> &refR) const;
280 int operator!=(const r_Ref<T> &refR) const;
282 int operator==(const T *) const;
284 int operator!=(const T *) const;
285
287
288
290 void destroy();
291
294
296 const r_OId &get_oid() const;
297
298 //@Man: Methods for internal use only
300
302 r_Ref(T *, r_Transaction *ta = NULL);
303
305 r_Ref(const r_OId &, T *, r_Transaction *ta = NULL);
306
308 T *get_memory_ptr() const;
309
311 unsigned int is_oid_valid() const;
312
314
315
316protected:
318
319private:
321 void load_object() const;
322
324 mutable T *memptr;
325
327 r_OId oid;
328};
329
330class r_GMarray;
331extern template class r_Ref<r_GMarray>;
332class r_Object;
333extern template class r_Ref<r_Object>;
334
335template <typename T>
336class r_Set;
337extern template class r_Ref<r_Set<r_Ref<r_GMarray>>>;
338
339class r_Point;
340extern template class r_Ref<r_Point>;
341class r_Sinterval;
342extern template class r_Ref<r_Sinterval>;
343class r_Minterval;
344extern template class r_Ref<r_Minterval>;
345class r_OId;
346extern template class r_Ref<r_OId>;
347class r_Scalar;
348extern template class r_Ref<r_Scalar>;
349
350#endif
The class represents a generic MDD in the sense that it is independent of the cell base type.
Definition gmarray.hh:66
The spatial domain of an MDD is represented by an object of class r_Minterval.
Definition minterval.hh:226
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
Class r_Point represents an n-dimensional point vector.
Definition point.hh:43
Class r_Primitive represents a primitive (atomic) type value.
Definition primitive.hh:43
The class r_Ref_Any is defined to support a reference to any type.
Definition ref.hh:65
int operator!=(const r_Object *) const
compares the memory pointer (does not load the object)
r_Ref_Any(const r_Ref_Any &)
copy constructor
int is_null() const
method for reference validity test
unsigned int is_oid_valid() const
r_Ref_Any(void *)
constructor getting a general pointer
const r_OId & get_oid() const
get oid
void * get_memory_ptr() const
get memory pointer (without loading the object)
r_Ref_Any & operator=(const r_Ref_Any &)
assignment operator for assigning a r_Ref_Any pointer
int operator==(const r_Ref_Any &) const
The method delivers true iff the oid and/or the memory pointer are valid.
int operator!=(const r_Ref_Any &) const
r_Ref_Any()
default constructor
r_Ref_Any & operator=(r_Object *)
assignment operator for assigning a pointer to a persistent capable object
int operator==(const r_Object *) const
compares the memory pointer (does not load the object)
r_Ref_Any(const r_OId &initOId, r_Transaction *ta=NULL)
constructor for creating a reference with an oid
r_Transaction * get_transaction() const
get transaction
void delete_object()
deletes referenced object from main memory and database
r_Ref_Any(const r_OId &, r_Object *, r_Transaction *ta=NULL)
constructor getting oid and memory pointer
r_Ref_Any(r_Object *)
Dereferencing the self object results in loading the object with initOId.
~r_Ref_Any()
destructor deletes referenced object from main memory and database
void destroy()
delete from main memory
int operator!() const
operator for validity test
r_Transaction * ta
Definition ref.hh:169
References of type r_Ref in many respects behave like C++ pointers but provide an additional mechanis...
Definition ref.hh:198
~r_Ref()
destructor deletes referenced object from main memory and database
r_Ref()
default constructor
void destroy()
delete from main memory
T * get_memory_ptr() const
get memory pointer (without loading the object)
int is_null() const
method for reference validity test
int operator!=(const r_Ref< T > &refR) const
T * operator->()
operator for dereferencing the reference (error kinds: r_Error_RefNull, r_Error_RefInvalid)
T & operator*()
dereference operator (error kinds: r_Error_RefNull, r_Error_RefInvalid)
r_Ref< T > & operator=(const r_Ref_Any &)
assignment operator for assigning a r_Ref_Any
int operator!=(const T *) const
compares the memory pointer (does not load the object)
void delete_object()
deletes referenced object from main memory and database
r_Ref(const r_Ref_Any &)
constructor for r_Ref_Any objects
T * ptr()
method for dereferencing the reference (error kinds: r_Error_RefNull, r_Error_RefInvalid)
r_Transaction * ta
Definition ref.hh:317
const r_OId & get_oid() const
get oid
const T * ptr() const
If the memory pointer is zero and the oid is valid, the object is loaded from the server and the new ...
r_Ref< T > & operator=(T *)
assignment operator for assigning a C pointer
r_Ref(const r_OId &, T *, r_Transaction *ta=NULL)
constructor getting oid and memory pointer
int operator!() const
If the memory pointer is zero and the oid is valid, the object is loaded from the server and the new ...
r_Ref(const r_Ref< T > &)
Dereferencing the self object results in loading the object with initOId.
r_Ref(T *, r_Transaction *ta=NULL)
constructor getting memory pointer
const T & operator*() const
dereference operator (error kinds: r_Error_RefNull, r_Error_RefInvalid)
unsigned int is_oid_valid() const
const T * operator->() const
If the memory pointer is zero and the oid is valid, the object is loaded from the server and a refere...
r_Ref< T > & operator=(const r_Ref< T > &)
assignment operator for assigning a r_Ref pointer
r_Ref(const r_OId &initOId, r_Transaction *ta=NULL)
constructor for creating a reference with an oid
int operator==(const r_Ref< T > &refR) const
The method delivers true iff the oid and/or the memory pointer are valid.
int operator==(const T *) const
compares the memory pointer (does not load the object)
Class r_Scalar represents a scalar type value which is either r_Primitive or r_Structure.
Definition scalar.hh:43
The class implements a set container.
Definition set.hh:42
The class represents an interval with lower and upper bound.
Definition sinterval.hh:214
Class r_Structure represents a structured value.
Definition structure.hh:42
Transactions can be started, committed, aborted, and checkpointed.
Definition transaction.hh:50