rasdaman complete source
flatbasetype.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 _FLAT_BASE_TYPE_HH_
34 #define _FLAT_BASE_TYPE_HH_
35 
36 #include <iostream>
37 
38 #include "raslib/error.hh"
39 
40 class r_Base_Type;
41 class r_Primitive_Type;
42 class r_Structure_Type;
43 
44 //@ManMemo: Module {\bf raslib}
45 
46 
47 /*@Doc:
48  This class can be used to get a more convenient view on a structured
49  base type. It eliminates all hierarchies and gives you the primitive
50  types only which can be iterated over with a normal linear loop. Used
51  in e.g. the compression module. Note that this is not a regular member
52  of the r_Type hierarchy!
53 */
54 
55 class r_Flat_Base_Type
56 {
57 public:
59  r_Flat_Base_Type( void );
61  r_Flat_Base_Type( const r_Base_Type *type );
63  r_Flat_Base_Type( const r_Flat_Base_Type &src );
65  ~r_Flat_Base_Type( void );
66 
68  unsigned int get_num_types( void ) const;
71  const r_Primitive_Type *type( unsigned int num ) const throw (r_Eindex_violation);
74  const r_Primitive_Type *operator[]( unsigned int num ) const throw (r_Eindex_violation);
77  unsigned int offset( unsigned int num ) const throw (r_Eindex_violation);
79  r_Bytes size( void ) const;
81  r_Flat_Base_Type &operator=( const r_Flat_Base_Type &src );
83  r_Flat_Base_Type &operator=( const r_Base_Type *type );
85  bool operator==( const r_Flat_Base_Type &src ) const;
87  void print_status( std::ostream &str ) const;
88 
89 
90 protected:
92  void init_shared( void );
94  void process_type( const r_Base_Type *type );
96  void copy_flat_type( const r_Flat_Base_Type &type );
98  void free_type_data( void );
99 
101  unsigned int parse_structure_type( const r_Structure_Type *type, unsigned int number,
102  unsigned int offset );
104  void parse_primitive_type( r_Primitive_Type *type, unsigned int number,
105  unsigned int offset );
106 
108  unsigned int numPrimTypes;
110  r_Bytes typeSize;
112  r_Primitive_Type **primTypes;
114  unsigned int *offsets;
115 };
116 
117 
118 //@ManMemo: Module {\bf raslib}
119 
120 //@Doc: write the status of a flat base type to a stream
121 extern std::ostream &operator<<( std::ostream &str, const r_Flat_Base_Type &type );
122 
123 #endif
Definition: structuretype.hh:56
bool operator==(const OId::OIdPrimitive one, const OId &two)
template std::ostream & operator<<(const vector< KeyObject > &, std::ostream &)