versadac  1
versadac - Scalable Recorder Firmware
uhh_seghdr.h
1 /*****************************************************************************
2 FILE : U H H _ S E G H D R . H
3 VERSION : $Id: uhh_seghdr.h 4938 2006-10-10 14:20:18Z martinto $
4 AUTHOR : Dave Storey
5 SYSTEM : Gnu C++
6 DESCRIPTION : UHH segment header class
7 *****************************************************************************/
8 
9 #if !defined __UHH_SEGHDR_H
10 #define __UHH_SEGHDR_H
11 
12 #include "uhh_heap.h"
13 
14 
15 // SEGMENT HEADER
16 
17 // PV Representation byte
18 #define UHH_GROUPHIST_PVREP_VALS_OFFSET 6
19 #define UHH_GROUPHIST_PVREP_TYPE_OFFSET 4
20 #define UHH_GROUPHIST_PVREP_BYTES_MASK 0x0f
21 #define UHH_GROUPHIST_PVREP_TYPE_FLOAT 0
22 #define UHH_GROUPHIST_PVREP_TYPE_DOUBLE 1
23 
24 
25 // 'AB info' - this is stuff required in 'A' + 'B' pairs
26 struct UhhABinfo
27 {
28  double dSpanLo;
29  double dSpanHi;
30  float fZoneLo;
31  float fZoneHi;
32  uint8 uScaleType;
33  uint8 uScaleDivsMajor;
34  uint8 uScaleDivsMinor;
35  uint8 uColour;
36 };
37 
38 
39 // The 'other' point header info, ie the less essential part of it, which
40 // may be omitted in some circumstances in order to save memory.
41 struct UhhPtOther
42 {
43  uc_char *szDescriptor;
44  uc_char *szUnits;
45  uc_char *szActive;
46  uc_char *szInactive;
47  uint8 uPvFormat;
48  uint8 uPvDecPl;
49  uint8 uAlarms; // Number of alarm types
50  uint8 *puAlarmTypes; // Allocated array of alarm types
51  UhhABinfo aAB[2];
52 };
53 
54 
55 // The point header info.
56 struct UhhPtHdr
57 {
58  // NB Order in decreasing alignment size, for efficiency,
59  // as there may be a large number of these.
60 
61  double dPvOffset;
62 
63  UhhPtOther *pOther;
64 
65  uint16 uChanNo;
66 
67  uint8 uPointType;
68  uint8 uChanType;
69 
70  // Remainder are for internal use only
71  uint8 uPvRep;
72  uint8 uPvBytes;
73  uint8 uPvType;
74  uint8 uPvVals;
75 };
76 
77 // The 'other' segment header info, ie the less essential part of it, which
78 // may be omitted in some circumstances in order to save memory.
80 {
81  uc_char *szSwVersion;
82  uint8 uNameProps;
83  uc_char *szInstrument;
84  uc_char *szGroup;
85  uc_char *szBatch;
86  uint8 uTrendUnits;
87  uc_char *szLanguage;
88  uc_char *szCountry;
89  uc_char *szTzId;
90  sint32 nTzOffset;
91  uc_char *szTzDstStart;
92  uc_char *szTzDstEnd;
93  uint8 uTzDstUse;
94  uint8 uGridType;
95  uint8 uGridDivsOrDecades;
96  uint8 uGridDivsMinor;
97  uint8 uGridScaleType;
98  double dGridSpanLo;
99  double dGridSpanHi;
100  float fGridZoneLo;
101  float fGridZoneHi;
102  double dGridSpanLoB;
103  double dGridSpanHiB;
104  float fGridZoneLoB;
105  float fGridZoneHiB;
106 };
107 
108 
109 // The segment header. Although this is primarily a data structure manipulated
110 // by other classes, there are a few methods for the following reasons:
111 // (a) to ensure memory integrity in the case of a failure part way through
112 // reading in the header data from a file;
113 // (b) for cloning;
114 // (c) for other general convenience.
115 
116 class UhhSegHdr : public UhhHeap
117 {
118 public:
119  UhhSegOther *m_pOther;
120  uint16 m_uPoints; // Number of points
121  UhhPtHdr *m_pPoints; // Allocated array of point headers
122  uint16 m_uAlarms;
123  double m_dIntervalA;
124  double m_dIntervalB;
125  UhhSegHdr();
126  UhhSegHdr(UhhSegHdr *z_pToCopy);
127  ~UhhSegHdr();
128  bool setNumPoints(uint16 z_uPoints);
129  void strip();
130 private:
131  static void copyString(uc_char **z_pszToCopy);
132 };
133 
134 
135 #endif
Definition: uhh_seghdr.h:79
Definition: uhh_seghdr.h:56
Definition: uhh_seghdr.h:116
Definition: uhh_seghdr.h:41
Definition: uhh_seghdr.h:26
Definition: uhh_heap.h:31