9 #include "tools/MemoryBuffer.h"
10 #include "storage/StorageTypes.h"
92 {
return ! (*
this == rhs); }
134 void setNumeric(int32_t prec,
const std::string& units,
135 float disp_low,
float disp_high,
136 float low_alarm,
float low_warn,
137 float high_warn,
float high_alarm);
158 void formatDouble(
double value, std::string& result)
const;
164 void getState(
size_t state, std::string& result)
const;
168 bool parseState(
const char *text,
const char **next,
size_t &state)
const;
179 void show(FILE *f)
const;
183 {
return _infobuf.
mem()->
size; }
198 const char *
getState(
size_t state,
size_t &len)
const;
float disp_low
low display range
Definition: CtrlInfo.h:24
uint16_t type
type
Definition: CtrlInfo.h:57
float high_warn
high warning
Definition: CtrlInfo.h:27
size_t getSize() const
Returns size.
Definition: CtrlInfo.h:182
A glorified union of NumericInfo and EnumeratedInfo.
Definition: CtrlInfo.h:53
bool parseState(const char *text, const char **next, size_t &state) const
Like strtod, strtol: try to parse, position 'next' on character following the recognized state text...
Meta-information for values: Units, limits, etc .
Definition: CtrlInfo.h:75
CtrlInfo for numeric values.
Definition: CtrlInfo.h:19
float getDisplayLow() const
Returns display low.
void calcEnumeratedSize()
After allocEnumerated() and a sequence of setEnumeratedString () calls, this method recalcs the total...
Undefined.
Definition: CtrlInfo.h:96
float getHighWarning() const
Returns high warning.
size_t getNumStates() const
Enumerated: state string.
A numeric CtrlInfo: Limits, units, ...
Definition: CtrlInfo.h:97
float getDisplayHigh() const
Returns display high.
int32_t getPrecision() const
Returns precision.
Type
Type defines the type of value.
Definition: CtrlInfo.h:95
char units[1]
actually as long as needed,
Definition: CtrlInfo.h:31
bool operator!=(const CtrlInfo &rhs) const
'Not equal to' operator
Definition: CtrlInfo.h:91
const MemoryBuffer< CtrlInfoData > & getMemoryBuffer() const
Return a const memory buffer.
Definition: CtrlInfo.h:186
bool operator==(const CtrlInfo &rhs) const
'Equal to' operator
void setEnumerated(size_t num_states, char *strings[])
Initialize an Enumerated CtrlInfo.
CtrlInfo & operator=(const CtrlInfo &rhs)
Copy operator.
int32_t prec
display precision
Definition: CtrlInfo.h:30
float disp_high
high display range
Definition: CtrlInfo.h:23
float getLowAlarm() const
Returns low alarm.
void formatDouble(double value, std::string &result) const
Format a double value according to precision
char state_strings[1]
state strings
Definition: CtrlInfo.h:42
void allocEnumerated(size_t num_states, size_t string_len)
Alternative to setEnumerated: Call with total string length, including all the '\0's ! ...
Type getType() const
Get the Type for this CtrlInfo.
const T * mem() const
Access as (T *)
Definition: MemoryBuffer.h:56
void setNumeric(int32_t prec, const std::string &units, float disp_low, float disp_high, float low_alarm, float low_warn, float high_warn, float high_alarm)
Initialize a Numeric CtrlInfo (sets Type to Numeric and then sets fields)
MemoryBuffer< CtrlInfoData > & getMemoryBuffer()
Return a const memory buffer.
Definition: CtrlInfo.h:191
float low_alarm
low alarm
Definition: CtrlInfo.h:26
void setEnumeratedString(size_t state, const char *string)
Must be called after allocEnumerated() AND must be called in sequence, i.e.
int16_t pad
one after the other, separated by '\0'
Definition: CtrlInfo.h:41
float low_warn
low warning
Definition: CtrlInfo.h:25
float high_alarm
high alarm
Definition: CtrlInfo.h:28
uint16_t size
size
Definition: CtrlInfo.h:56
CtrlInfo for enumerated channels.
Definition: CtrlInfo.h:36
const char * getUnits() const
Returns units.
void show(FILE *f) const
Read a CtrlInfo from a binary data file.
float getHighAlarm() const
Returns high alarm.
union CtrlInfoData::@0 value
value
float getLowWarning() const
Returns low warning.
An enumerated CtrlInfo: Strings.
Definition: CtrlInfo.h:98
int16_t num_states
state_strings holds num_states strings
Definition: CtrlInfo.h:40
void getState(size_t state, std::string &result) const
Get given state as text (also handles undefined states)