CARMA C++
RegDescription.h
Go to the documentation of this file.
1 #ifndef SZA_UTIL_REGDESCRIPTION_H
2 #define SZA_UTIL_REGDESCRIPTION_H
3 
14 #include "carma/szautil/Range.h"
16 
17 #include "carma/szaarrayutils/szaregs.h"
18 
19 #include <iostream>
20 
21 namespace sza {
22  namespace util {
23 
24  class RegParser;
25 
26  class RegDescription {
27  public:
28 
32  RegDescription(bool archivedOnly_=false, ArrayMap* arrayMap=0);
33 
37  RegDescription(bool archivedOnly_, RegMapBlock* block);
38 
42  RegDescription(RegDescription& desc);
43  RegDescription(const RegDescription& desc);
44 
48  void operator=(RegDescription& desc);
49  void operator=(const RegDescription& desc);
50 
54  virtual ~RegDescription();
55 
59  void initialize();
60 
64  void reset();
65 
71  void setTo(std::string regmap_name,
72  std::string board_name,
73  std::string block_name,
74  RegAspect aspect,
75  RegInteg integ,
76  Coord* coord=0,
77  unsigned n=0);
78 
79  void setTo(std::string regmap_name,
80  std::string board_name,
81  std::string block_name,
82  RegAspect aspect,
83  RegInteg integ,
84  CoordRange& coordRange);
85 
89  void setCoord(Coord& coord);
90 
94  void setOutputMode(RegOutputMode mode);
95 
96  // A method for printing this object's register specification on
97  // an output stream
98 
99  friend std::ostream& operator<<(std::ostream& os,
100  RegDescription& desc);
101 
105  void output(OutputStream* stream, RegOutputMode mode);
106 
110  bool rangeIsValid(CoordRange& range);
111  bool rangeIsValid(CoordRange* range);
112 
117  unsigned nEl(CoordRange* range=0);
118  unsigned nByte(CoordRange* range=0);
119 
124  unsigned fastestNel();
125 
129  CoordRange range() {
130  return range_;
131  }
132 
136  CoordRange* getRangePtr() {
137  return &range_;
138  }
139 
143  CoordAxes axes() {
144  return axes_;
145  }
146 
151  std::vector<Range<unsigned> > getElementRanges(CoordRange* range=0);
152 
157  std::vector<Range<unsigned> > getSlotRanges(CoordRange* range=0);
158 
163  std::vector<Range<unsigned> > getByteRanges(CoordRange* range=0);
164 
168  unsigned nSlot(CoordRange* range=0);
169 
175  int startSlot(CoordRange* range=0);
176  int stopSlot(CoordRange* range=0);
177 
181  int iSlot() {
182  return iSlot_;
183  }
184 
185  int iRegMap() {
186  return iRegMap_;
187  }
188 
189  int iBoard() {
190  return iBoard_;
191  }
192 
193  int iBlock() {
194  return iBlock_;
195  }
196 
200  ArrRegMap* regMap();
201 
202  RegAspect aspect() {
203  return aspect_;
204  }
205 
206  std::string aspectName();
207 
208  void setAspect(RegAspect aspect) {
209  aspect_ = aspect;
210  }
211 
212  RegInteg integ() {
213  return integ_;
214  }
215 
216  std::string integName();
217 
218  void setInteg(RegInteg integ) {
219  integ_ = integ;
220  }
221 
222  inline ArrayMap* arrayMap() {
223  return arrayMap_;
224  }
225 
226  RegMapBlock* block();
227 
228  std::string blockName();
229  std::string boardName();
230  std::string regMapName();
231 
235  void begin();
236 
240  bool isEnd();
241 
245  const RegDescription& operator++();
246 
251  unsigned currentSlot();
252 
256  unsigned currentElement();
257 
261  Coord currentCoord();
262 
263  // True if the selected range of elements in this descriptor
264  // contains the range in the passed descriptor
265 
266  bool contains(RegDescription& desc);
267 
268  inline long oldestVisible() {
269  return oldestVisible_;
270  }
271 
272  inline bool isFirst() {
273  return first_;
274  }
275 
276  void setFirst(bool first);
277  void setOldestVisible(long oldest);
278  void resetOldestVisible();
279  void decreaseOldestVisible(long oldest);
280  void increaseOldestVisible(long oldest);
281 
282  CoordAxes axes_; // An axis specifier for this register
283 
284  private:
285 
286  friend class RegParser;
287 
288  // A static array map used by all objects of this type
289 
290  ArrayMapBase arrayMapBase_;
291  ArrayMap* arrayMap_;
292 
293  // Per-object members
294 
295  bool archivedOnly_; // True if this class is to manage only
296  // archived registers
297 
298  RegOutputMode outputMode_; // A specification for how this
299  // register description should be
300  // written on output
301 
302  int iRegMap_; // The index of the specified register map in the
303  // array map
304 
305  int iBoard_; // The index of the specified board in the
306  // register-map
307 
308  int iBlock_; // The index of the specified block on the
309  // regmap board
310 
311  int iSlot_; // The frame index of the first element of
312  // this register.
313  //
314  // NB: This is the frame offset of the
315  // _first_ element of this register, and
316  // not the offset of the first requested
317  // element (i.e., of range_.startCoord())
318 
319  unsigned nEl_; // The total number of elements requested
320 
321  unsigned size_; // The number of slots per register. This
322  // is 1 unless aspect!=REG_PLAIN, in which
323  // case it becomes 2
324  RegAspect aspect_; // The quantity to derive from complex or
325  // utc register pairs
326 
327  RegInteg integ_; // Integration status of this register
328 
329  int iByte_; // The byte index into the array map of the
330  // first element of the requested register.
331  //
332  // NB: This is the offset of the _first_
333  // element of this register, and not the
334  // offset of the first requested element
335  // (i.e., of range_.startCoord())
336 
337  unsigned nBytePerEl_;// The number of bytes per element of this
338  // register
339 
340  CoordRange range_; // An index-range specifier
341 
342  RegAxisRange* axisRange_; // An axis-range for iterating
343 
344  // This is just a utility member for use in plotting interface.
345 
346  long oldestVisible_;
347  bool first_;
348 
349  }; // End class RegDescription
350 
351  } // End namespace util
352 } // End namespace sza
353 
354 
355 
356 #endif // End #ifndef SZA_UTIL_REGDESCRIPTION_H
Tagged: Sat Oct 2 00:14:18 UTC 2004.
Tagged: Fri Sep 17 15:48:20 PDT 2004.
Tagged: Thu Jun 24 17:19:46 UTC 2004.
Tagged: Wed Oct 6 11:04:54 PDT 2004.
Tagged: Fri Sep 17 15:51:07 PDT 2004.