My Project
 All Classes Files Functions Variables Enumerations Enumerator Friends Macros Pages
RegDescription.h
Go to the documentation of this file.
1 #ifndef GCP_UTIL_REGDESCRIPTION_H
2 #define GCP_UTIL_REGDESCRIPTION_H
3 
11 #include "gcp/util/common/ArrayMapBase.h"
12 #include "gcp/util/common/CoordAxes.h"
13 #include "gcp/util/common/CoordRange.h"
14 #include "gcp/util/common/Range.h"
15 #include "gcp/util/common/RegAxisRange.h"
16 
17 #include "gcp/control/code/unix/libunix_src/common/genericregs.h"
18 
19 #include <iostream>
20 
21 namespace gcp {
22  namespace util {
23 
24  class RegParser;
25 
27  public:
28 
32  RegDescription(bool archivedOnly_=false, ArrayMap* arrayMap=0);
33 
37  RegDescription(bool archivedOnly_, RegMapBlock* block);
38 
43  RegDescription(const RegDescription& desc);
44 
50 
54  void clear();
55 
59  virtual ~RegDescription();
60 
64  void initialize();
65 
69  void reset();
70 
76  void setTo(std::string regmap_name,
77  std::string board_name,
78  std::string block_name,
79  RegAspect aspect,
80  RegInteg integ,
81  Coord* coord=0,
82  unsigned n=0);
83 
84  void setTo(std::string regmap_name,
85  std::string board_name,
86  std::string block_name,
87  RegAspect aspect,
88  RegInteg integ,
89  CoordRange& coordRange);
90 
94  void setCoord(Coord& coord);
95 
99  void setOutputMode(RegOutputMode mode);
100 
101  // A method for printing this object's register specification on
102  // an output stream
103 
104  friend std::ostream& gcp::util::operator<<(std::ostream& os,
105  RegDescription& desc);
106 
110  void output(OutputStream* stream, RegOutputMode mode);
111 
116  bool rangeIsValid(CoordRange* range);
117 
122  unsigned nEl(CoordRange* range=0);
123  unsigned nByte(CoordRange* range=0);
124 
129  unsigned fastestNel();
130 
135  return range_;
136  }
137 
142  return &range_;
143  }
144 
149  return axes_;
150  }
151 
156  std::vector<Range<unsigned> > getElementRanges(CoordRange* range=0);
157 
162  std::vector<Range<unsigned> > getSlotRanges(CoordRange* range=0);
163 
168  std::vector<Range<unsigned> > getByteRanges(CoordRange* range=0);
169 
173  unsigned nSlot(CoordRange* range=0);
174 
180  int startSlot(CoordRange* range=0);
181  int stopSlot(CoordRange* range=0);
182 
186  int iSlot() {
187  return iSlot_;
188  }
189 
190  int iRegMap() {
191  return iRegMap_;
192  }
193 
194  int iBoard() {
195  return iBoard_;
196  }
197 
198  int iBlock() {
199  return iBlock_;
200  }
201 
205  ArrRegMap* regMap();
206 
207  RegAspect aspect() {
208  return aspect_;
209  }
210 
211  std::string aspectName();
212 
213  void setAspect(RegAspect aspect) {
214  aspect_ = aspect;
215  }
216 
217  RegInteg integ() {
218  return integ_;
219  }
220 
221  std::string integName();
222 
223  void setInteg(RegInteg integ) {
224  integ_ = integ;
225  }
226 
227  inline ArrayMap* arrayMap() {
228  return arrayMap_;
229  }
230 
231  RegMapBlock* block();
232 
233  std::string blockName();
234  std::string boardName();
235  std::string regMapName();
236 
240  void begin();
241 
245  bool isEnd();
246 
250  const RegDescription& operator++();
251 
256  unsigned currentSlot();
257 
261  unsigned currentElement();
262 
266  Coord currentCoord();
267 
268  // True if the selected range of elements in this descriptor
269  // contains the range in the passed descriptor
270 
271  bool contains(RegDescription& desc);
272 
273  inline long oldestVisible() {
274  return oldestVisible_;
275  }
276 
277  inline bool isFirst() {
278  return first_;
279  }
280 
281  void setFirst(bool first);
282  void setOldestVisible(long oldest);
283  void resetOldestVisible();
284  void decreaseOldestVisible(long oldest);
285  void increaseOldestVisible(long oldest);
286 
287  CoordAxes axes_; // An axis specifier for this register
288 
289  private:
290 
291  friend class RegParser;
292 
293  // A static array map used by all objects of this type
294 
295  ArrayMapBase arrayMapBase_;
296  ArrayMap* arrayMap_;
297 
298  // Per-object members
299 
300  bool archivedOnly_; // True if this class is to manage only
301  // archived registers
302 
303  RegOutputMode outputMode_; // A specification for how this
304  // register description should be
305  // written on output
306 
307  int iRegMap_; // The index of the specified register map
308  // in the array map
309 
310  int iBoard_; // The index of the specified board in the
311  // register-map
312 
313  int iBlock_; // The index of the specified block on the
314  // regmap board
315 
316  int iSlot_; // The frame index of the first element of
317  // this register. NB: This is the frame
318  // offset of the _first_ element of this
319  // register, and not the offset of the
320  // first requested element (i.e., of
321  // range_.startCoord())
322 
323  unsigned nEl_; // The total number of elements requested
324 
325  unsigned size_; // The number of slots per register. This
326  // is 1 unless aspect!=REG_PLAIN, in which
327  // case it becomes 2
328  RegAspect aspect_; // The quantity to derive from complex or
329  // utc register pairs
330 
331  RegInteg integ_; // Integration status of this register
332 
333  int iByte_; // The byte index into the array map of the
334  // first element of the requested
335  // register. NB: This is the offset of the
336  // _first_ element of this register, and
337  // not the offset of the first requested
338  // element (i.e., of range_.startCoord())
339 
340  unsigned nBytePerEl_;// The number of bytes per element of this
341  // register
342 
343  CoordRange range_; // An index-range specifier
344 
345  RegAxisRange* axisRange_; // An axis-range for iterating
346 
347  // This is just a utility member for use in plotting interface.
348 
349  long oldestVisible_;
350  bool first_;
351 
352  }; // End class RegDescription
353 
354  } // End namespace util
355 } // End namespace gcp
356 
357 
358 
359 
360 #endif // End #ifndef GCP_UTIL_REGDESCRIPTION_H
void begin()
Definition: RegDescription.cc:634
RegMapBlock * block()
Definition: RegDescription.cc:585
Definition: CoordAxes.h:25
int startSlot(CoordRange *range=0)
Definition: RegDescription.cc:491
Coord currentCoord()
Definition: RegDescription.cc:539
std::vector< Range< unsigned > > getSlotRanges(CoordRange *range=0)
Definition: RegDescription.cc:416
CoordAxes axes()
Definition: RegDescription.h:148
void setOutputMode(RegOutputMode mode)
Definition: RegDescription.cc:380
const RegDescription & operator++()
Definition: RegDescription.cc:650
Definition: arraymap.h:63
Definition: Coord.h:21
CoordRange * getRangePtr()
Definition: RegDescription.h:141
void reset()
Definition: RegDescription.cc:169
Definition: CoordRange.h:20
ArrRegMap * regMap()
Definition: RegDescription.cc:573
int stopSlot(CoordRange *range=0)
Definition: RegDescription.cc:502
unsigned currentElement()
Definition: RegDescription.cc:666
std::string blockName()
Definition: RegDescription.cc:596
void clear()
Definition: RegDescription.cc:112
RegDescription & operator=(RegDescription &desc)
Definition: RegDescription.cc:124
void setCoord(Coord &coord)
Definition: RegDescription.cc:547
std::vector< Range< unsigned > > getElementRanges(CoordRange *range=0)
Definition: RegDescription.cc:407
void initialize()
Definition: RegDescription.cc:87
unsigned nEl(CoordRange *range=0)
Definition: RegDescription.cc:474
unsigned nByte(CoordRange *range=0)
Definition: RegDescription.cc:465
void output(OutputStream *stream, RegOutputMode mode)
Definition: RegDescription.cc:388
std::string regMapName()
Definition: RegDescription.cc:623
std::vector< Range< unsigned > > getByteRanges(CoordRange *range=0)
Definition: RegDescription.cc:433
unsigned currentSlot()
Definition: RegDescription.cc:658
bool isEnd()
Definition: RegDescription.cc:642
virtual ~RegDescription()
Definition: RegDescription.cc:161
Definition: RegDescription.h:26
Definition: output.h:40
unsigned fastestNel()
Definition: RegDescription.cc:705
unsigned nSlot(CoordRange *range=0)
Definition: RegDescription.cc:483
std::string boardName()
Definition: RegDescription.cc:612
RegDescription(bool archivedOnly_=false, ArrayMap *arrayMap=0)
Definition: RegDescription.cc:29
void setTo(std::string regmap_name, std::string board_name, std::string block_name, RegAspect aspect, RegInteg integ, Coord *coord=0, unsigned n=0)
Definition: arraymap.h:177
int iSlot()
Definition: RegDescription.h:186
CoordRange range()
Definition: RegDescription.h:134
bool rangeIsValid(CoordRange &range)
Definition: RegDescription.cc:513