CARMA C++
CoordRange.h
Go to the documentation of this file.
1 #ifndef SZA_UTIL_COORDRANGE_H
2 #define SZA_UTIL_COORDRANGE_H
3 
11 #include "carma/szautil/Coord.h"
12 
13 #include <iostream>
14 
15 namespace sza {
16  namespace util {
17 
18  // Class for managing a range of a coordinate axis
19 
20  class CoordRange {
21  public:
22 
26  CoordRange();
27  CoordRange(unsigned index);
28  CoordRange(unsigned iStart, unsigned iStop);
29  CoordRange(Coord& start, Coord& stop);
30  CoordRange(Coord& coord);
31  CoordRange(CoordRange* coordRange);
32 
33  void initialize();
34 
38  virtual ~CoordRange();
39 
43  void setStartIndex(unsigned iAxis, unsigned iStart);
44  unsigned startIndex(unsigned iAxis);
45 
46  // Set the start coordinate
47 
48  void setStartCoord(Coord& startCoord);
49  void setStartCoord(Coord* startCoord);
50 
51  // Get the start coord
52 
53  Coord startCoord();
54 
55  void setStopIndex(unsigned iAxis, unsigned iStop);
56  unsigned stopIndex(unsigned iAxis);
57 
58  // Set both the stop and start to the same index
59 
60  void setIndex(unsigned iAxis, unsigned index);
61 
62  // Same as above, but defaults to axis 0
63 
64  void setIndex(unsigned index);
65 
66  // Set the stop coordinate
67 
68  void setStopCoord(Coord& stopCoord);
69  void setStopCoord(Coord* stopCoord);
70 
71  // Get the stop coord
72 
73  Coord stopCoord();
74 
75  void setCoord(Coord coord);
76 
80  unsigned nEl(unsigned iAxis);
81 
85  unsigned nAxis();
86 
90  bool isValid();
91 
110  void setContiguous(bool contiguous);
111  bool isContiguous();
112 
116  friend std::ostream& operator<<(std::ostream& os, CoordRange range);
117 
121  CoordRange& operator+=(unsigned incr);
122 
126  bool operator==(CoordRange& range);
127 
128  // Return true if this range contains the passed range
129 
130  bool contains(CoordRange& range);
131 
132  private:
133 
134  Coord startCoord_;
135  Coord stopCoord_;
136 
137  bool contiguous_;
138 
139  }; // End class CoordRange
140 
141  } // End namespace util
142 } // End namespace sza
143 
144 
145 
146 #endif // End #ifndef SZA_UTIL_COORDRANGE_H
Tagged: Thu Jun 24 17:38:28 UTC 2004.