rasdaman API
structuretype.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 Lesser 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 Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
16  *
17  * Copyright 2003 - 2010 Peter Baumann / rasdaman GmbH.
18  *
19  * For more information please see <http://www.rasdaman.org>
20  * or contact Peter Baumann via <baumann@rasdaman.com>.
21 */
22 
33 #ifndef _D_STRUCTURE_TYPE_
34 #define _D_STRUCTURE_TYPE_
35 
36 #if (defined(__VISUALC__) && !defined(__EXECUTABLE__))
37 #define __EXECUTABLE__
38 #include "raslib/itertype.hh"
39 #undef __EXECUTABLE__
40 #else
41 #include "raslib/itertype.hh"
42 #endif
43 
44 class r_Error;
45 #include "raslib/basetype.hh"
46 #include "raslib/attribute.hh"
47 
48 
49 //@ManMemo: Module: {\bf raslib}
50 
51 /*@Doc:
52  This class represents all user defined structured types in the
53  ODMG conformant representation of the RasDaMan type system.
54 */
55 
56 class r_Structure_Type : public r_Base_Type
57 {
58 public:
60  typedef r_IterType<r_Attribute> attribute_iterator;
64  r_Structure_Type( char* newTypeName, unsigned int newNumAttrs, r_Attribute* newAttrs, int offset = 0 );
66  r_Structure_Type( const r_Structure_Type& oldObj );
68  const r_Structure_Type& operator=( const r_Structure_Type& oldObj );
70  virtual ~r_Structure_Type();
71 
73  virtual r_Type* clone() const;
74 
76  virtual r_Type::r_Type_Id type_id() const;
77 
79  virtual bool isStructType() const;
80 
82  virtual bool compatibleWith(const r_Structure_Type* myType) const;
83 
89  r_Attribute resolve_attribute(const char* name) const throw( r_Error );
91  r_Attribute resolve_attribute(unsigned int number) const throw( r_Error );
93  r_Attribute operator[]( unsigned int number ) const throw( r_Error );
94 
96  unsigned int count_elements() const;
97 
99  virtual void convertToLittleEndian(char* cells, r_Area noCells) const;
100 
102  virtual void convertToBigEndian(char* cells, r_Area noCells) const;
103 
105  virtual void print_status( std::ostream& s = std::cout ) const;
106 
108  virtual void print_value( const char* storage, std::ostream& s = std::cout ) const;
109 
110 protected:
111  unsigned int numAttrs;
112  r_Attribute* myAttributes;
113 };
114 
115 //@Doc: write the status of a structure type to a stream
116 extern std::ostream &operator<<( std::ostream &str, const r_Structure_Type &type );
117 
118 #endif
virtual bool isStructType() const
check, if type is primitive or structured.
r_Attribute resolve_attribute(const char *name) const
return attribute specified by name.
virtual r_Type::r_Type_Id type_id() const
retrieve id of the type.
Definition: structuretype.hh:56
attribute_iterator defines_attribute_end() const
returns attribute iterator at end position (behind last attribute).
Definition: type.hh:56
std::ostream & operator<<(std::ostream &str, const r_Structure_Type &type)
unsigned int count_elements() const
get number of attributes
virtual r_Type * clone() const
clone operation
virtual ~r_Structure_Type()
destructor.
r_Attribute operator[](unsigned int number) const
subscript operator to access attributes by index
virtual void print_status(std::ostream &s=std::cout) const
writes state of object to specified stream
virtual void convertToBigEndian(char *cells, r_Area noCells) const
converts array of cells from Unix byte order to NT byte order.
unsigned int numAttrs
Definition: structuretype.hh:111
r_Structure_Type()
default constructor.
r_Type_Id
Definition: type.hh:61
r_Attribute * myAttributes
Definition: structuretype.hh:112
attribute_iterator defines_attribute_begin() const
returns attribute iterator at begin position.
r_IterType< r_Attribute > attribute_iterator
typedef for iterator iterating through all attributes;
Definition: structuretype.hh:60
const r_Structure_Type & operator=(const r_Structure_Type &oldObj)
assignment operator.
virtual void print_value(const char *storage, std::ostream &s=std::cout) const
prints values of a structured type
virtual bool compatibleWith(const r_Structure_Type *myType) const
check, if this type is compatible with myType (e.g. check the structure ignoring then names of atribu...
virtual void convertToLittleEndian(char *cells, r_Area noCells) const
converts array of cells from NT byte order to Unix byte order.