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 
49 class r_Primitive_Type : public r_Base_Type
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:
138  r_Primitive_Type();
139 
140  r_Type::r_Type_Id typeId;
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 
Definition: raslib/type.hh:56
r_Type_Id
Definition: raslib/type.hh:61