rasdaman complete source
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 /
33 #ifndef _D_PRIMITIVE_TYPE_
34 #define _D_PRIMITIVE_TYPE_
35 
36 class r_Error;
37 
38 #include "raslib/basetype.hh"
39 #include "raslib/odmgtypes.hh"
40 
41 //@ManMemo: Module: {\bf raslib}
42 
43 /*@Doc:
44  This class represents all primitive types in the ODMG conformant
45  representation of the RasDaMan type system. Examples are ULONG or
46  BOOL.
47 */
48 
50 {
51 public:
53  r_Primitive_Type( const char* newTypeName, const r_Type::r_Type_Id newTypeId );
55  r_Primitive_Type( const r_Primitive_Type& oldObj );
57  const r_Primitive_Type& operator=( const r_Primitive_Type& oldObj );
59  virtual ~r_Primitive_Type();
60 
62  virtual r_Type* clone() const;
63 
65  virtual r_Type::r_Type_Id type_id() const;
66 
68  virtual void convertToLittleEndian(char* cells, r_Area noCells) const;
69 
71  virtual void convertToBigEndian(char* cells, r_Area noCells) const;
72 
74  virtual void print_status( std::ostream& s = std::cout ) const;
75 
77  virtual bool isPrimitiveType() const;
78 
80  virtual void print_value( const char* storage, std::ostream& s = std::cout ) const;
81 
82  //@Man: Type-safe value access methods. In case of type mismatch, an exception is raised.
84 
87  r_Double get_value( const char* cell ) const throw( r_Error );
89  void set_value( char* cell, r_Double ) throw( r_Error );
91  void get_limits( r_Double&, r_Double& ) throw( r_Error );
92 
93 
95  r_Boolean get_boolean( const char* cell ) const throw( r_Error );
97  r_Char get_char( const char* cell ) const throw( r_Error );
99  r_Octet get_octet( const char* cell ) const throw( r_Error );
101  r_Short get_short( const char* cell ) const throw( r_Error );
103  r_UShort get_ushort( const char* cell ) const throw( r_Error );
105  r_Long get_long( const char* cell ) const throw( r_Error );
107  r_ULong get_ulong( const char* cell ) const throw( r_Error );
109  r_Float get_float( const char* cell ) const throw( r_Error );
111  r_Double get_double( const char* cell ) const throw( r_Error );
112 
114  void set_boolean( char* cell, r_Boolean ) throw( r_Error );
116  void set_char( char* cell, r_Char ) throw( r_Error );
118  void set_octet( char* cell, r_Octet ) throw( r_Error );
120  void set_short( char* cell, r_Short ) throw( r_Error );
122  void set_ushort( char* cell, r_UShort ) throw( r_Error );
124  void set_long( char* cell, r_Long ) throw( r_Error );
126  void set_ulong( char* cell, r_ULong ) throw( r_Error );
128  void set_float( char* cell, r_Float ) throw( r_Error );
130  void set_double( char* cell, r_Double ) throw( r_Error );
131 
132 
134 
135 
136 protected:
139 
141 };
142 
143 //@Doc: write the status of a primitive type to a stream
144 extern std::ostream &operator<<( std::ostream &str, const r_Primitive_Type &type );
145 
146 #endif
147 
virtual void convertToBigEndian(char *cells, r_Area noCells) const
converts array of cells from Unix byte order to NT byte order.
r_Boolean get_boolean(const char *cell) const
virtual r_Type::r_Type_Id type_id() const
retrieve id of the type.
unsigned short r_UShort
Definition: odmgtypes.hh:87
virtual void print_value(const char *storage, std::ostream &s=std::cout) const
prints value of a primitive type
Definition: raslib/basetype.hh:47
r_Char get_char(const char *cell) const
unsigned int r_ULong
Definition: odmgtypes.hh:114
void set_char(char *cell, r_Char)
Definition: error.hh:88
Definition: raslib/type.hh:56
virtual ~r_Primitive_Type()
destructor.
virtual bool isPrimitiveType() const
check, if type is primitive.
const r_Primitive_Type & operator=(const r_Primitive_Type &oldObj)
assignment operator.
r_ULong get_ulong(const char *cell) const
r_Primitive_Type()
default constructor.
void set_float(char *cell, r_Float)
virtual r_Type * clone() const
clone operation
unsigned char r_Boolean
Definition: odmgtypes.hh:151
double r_Double
Definition: odmgtypes.hh:138
void set_long(char *cell, r_Long)
r_Type::r_Type_Id typeId
Definition: primitivetype.hh:140
virtual void convertToLittleEndian(char *cells, r_Area noCells) const
converts array of cells from NT byte order to Unix byte order.
void set_value(char *cell, r_Double)
void get_limits(r_Double &, r_Double &)
r_Double get_double(const char *cell) const
float r_Float
Definition: odmgtypes.hh:125
r_Octet get_octet(const char *cell) const
uint64_t r_Area
Definition: mddtypes.hh:85
void set_boolean(char *cell, r_Boolean)
r_UShort get_ushort(const char *cell) const
signed char r_Octet
Definition: odmgtypes.hh:60
unsigned char r_Char
Definition: odmgtypes.hh:47
r_Short get_short(const char *cell) const
r_Type_Id
Definition: raslib/type.hh:61
virtual void print_status(std::ostream &s=std::cout) const
writes state of object to specified stream
r_Double get_value(const char *cell) const
void set_double(char *cell, r_Double)
std::ostream & operator<<(std::ostream &str, const r_Primitive_Type &type)
r_Long get_long(const char *cell) const
void set_octet(char *cell, r_Octet)
Definition: primitivetype.hh:49
void set_short(char *cell, r_Short)
int r_Long
Definition: odmgtypes.hh:100
short r_Short
Definition: odmgtypes.hh:74
void set_ulong(char *cell, r_ULong)
void set_ushort(char *cell, r_UShort)
r_Float get_float(const char *cell) const