rasdaman complete source
primitive.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 /
34 #ifndef _D_PRIMITIVE_
35 #define _D_PRIMITIVE_
36 
37 #include <iostream>
38 
39 class r_Error;
40 
41 #include "raslib/scalar.hh"
42 #include "raslib/odmgtypes.hh"
43 
44 class r_Primitive_Type;
45 
46 //@ManMemo: Module: {\bf raslib}
47 
48 /*@Doc:
49 
50  Class \Ref{r_Primitive} represents a primitive type value.
51 
52 */
53 
54 class r_Primitive : public r_Scalar
55 {
56 public:
57 
58  explicit
59 
61  r_Primitive( const char* newBuffer, const r_Primitive_Type* newType );
62 
64  r_Primitive( const r_Primitive& obj );
65 
67  ~r_Primitive();
68 
70  virtual r_Scalar* clone() const;
71 
73  virtual const r_Primitive& operator= ( const r_Primitive& );
74 
76  const char* get_buffer() const;
77 
79  virtual void print_status(std::ostream& s) const;
80 
81  virtual bool isPrimitive() const;
82 
83  //@Man: Type-safe value access methods. In case of type mismatch, an exception is raised.
85 
88  r_Boolean get_boolean() const throw( r_Error );
90  r_Char get_char() const throw( r_Error );
92  r_Octet get_octet() const throw( r_Error );
94  r_Short get_short() const throw( r_Error );
96  r_UShort get_ushort() const throw( r_Error );
98  r_Long get_long() const throw( r_Error );
100  r_ULong get_ulong() const throw( r_Error );
102  r_Float get_float() const throw( r_Error );
104  r_Double get_double() const throw( r_Error );
105 
107  void set_boolean(r_Boolean) throw( r_Error );
109  void set_char(r_Char) throw( r_Error );
111  void set_octet(r_Octet) throw( r_Error );
113  void set_short(r_Short) throw( r_Error );
115  void set_ushort(r_UShort) throw( r_Error );
117  void set_long(r_Long) throw( r_Error );
119  void set_ulong(r_ULong) throw( r_Error );
121  void set_float(r_Float) throw( r_Error );
123  void set_double(r_Double) throw( r_Error );
124 
125 
127 
128 
129 private:
131  char* valueBuffer;
132 };
133 
134 
135 
136 //@ManMemo: Module: {\bf raslib}
140 extern std::ostream& operator<<( std::ostream& s, const r_Primitive& obj );
141 
142 #endif
143 
virtual const r_Scalar & operator=(const r_Scalar &)
operator for assigning a scalar
virtual r_Scalar * clone() const =0
clone operator
Definition: scalar.hh:53
virtual void print_status(std::ostream &s) const =0
debug output
virtual bool isPrimitive() const