rasdaman client API  10.6.3
The Array Analytics Engine: Datacubes at Your Fingertips
primitivetype.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 /
18 rasdaman GmbH.
19 *
20 * For more information please see <http://www.rasdaman.org>
21 * or contact Peter Baumann via <baumann@rasdaman.com>.
22 */
23 
24 #ifndef D_PRIMITIVE_TYPE_HH
25 #define D_PRIMITIVE_TYPE_HH
26 
27 #include "raslib/basetype.hh"
28 #include "raslib/odmgtypes.hh"
29 
30 //@ManMemo: Module: {\bf raslib}
42 {
43 public:
44  r_Primitive_Type(const char *newTypeName, const r_Type::r_Type_Id newTypeId);
46  ~r_Primitive_Type() override = default;
47 
49 
51  r_Type *clone() const override;
52 
54  r_Type::r_Type_Id type_id() const override;
55 
57  void convertToLittleEndian(char *cells, r_Area noCells) const override;
58 
60  void convertToBigEndian(char *cells, r_Area noCells) const override;
61 
63  void print_status(std::ostream &s) const override;
64 
66  bool isPrimitiveType() const override;
67 
69  void print_value(const char *storage, std::ostream &s) const override;
70 
71  //@Man: Type-safe value access methods. In case of type mismatch, an exception is raised.
73  r_Double get_value(const char *cell) const;
74  void set_value(char *cell, r_Double);
76 
77  r_Boolean get_boolean(const char *cell) const;
78  r_Char get_char(const char *cell) const;
79  r_Octet get_octet(const char *cell) const;
80  r_Short get_short(const char *cell) const;
81  r_UShort get_ushort(const char *cell) const;
82  r_Long get_long(const char *cell) const;
83  r_ULong get_ulong(const char *cell) const;
84  r_Float get_float(const char *cell) const;
85  r_Double get_double(const char *cell) const;
86 
87  void set_boolean(char *cell, r_Boolean);
88  void set_char(char *cell, r_Char);
89  void set_octet(char *cell, r_Octet);
90  void set_short(char *cell, r_Short);
91  void set_ushort(char *cell, r_UShort);
92  void set_long(char *cell, r_Long);
93  void set_ulong(char *cell, r_ULong);
94  void set_float(char *cell, r_Float);
95  void set_double(char *cell, r_Double);
97 
98 protected:
100  r_Primitive_Type() = default;
101 
102  void checkType(r_Type::r_Type_Id cellType) const;
103 
105 };
106 
107 //@Doc: write the status of a primitive type to a stream
108 extern std::ostream &operator<<(std::ostream &str, const r_Primitive_Type &type);
109 
110 #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 all primitive types in the ODMG conformant representation of the RasDaMan type ...
Definition: primitivetype.hh:42
void convertToLittleEndian(char *cells, r_Area noCells) const override
converts array of cells from NT byte order to Unix byte order.
void set_ushort(char *cell, r_UShort)
void set_char(char *cell, r_Char)
void set_double(char *cell, r_Double)
r_Float get_float(const char *cell) const
void set_value(char *cell, r_Double)
~r_Primitive_Type() override=default
void print_status(std::ostream &s) const override
writes state of object to specified stream
r_Long get_long(const char *cell) const
void set_short(char *cell, r_Short)
const r_Primitive_Type & operator=(const r_Primitive_Type &oldObj)
void print_value(const char *storage, std::ostream &s) const override
prints value of a primitive type
r_Primitive_Type(const r_Primitive_Type &oldObj)
void set_boolean(char *cell, r_Boolean)
r_Double get_double(const char *cell) const
void get_limits(r_Double &, r_Double &)
r_Char get_char(const char *cell) const
r_Short get_short(const char *cell) const
bool isPrimitiveType() const override
check, if type is primitive.
r_Primitive_Type()=default
default constructor.
r_ULong get_ulong(const char *cell) const
void checkType(r_Type::r_Type_Id cellType) const
r_Boolean get_boolean(const char *cell) const
r_Double get_value(const char *cell) const
void set_ulong(char *cell, r_ULong)
r_Octet get_octet(const char *cell) const
void set_float(char *cell, r_Float)
r_UShort get_ushort(const char *cell) const
void set_long(char *cell, r_Long)
void convertToBigEndian(char *cells, r_Area noCells) const override
converts array of cells from Unix byte order to NT byte order.
r_Type::r_Type_Id type_id() const override
retrieve id of the type.
r_Type::r_Type_Id typeId
Definition: primitivetype.hh:104
r_Type * clone() const override
clone operation
r_Primitive_Type(const char *newTypeName, const r_Type::r_Type_Id newTypeId)
void set_octet(char *cell, r_Octet)
This class the superclass for all types in the ODMG conformant representation of the RasDaMan type sy...
Definition: type.hh:51
r_Type_Id
typedef for the enum specifying a primitive type, structure type, marray type, interval type,...
Definition: type.hh:56
@ UNKNOWNTYPE
Definition: type.hh:78
std::uint64_t r_Area
number of cells in an mdd object or tile.
Definition: mddtypes.hh:49
std::uint32_t r_ULong
Definition: odmgtypes.hh:38
double r_Double
Definition: odmgtypes.hh:40
std::uint16_t r_UShort
Definition: odmgtypes.hh:35
float r_Float
Definition: odmgtypes.hh:39
std::int8_t r_Octet
Definition: odmgtypes.hh:34
std::uint8_t r_Char
Definition: odmgtypes.hh:33
std::int32_t r_Long
Definition: odmgtypes.hh:37
std::uint8_t r_Boolean
Definition: odmgtypes.hh:32
std::int16_t r_Short
Definition: odmgtypes.hh:36
std::ostream & operator<<(std::ostream &str, const r_Primitive_Type &type)