rasdaman client API  10.6.3
The Array Analytics Engine: Datacubes at Your Fingertips
type.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 Lesser 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 Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
16  *
17  * Copyright 2003 - 2010 Peter Baumann / rasdaman GmbH.
18  *
19  * For more information please see <http://www.rasdaman.org>
20  * or contact Peter Baumann via <baumann@rasdaman.com>.
21 */
22 
23 #ifndef D_TYPE_HH
24 #define D_TYPE_HH
25 
26 #include "raslib/metaobject.hh"
27 #include "raslib/mddtypes.hh"
28 
29 class r_Primitive_Type;
30 class r_Structure_Type;
31 class r_Marray_Type;
32 class r_Sinterval_Type;
33 class r_Minterval_Type;
34 class r_Point_Type;
35 class r_Oid_Type;
36 class r_String_Type;
37 class r_Base_Type;
38 class r_Collection_Type;
39 
40 //@ManMemo: Module: {\bf raslib}
50 class r_Type : public r_Meta_Object
51 {
52 public:
55  enum r_Type_Id
56  {
79  };
81  r_Type() = default;
83  explicit r_Type(const char *newTypeName);
85  virtual ~r_Type() = default;
86 
88  virtual r_Type *clone() const = 0;
89 
91  virtual r_Type::r_Type_Id type_id() const = 0;
92 
94  virtual bool isStructType() const;
95 
97  virtual bool isBaseType() const;
98 
100  virtual bool isComplexType() const;
101 
103  virtual bool isMarrayType() const;
104 
106  virtual bool isPrimitiveType() const;
107 
109  virtual bool isSintervalType() const;
110 
112  virtual bool isMintervalType() const;
113 
115  virtual bool isCollectionType() const;
116 
118  virtual bool isPointType() const;
119 
121  virtual bool isOidType() const;
122 
124  virtual bool isStringType() const;
125 
127  static r_Type *get_any_type(const char *type_string);
128  static r_Type *get_any_type(const std::string &type_string);
129 
131  virtual void convertToLittleEndian(char *cells, r_Area noCells) const = 0;
132 
134  virtual void convertToBigEndian(char *cells, r_Area noCells) const = 0;
135 
136 private:
137  //@Man: Methodes and structures for dl parser:
139 
142  enum DLTOKEN
143  {
144  DLMARRAY,
145  DLSET,
146  DLSTRUCT,
147  DLCOMMA,
148  DLLEP,
149  DLREP,
150  DLLAP,
151  DLRAP,
152  DLLCP,
153  DLRCP,
154  DLIDENTIFIER,
155  DLCHAR,
156  DLOCTET,
157  DLSHORT,
158  DLUSHORT,
159  DLLONG,
160  DLULONG,
161  DLFLOAT,
162  DLDOUBLE,
163  DLBOOL,
164  DLCOMPLEXTYPE1,
165  DLCOMPLEXTYPE2,
166  DLCINT16,
167  DLCINT32,
168  DLINTERVAL,
169  DLMINTERVAL,
170  DLPOINT,
171  DLOID,
172  DLSTRING,
173  DLUNKNOWN
174  };
176  static DLTOKEN getNextToken(char *&pos, char *&identifier);
178  static r_Collection_Type *getCollectionType(char *&pos);
180  static r_Type *getType(char *&pos);
182  static r_Marray_Type *getMarrayType(char *&pos);
184  static r_Base_Type *getBaseType(char *&pos, int offset = 0);
186  static r_Primitive_Type *getPrimitiveType(char *&pos);
188  static r_Structure_Type *getStructureType(char *&pos, int offset = 0);
190  static r_Sinterval_Type *getSintervalType(char *&pos);
192  static r_Minterval_Type *getMintervalType(char *&pos);
194  static r_Point_Type *getPointType(char *&pos);
196  static r_Oid_Type *getOidType(char *&pos);
198  static r_String_Type *getStringType(char *&pos);
199 
201 
202 };
203 
204 extern std::ostream &operator<<(std::ostream &s, r_Type::r_Type_Id t);
205 
206 //ULONG, USHORT, CHAR, BOOL, LONG, SHORT, OCTET,
207 //DOUBLE, FLOAT, COMPLEXTYPE1, COMPLEXTYPE2, CINT16, CINT32,
208 //STRUCTURETYPE, MARRAYTYPE, COLLECTIONTYPE,
209 //SINTERVALTYPE, MINTERVALTYPE, POINTTYPE, OIDTYPE,
210 //UNKNOWNTYPE
211 //};
212 
213 //
214 // Generate a switch for all base r_Type_Id, and put the given code
215 // block in each case.
216 //
217 #define CODE(...) __VA_ARGS__
218 #define MAKE_SWITCH_TYPEID(cellType, T, code, codeDefault) \
219  switch (cellType) \
220  { \
221  case r_Type::r_Type_Id::ULONG: \
222  { \
223  using T = r_ULong; \
224  code break; \
225  } \
226  case r_Type::r_Type_Id::USHORT: \
227  { \
228  using T = r_UShort; \
229  code break; \
230  } \
231  case r_Type::r_Type_Id::CHAR: \
232  { \
233  using T = r_Char; \
234  code break; \
235  } \
236  case r_Type::r_Type_Id::BOOL: \
237  { \
238  using T = r_Boolean; \
239  code break; \
240  } \
241  case r_Type::r_Type_Id::LONG: \
242  { \
243  using T = r_Long; \
244  code break; \
245  } \
246  case r_Type::r_Type_Id::SHORT: \
247  { \
248  using T = r_Short; \
249  code break; \
250  } \
251  case r_Type::r_Type_Id::OCTET: \
252  { \
253  using T = r_Octet; \
254  code break; \
255  } \
256  case r_Type::r_Type_Id::DOUBLE: \
257  { \
258  using T = r_Double; \
259  code break; \
260  } \
261  case r_Type::r_Type_Id::FLOAT: \
262  { \
263  using T = r_Float; \
264  code break; \
265  } \
266  default: \
267  { \
268  codeDefault break; \
269  } \
270  }
271 
272 #endif
This class is the superclass of the types r_Structure_Type and r_Primitive_Type in the representation...
Definition: basetype.hh:40
This class represents the collection type in the ODMG conformant representation of the RasDaMan type ...
Definition: collectiontype.hh:39
This class represents the marray type in the ODMG conformant representation of the RasDaMan type syst...
Definition: marraytype.hh:41
This class the superclass for all classes in the ODMG conformant representation of the RasDaMan type ...
Definition: metaobject.hh:40
This class represents the multidimensional interval type in the ODMG conformant representation of the...
Definition: mintervaltype.hh:41
This class represents the oid type in the ODMG conformant representation of the RasDaMan type system.
Definition: oidtype.hh:40
This class represents the point type in the ODMG conformant representation of the RasDaMan type syste...
Definition: pointtype.hh:40
This class represents all primitive types in the ODMG conformant representation of the RasDaMan type ...
Definition: primitivetype.hh:42
This class represents the sinterval type in the ODMG conformant representation of the RasDaMan type s...
Definition: sintervaltype.hh:39
This class represents a type for simple strings.
Definition: stringtype.hh:39
This class represents all user defined structured types in the ODMG conformant representation of the ...
Definition: structuretype.hh:41
This class the superclass for all types in the ODMG conformant representation of the RasDaMan type sy...
Definition: type.hh:51
virtual bool isCollectionType() const
check, if type is a Colelction type
r_Type()=default
default constructor.
virtual bool isOidType() const
check, if type is a oid
static r_Type * get_any_type(const std::string &type_string)
virtual bool isPointType() const
check, if type is a Point
virtual void convertToBigEndian(char *cells, r_Area noCells) const =0
converts array of cells from Unix byte order to NT byte order.
virtual bool isStructType() const
check, if type is primitive or structured.
virtual bool isMarrayType() const
check, if type is a marray type.
virtual bool isBaseType() const
check, if type is a base type ( primitive type or structure type).
virtual bool isSintervalType() const
check, if type is a Sinterval
virtual bool isMintervalType() const
check, if type is a Minterval
virtual ~r_Type()=default
destructor.
virtual bool isStringType() const
check, if type is a string
virtual bool isPrimitiveType() const
check, if type is a primitive type.
static r_Type * get_any_type(const char *type_string)
build type schema from string representation
r_Type_Id
typedef for the enum specifying a primitive type, structure type, marray type, interval type,...
Definition: type.hh:56
@ OCTET
Definition: type.hh:62
@ STRUCTURETYPE
Definition: type.hh:70
@ COMPLEXTYPE1
Definition: type.hh:66
@ LONG
Definition: type.hh:60
@ OIDTYPE
Definition: type.hh:76
@ COMPLEXTYPE2
Definition: type.hh:67
@ COLLECTIONTYPE
Definition: type.hh:72
@ FLOAT
Definition: type.hh:64
@ UNKNOWNTYPE
Definition: type.hh:78
@ STRINGTYPE
Definition: type.hh:77
@ CINT32
Definition: type.hh:69
@ ULONG
Definition: type.hh:57
@ CHAR
Definition: type.hh:65
@ SINTERVALTYPE
Definition: type.hh:73
@ BOOL
Definition: type.hh:59
@ CINT16
Definition: type.hh:68
@ MARRAYTYPE
Definition: type.hh:71
@ POINTTYPE
Definition: type.hh:75
@ MINTERVALTYPE
Definition: type.hh:74
@ DOUBLE
Definition: type.hh:63
@ SHORT
Definition: type.hh:61
@ USHORT
Definition: type.hh:58
virtual r_Type * clone() const =0
clone operation
r_Type(const char *newTypeName)
constructor getting name of type.
virtual r_Type::r_Type_Id type_id() const =0
retrieve id of the type.
virtual void convertToLittleEndian(char *cells, r_Area noCells) const =0
converts array of cells from NT byte order to Unix byte order.
virtual bool isComplexType() const
check, if type is a base type ( primitive type or structure type).
std::uint64_t r_Area
number of cells in an mdd object or tile.
Definition: mddtypes.hh:49
std::ostream & operator<<(std::ostream &s, r_Type::r_Type_Id t)