rasdaman complete source
dirdecompose.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 _R_DIRDECOMPOSE_HH_
34 #define _R_DIRDECOMPOSE_HH_
35 
36 // Include statements
37 
38 #include <iostream>
39 #include <vector>
40 using std::cout;
41 using std::vector;
42 
43 #include "raslib/error.hh"
44 #include "raslib/sinterval.hh"
45 
46 //@ManMemo: Module {\bf rasodmg}
47 
48 /*@Doc:
49 
50  The {\tt r_Dir_Decompose} class is used to specify a decomposition on
51  an n-dimensional cube (for use in {\tt r_Dir_Tiling}). For instance, to
52  specify a tiling restriction on a dimension with the form: [0, 2, 4, 5],
53  the following code would apply:
54 
55  r_Dir_Decompose decomp;
56 
57  decomp << 0 << 2 << 4 << 5;
58 
59  Note that the first and the last elements input into the object must be
60  the origin and limit of that dimension or else a cross-section of the domain
61  will occur (as if the elements outside the specification wouldn't mind).
62 
63  If one dimension is considered to be a prefered access direction, then
64  the r_Dir_Decompose should be empty, this is, no restriction should be
65  entered.
66 */
67 
71 class r_Dir_Decompose
72 {
73 public:
74 
75  r_Dir_Decompose();
76 
77  virtual ~r_Dir_Decompose();
78 
80  r_Dir_Decompose(const r_Dir_Decompose& other);
81 
83  const r_Dir_Decompose& operator=(const r_Dir_Decompose& other);
84 
86  r_Dir_Decompose& operator<<(r_Range limit);
87 
89  r_Dir_Decompose& prepend(r_Range limit);
90 
92  int get_num_intervals() const;
93 
95  r_Range get_partition(int number) const throw (r_Eindex_violation);
96 
98  virtual void print_status(std::ostream& os = cout ) const;
99 
100 protected:
101  r_Sinterval get_total_interval( );
102 
104  const static r_Dimension DEFAULT_INTERVALS;
105 
107  r_Dimension num_intervals;
108 
110  r_Dimension current_interval;
111 
113  r_Range* intervals;
114 };
115 
116 //@ManMemo: Module: {\bf rasodmg}
120 extern std::ostream& operator<<(std::ostream& os, const r_Dir_Decompose& d);
121 extern std::ostream& operator<<(std::ostream& os, const std::vector<r_Dir_Decompose>& vec);
122 
123 #endif
Definition: sinterval.hh:233
template std::ostream & operator<<(const vector< KeyObject > &, std::ostream &)