versadac  1
versadac - Scalable Recorder Firmware
am_pvconf.h
1 /*****************************************************************************
2 FILE : am_pvconf.h
3 VERSION : $Id: am_pvconf.h 4938 2006-10-10 14:20:18Z martinto $
4 AUTHOR : Sandra Herring
5 SYSTEM : GNU C++ for Power PC
6 DESCRIPTION : Header file for PV Configuration classes.
7 *****************************************************************************/
8 
9 #if !defined(__AM_PVCONF_H)
10 #define __AM_PVCONF_H
11 
12 #include <string.h>
13 #include "am.h"
14 
15 
16 enum PVType
17 {
18  PV_ANIN,
19  PV_ANOUT,
20  PV_DIGIN,
21  PV_DIGOUT,
22  PV_DV,
23  PV_TOT,
24  PV_COUNT,
25  PV_TYPE_LIM
26 };
27 
28 // ***************************************************************************
29 // Trend mode A or B configuration
30 // ***************************************************************************
31 
32 class AM_HistoryStream;
33 
35 {
36  public :
37 
38 /*------------------------------------------------------------------------------
39 FUNCTION : AM_TrendModeConfig constructor
40 DESCRIPTION :
41 ARGUMENTS : none.
42 RETURN : N/A
43 NOTES :
44 ------------------------------------------------------------------------------*/
46 
47 /*------------------------------------------------------------------------------
48 FUNCTION : AM_TrendModeConfig::getSpanLow
49 DESCRIPTION : service to return this PV's span low limit.
50 ARGUMENTS : None.
51 RETURN : Span low limit.
52 NOTES :
53 ------------------------------------------------------------------------------*/
54  float getSpanLow();
55 
56 /*------------------------------------------------------------------------------
57 FUNCTION : AM_TrendModeConfig::getSpanHigh
58 DESCRIPTION : service to return this PV's span high limit.
59 ARGUMENTS : None.
60 RETURN : Span high limit.
61 NOTES :
62 ------------------------------------------------------------------------------*/
63  float getSpanHigh();
64 
65 /*------------------------------------------------------------------------------
66 FUNCTION : AM_TrendModeConfig::read
67 DESCRIPTION : Service to read in this object's data values
68  from current position in archive file.
69 ARGUMENTS : stream : pointer to open file stream.
70 RETURN : TRUE if data read in successfully, otherwise FALSE.
71 NOTES :
72 ------------------------------------------------------------------------------*/
73  sint32 read( AM_HistoryStream & stream );
74 
75  private :
76  float m_SpanLow;
77  float m_SpanHigh;
78 
79  float m_ZoneLow;
80  float m_ZoneHigh;
81 
82  uint8 m_ScaleType;
83  uint8 m_ScaleIndex;
84  uint8 m_Colour;
85 
86 }; // AM_TrendModeConfig
87 
88 
89 // ***************************************
90 // inline services for PV trend mode class
91 // ***************************************
92 
93 /*------------------------------------------------------------------------------
94 FUNCTION : AM_TrendModeConfig::getSpanLow
95 DESCRIPTION : service to return this PV's span low limit.
96 ARGUMENTS : None.
97 RETURN : Span low limit.
98 NOTES :
99 ------------------------------------------------------------------------------*/
100 inline float AM_TrendModeConfig::getSpanLow()
101 {
102  return m_SpanLow; // DPDR 11248
103 }
104 
105 /*------------------------------------------------------------------------------
106 FUNCTION : AM_TrendModeConfig::getSpanHigh
107 DESCRIPTION : service to return this PV's span high limit.
108 ARGUMENTS : None.
109 RETURN : Span high limit.
110 NOTES :
111 ------------------------------------------------------------------------------*/
112 inline float AM_TrendModeConfig::getSpanHigh()
113 {
114  return m_SpanHigh;
115 }
116 
117 
118 // ***************************************************************************
119 // Trend configuration
120 // ***************************************************************************
121 
123 {
124  public :
125 
126  AM_TrendModeConfig m_Mode[2]; // config. for modes A and B;
127  // set to default values if
128  // PV not trendable.
129 }; // AM_TrendConfig
130 
131 
132 // ***************************************************************************
133 // PV configuration base class
134 // ***************************************************************************
135 
136 #define PV_NUMBER_UNKNOWN 0x7FFF
137 
139 {
140  public :
141 
142 /*------------------------------------------------------------------------------
143 FUNCTION : AM_PVConfigRecord constructor #1
144 DESCRIPTION :
145 ARGUMENTS : None.
146 RETURN : N/A
147 NOTES :
148 ------------------------------------------------------------------------------*/
149 // AM_PVConfigRecord();
150 
151 /*------------------------------------------------------------------------------
152 FUNCTION : AM_PVConfigRecord constructor #2
153 DESCRIPTION :
154 ARGUMENTS : pvType : type of PV
155  dataType : type of value returned for this PV
156 RETURN : N/A
157 NOTES :
158 ------------------------------------------------------------------------------*/
159  AM_PVConfigRecord( PVType pvType,
160  uint8 dataType );
161 
162 /*------------------------------------------------------------------------------
163 FUNCTION : AM_PVConfigRecord destructor
164 DESCRIPTION :
165 ARGUMENTS :
166 RETURN : N/A
167 NOTES :
168 ------------------------------------------------------------------------------*/
169  virtual ~AM_PVConfigRecord();
170 
171  // non-virtual services
172 
173  public :
174 
175 /*------------------------------------------------------------------------------
176 FUNCTION : AM_PVConfigRecord::getDataType
177 DESCRIPTION : service to return this PV's value type.
178 ARGUMENTS : None.
179 RETURN : Type of value storage.
180 NOTES :
181 ------------------------------------------------------------------------------*/
182  uint8 getDataType();
183 
184 /*------------------------------------------------------------------------------
185 FUNCTION : AM_PVConfigRecord::descriptor
186 DESCRIPTION : service to return this PV's descriptor.
187 ARGUMENTS : None.
188 RETURN : Pointer to descriptor.
189 NOTES : Contents of returned address must not be modified by caller.
190 ------------------------------------------------------------------------------*/
191  const char * getDescriptor();
192 
193 /*------------------------------------------------------------------------------
194 FUNCTION : AM_PVConfigRecord::format
195 DESCRIPTION : service to return this PV's value format.
196 ARGUMENTS : None.
197 RETURN : Value display format.
198 NOTES :
199 ------------------------------------------------------------------------------*/
200  uint8 getFormat();
201 
202 /*------------------------------------------------------------------------------
203 FUNCTION : AM_PVConfigRecord::getDecimalDigits
204 DESCRIPTION : service to return maximum converted length for this PV.
205 ARGUMENTS : None.
206 RETURN : Number of digits.
207 NOTES :
208 ------------------------------------------------------------------------------*/
209  uint8 getDecimalDigits();
210 
211 /*------------------------------------------------------------------------------
212 FUNCTION : AM_PVConfigRecord::getFractionalDigits
213 DESCRIPTION : service to return number of decimal places for this PV.
214 ARGUMENTS : None.
215 RETURN : Number of places.
216 NOTES :
217 ------------------------------------------------------------------------------*/
218  uint8 getFractionalDigits();
219 
220 /*---------------------------------------------------------------------------
221 FUNCTION : AM_PVConfigRecord::isMinMaxRecording
222 DESCRIPTION : Indicates whether this chan uses min/max recording
223 ARGUMENTS :
224 RETURN : TRUE or FALSE
225 NOTES :
226 ---------------------------------------------------------------------------*/
227  bool isMinMaxRecording();
228 
229 /*---------------------------------------------------------------------------
230 FUNCTION : AM_PVConfigRecord::getUnits
231 DESCRIPTION : Returns units string for this PV.
232 ARGUMENTS :
233 RETURN : Units
234 NOTES :
235 ---------------------------------------------------------------------------*/
236  const char * getUnits();
237 
238 /*------------------------------------------------------------------------------
239 FUNCTION : AM_PVConfigRecord::getNumBytes
240 DESCRIPTION : service to return number of bytes in data record
241 ARGUMENTS : None.
242 RETURN : num bytes
243 NOTES :
244 ------------------------------------------------------------------------------*/
245  uint16 getNumBytes();
246 
247 /*------------------------------------------------------------------------------
248 FUNCTION : AM_PVConfigRecord::isPvDouble
249 DESCRIPTION : service to return whether pv is a double or a float
250 ARGUMENTS : None.
251 RETURN : TRUE if double
252 NOTES :
253 ------------------------------------------------------------------------------*/
254  bool isPvDouble();
255 
256 /*------------------------------------------------------------------------------
257 FUNCTION : AM_PVConfigRecord::getOffset
258 DESCRIPTION : service to return value to subtract from value in file
259 ARGUMENTS : None.
260 RETURN : Value
261 NOTES :
262 ------------------------------------------------------------------------------*/
263  double getOffset();
264 
265 /*------------------------------------------------------------------------------
266 FUNCTION : AM_PVConfigRecord::getInstance
267 DESCRIPTION : service to return this PV's number.
268 ARGUMENTS : None.
269 RETURN : Zero-based index of this type of PV.
270  Returns PV_NUMBER_UNKNOWN if configuration
271  has not been obtained.
272 NOTES :
273 ------------------------------------------------------------------------------*/
274  uint16 getInstance();
275 
276 /*------------------------------------------------------------------------------
277 FUNCTION : AM_PVConfigRecord::getPvType
278 DESCRIPTION : service to return this PV's type.
279 ARGUMENTS : None.
280 RETURN : PV type.
281 NOTES :
282 ------------------------------------------------------------------------------*/
283  PVType getPvType();
284 
285 /*------------------------------------------------------------------------------
286 FUNCTION : AM_PVConfigRecord::getActiveString
287 DESCRIPTION : service to return this PV's active string.
288 ARGUMENTS : None.
289 RETURN : Pointer to active string.
290 NOTES :
291 ------------------------------------------------------------------------------*/
292  const char * getActiveString();
293 
294 /*------------------------------------------------------------------------------
295 FUNCTION : AM_PVConfigRecord::getInactiveString
296 DESCRIPTION : service to return this PV's inactive string.
297 ARGUMENTS : None.
298 RETURN : Pointer to inactive string.
299 NOTES :
300 ------------------------------------------------------------------------------*/
301  const char * getInactiveString();
302 
303  // attributes
304 
305  public :
306  AM_TrendConfig m_TrendConfig; // config. for modes A and B;
307 
308  protected :
309  char m_Descriptor[31];
310  uint8 m_DataType;
311  PVType m_PVType;
312  uint16 m_Instance;
313  char m_Units[9];
314  uint8 m_PVFormat;
315  uint8 m_DecimalDigits;
316  uint8 m_FractionalDigits;
317  char m_ActiveString[9];
318  char m_InactiveString[9];
319 
320  // the following items for uhh files only
321  uint16 m_uhhBytes; // number of bytes in value in file
322  bool m_bPvDouble; // true if pv in file is double
323  double m_Offset; // offset to be subtracted from file value
324  bool m_bMinMaxRecording; // indicates whether min/max or not
325 
326 }; // class AM_PVConfigRecord
327 
328 
329 // ***********************************************
330 // inline services for PV configuration base class
331 // ***********************************************
332 
333 /*------------------------------------------------------------------------------
334 FUNCTION : AM_PVConfigRecord destructor
335 ------------------------------------------------------------------------------*/
336 inline AM_PVConfigRecord::~AM_PVConfigRecord()
337 {}
338 
339 /*------------------------------------------------------------------------------
340 FUNCTION : AM_PVConfigRecord::getDataType
341 DESCRIPTION : service to return this PV's value type.
342 ARGUMENTS : None.
343 RETURN : Type of value storage.
344 NOTES :
345 ------------------------------------------------------------------------------*/
346 inline uint8 AM_PVConfigRecord::getDataType()
347 {
348  return m_DataType;
349 }
350 
351 
352 /*------------------------------------------------------------------------------
353 FUNCTION : AM_PVConfigRecord::getDescriptor
354 DESCRIPTION : service to return this PV's descriptor.
355 ARGUMENTS : None.
356 RETURN : Pointer to descriptor.
357 NOTES : Contents of returned address must not be modified by caller.
358 ------------------------------------------------------------------------------*/
359 inline const char * AM_PVConfigRecord::getDescriptor()
360 {
361  return m_Descriptor;
362 }
363 
364 /*---------------------------------------------------------------------------
365 FUNCTION : AM_PVConfigRecord::isMinMaxRecording
366 DESCRIPTION : Indicates whether this chan uses min/max recording
367 ARGUMENTS :
368 RETURN : TRUE or FALSE
369 NOTES :
370 ---------------------------------------------------------------------------*/
371 inline bool AM_PVConfigRecord::isMinMaxRecording()
372 {
373  return m_bMinMaxRecording;
374 }
375 
376 /*------------------------------------------------------------------------------
377 FUNCTION : AM_PVConfigRecord::getNumBytes
378 DESCRIPTION : service to return number of bytes in data record
379 ARGUMENTS : None.
380 RETURN : num bytes
381 NOTES :
382 ------------------------------------------------------------------------------*/
383 inline uint16 AM_PVConfigRecord::getNumBytes()
384 {
385  return m_uhhBytes;
386 }
387 
388 /*------------------------------------------------------------------------------
389 FUNCTION : AM_PVConfigRecord::isPvDouble
390 DESCRIPTION : service to return whether pv is a double or a float
391 ARGUMENTS : None.
392 RETURN : TRUE if double
393 NOTES :
394 ------------------------------------------------------------------------------*/
395 inline bool AM_PVConfigRecord::isPvDouble()
396 {
397  return m_bPvDouble;
398 }
399 
400 /*------------------------------------------------------------------------------
401 FUNCTION : AM_PVConfigRecord::getOffset
402 DESCRIPTION : service to return value to subtract from value in file
403 ARGUMENTS : None.
404 RETURN : Value
405 NOTES :
406 ------------------------------------------------------------------------------*/
407 inline double AM_PVConfigRecord::getOffset()
408 {
409  return m_Offset;
410 }
411 
412 /*------------------------------------------------------------------------------
413 FUNCTION : AM_PVConfigRecord::getFormat
414 DESCRIPTION : service to return this PV's value format.
415 ARGUMENTS : None.
416 RETURN : Value display format.
417 NOTES :
418 ------------------------------------------------------------------------------*/
419 inline uint8 AM_PVConfigRecord::getFormat()
420 {
421  return m_PVFormat;
422 }
423 
424 /*------------------------------------------------------------------------------
425 FUNCTION : AM_PVConfigRecord::getDecimalDigits
426 DESCRIPTION : service to return maximum converted length for this PV.
427 ARGUMENTS : None.
428 RETURN : Number of digits.
429 NOTES :
430 ------------------------------------------------------------------------------*/
431 inline uint8 AM_PVConfigRecord::getDecimalDigits()
432 {
433  return m_DecimalDigits;
434 }
435 
436 /*------------------------------------------------------------------------------
437 FUNCTION : AM_PVConfigRecord::getFractionalDigits
438 DESCRIPTION : service to return number of decimal places for this PV.
439 ARGUMENTS : None.
440 RETURN : Number of places.
441 NOTES :
442 ------------------------------------------------------------------------------*/
443 inline uint8 AM_PVConfigRecord::getFractionalDigits()
444 {
445  return m_FractionalDigits;
446 }
447 
448 /*------------------------------------------------------------------------------
449 FUNCTION : AM_PVConfigRecord::getInstance
450 DESCRIPTION : service to return this PV's number.
451 ARGUMENTS : None.
452 RETURN : Zero-based index of this type of PV.
453  Returns PV_NUMBER_UNKNOWN if PV's configuration
454  has not been obtained.
455 NOTES :
456 ------------------------------------------------------------------------------*/
457 inline uint16 AM_PVConfigRecord::getInstance()
458 {
459  return m_Instance;
460 }
461 
462 
463 /*------------------------------------------------------------------------------
464 FUNCTION : AM_PVConfigRecord::getPvType
465 DESCRIPTION : service to return this PV's type.
466 ARGUMENTS : None.
467 RETURN : PV type.
468 NOTES :
469 ------------------------------------------------------------------------------*/
470 inline PVType AM_PVConfigRecord::getPvType()
471 {
472  return m_PVType;
473 }
474 
475 /*---------------------------------------------------------------------------
476 FUNCTION : AM_PVConfigRecord::getUnits
477 DESCRIPTION : Returns units string for this PV.
478 ARGUMENTS :
479 RETURN : Units
480 NOTES :
481 ---------------------------------------------------------------------------*/
482 inline const char * AM_PVConfigRecord::getUnits()
483 {
484  return m_Units;
485 }
486 
487 /*------------------------------------------------------------------------------
488 FUNCTION : AM_PVConfigRecord::getActiveString
489 DESCRIPTION : service to return this PV's active string.
490 ARGUMENTS : None.
491 RETURN : Pointer to active string.
492 NOTES :
493 ------------------------------------------------------------------------------*/
494 inline const char * AM_PVConfigRecord::getActiveString()
495 {
496  return m_ActiveString;
497 }
498 
499 /*------------------------------------------------------------------------------
500 FUNCTION : AM_PVConfigRecord::getInactiveString
501 DESCRIPTION : service to return this PV's inactive string.
502 ARGUMENTS : None.
503 RETURN : Pointer to inactive string.
504 NOTES :
505 ------------------------------------------------------------------------------*/
506 inline const char * AM_PVConfigRecord::getInactiveString()
507 {
508  return m_InactiveString;
509 }
510 
511 #endif // end of __AM_PVCONF_H conditional include
512 
Definition: am_pvconf.h:34
Definition: am_historystream.h:23
Definition: am_pvconf.h:122
Definition: am_pvconf.h:138