rasdaman API
attribute.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_ATTRIBUTE_
34 #define _D_ATTRIBUTE_
35 
36 #include "raslib/property.hh"
37 #include "raslib/odmgtypes.hh"
38 #include "raslib/mddtypes.hh"
39 
40 class r_Base_Type;
41 class r_Type_Id;
42 class r_Error;
43 
44 
45 //@ManMemo: Module: {\bf raslib}
46 
47 /*@Doc:
48  This class represents attributes of structs in the ODMG
49  conformant representation of the RasDaMan type system.
50 */
51 
52 
53 class r_Attribute : public r_Property
54 {
55 public:
58  r_Attribute();
59 
61  r_Attribute(const char* newTypeName, const r_Base_Type& newType);
62 
64  r_Attribute(const r_Attribute& oldObj);
65 
67  const r_Attribute& operator=(const r_Attribute& oldObj);
68 
70  virtual ~r_Attribute();
71 
73  r_Bytes offset() const;
74 
76  void set_offset(r_Bytes newOffset);
77 
79  r_Bytes global_offset() const;
80 
82  void set_global_offset(r_Bytes newOffset);
83 
85  virtual void print_status(std::ostream& s = std::cout) const;
86 
89  r_Attribute operator[](unsigned int number) const throw(r_Error);
90 
91  //@Man: Type-safe value access methods. In case of type mismatch, an exception is raised.
93  r_Boolean get_boolean(const char* cell) const throw(r_Error);
95 
97  r_Char get_char(const char* cell) const throw(r_Error);
98 
100  r_Octet get_octet(const char* cell) const throw(r_Error);
101 
103  r_Short get_short(const char* cell) const throw(r_Error);
104 
106  r_UShort get_ushort(const char* cell) const throw(r_Error);
107 
109  r_Long get_long(const char* cell) const throw(r_Error);
110 
112  r_ULong get_ulong(const char* cell) const throw(r_Error);
113 
115  r_Float get_float(const char* cell) const throw(r_Error);
116 
118  r_Double get_double(const char* cell) const throw(r_Error);
119 
121 
122 
123 protected:
126 
129 };
130 
131 //@Doc: write the status of a attribute to a stream
132 extern std::ostream &operator<<( std::ostream &str, const r_Attribute &type );
133 
134 #endif
unsigned short r_UShort
Definition: odmgtypes.hh:87
r_Float get_float(const char *cell) const
Definition: basetype.hh:47
r_Bytes offset() const
retrieve (local) offset
unsigned int r_ULong
Definition: odmgtypes.hh:114
void set_offset(r_Bytes newOffset)
set (local) offset
Definition: error.hh:88
r_Long get_long(const char *cell) const
r_Short get_short(const char *cell) const
unsigned char r_Boolean
Definition: odmgtypes.hh:151
double r_Double
Definition: odmgtypes.hh:138
virtual void print_status(std::ostream &s=std::cout) const
writes state of object to specified stream
void set_global_offset(r_Bytes newOffset)
set global offset
r_Bytes localOffset
local offset
Definition: attribute.hh:125
r_Attribute operator[](unsigned int number) const
subscript operator to access attributes of a structured attribute throws error when type is not a str...
const r_Attribute & operator=(const r_Attribute &oldObj)
assignment operator.
r_Char get_char(const char *cell) const
r_Boolean get_boolean(const char *cell) const
float r_Float
Definition: odmgtypes.hh:125
signed char r_Octet
Definition: odmgtypes.hh:60
unsigned char r_Char
Definition: odmgtypes.hh:47
r_Attribute()
default constructor. initialise important attributes to NULL
r_UShort get_ushort(const char *cell) const
unsigned int r_Bytes
Definition: mddtypes.hh:56
r_Bytes global_offset() const
retrieve global offset
r_Double get_double(const char *cell) const
std::ostream & operator<<(std::ostream &str, const r_Attribute &type)
int r_Long
Definition: odmgtypes.hh:100
r_Octet get_octet(const char *cell) const
short r_Short
Definition: odmgtypes.hh:74
r_ULong get_ulong(const char *cell) const
Definition: property.hh:49
Definition: attribute.hh:53
r_Bytes globalOffset
global offset
Definition: attribute.hh:128
virtual ~r_Attribute()
destructor.