EPICS ARCHIVER V4
|
Helper class for raw dbr_time_xxx values. More...
#include <RawValue.h>
Public Types | |
enum | NumberFormat { DEFAULT, DECIMAL, ENGINEERING, EXPONENTIAL } |
Used by getValueString. More... | |
typedef dbr_time_double | Data |
Type for accessing the raw data and its common fields. More... | |
Static Public Member Functions | |
static Data * | allocate (DbrType type, DbrCount count, size_t num) |
Allocate space (via calloc) for num samples of type/count. More... | |
static void | free (Data *value) |
Free space for num samples of type/count. | |
static size_t | getSize (DbrType type, DbrCount count) |
Calculate size of a single value of type/count. | |
static bool | equal (DbrType type, DbrCount count, const Data *lhs, const Data *rhs) |
Are two values equal? | |
static bool | hasSameValue (DbrType type, DbrCount count, size_t size, const Data *lhs, const Data *rhs) |
Compare the value part of two RawValues, not the time stamp or status! (for full comparison, use equal()). More... | |
static bool | hasSameValue (DbrType type, DbrCount count, const Data *lhs, const Data *rhs) |
Compare the value part of two RawValues, not the time stamp or status! | |
static void | copy (DbrType type, DbrCount count, Data *lhs, const Data *rhs) |
Full copy (stat, time, value). Only valid for Values of same type. | |
static short | getStat (const Data *value) |
Get status. | |
static short | getSevr (const Data *value) |
Get severity. | |
static void | getStatus (const Data *value, std::string &status) |
Get status/severity as string. | |
static bool | isInfo (const Data *value) |
Does the severity represent one of the special ARCH_xxx values that does not carry any value. | |
static bool | isAboveZero (DbrType type, const Data *value) |
Check the value to see if it's above zero. More... | |
static void | setStatus (Data *value, short status, short severity) |
Set status and severity. | |
static bool | parseStatus (const std::string &text, short &stat, short &sevr) |
Parse stat/sevr from text. | |
static const epicsTime | getTime (const Data *value) |
Get time stamp. | |
static void | getTime (const Data *value, std::string &time) |
Get time stamp as text. | |
static void | setTime (Data *value, const epicsTime &stamp) |
Set time stamp. | |
static bool | getDouble (DbrType type, DbrCount count, const Data *value, double &d, int i=0) |
Get data as a double or return false. More... | |
static bool | getLong (DbrType type, DbrCount count, const Data *value, long &l, int i=0) |
Get data as a long or return false. More... | |
static bool | setDouble (DbrType type, DbrCount count, Data *value, double d) |
Set data from a double or return false. More... | |
static size_t | formatDouble (double number, NumberFormat format, int prec, char *buffer, size_t max_len) |
Concert value to buffer. | |
static void | getValueString (std::string &text, DbrType type, DbrCount count, const Data *value, const class CtrlInfo *info=0, NumberFormat format=DECIMAL, int prec=-1) |
Convert value to txt, using CtrlInfo if available. More... | |
static void | toString (std::string &text, DbrType type, DbrCount count, const Data *value, const class CtrlInfo *info=0) |
Convert current value to string. More... | |
static void | show (FILE *file, DbrType type, DbrCount count, const Data *value, const class CtrlInfo *info=0) |
Display value, using CtrlInfo if available. | |
Helper class for raw dbr_time_xxx values.
This class has all static methods, it always requires a hint for type, count and maybe CtrlInfo to properly handle the underlying value. The class also doesn't hold the actual memory of the value, since that might be in the argument of a CA event callback etc.
typedef dbr_time_double RawValue::Data |
Type for accessing the raw data and its common fields.
(status, severity, time) w/o compiler warnings. Had to pick one of the dbr_time_xxx
Allocate space (via calloc) for num samples of type/count.
GenericException | on memory error. |
|
static |
Get data as a double or return false.
Works for scalar short, int, long, float, double
|
static |
Get data as a long or return false.
Works for scalar enum, short, int, long, float, double
|
static |
Convert value to txt, using CtrlInfo if available.
This gives only the value. Use getTime() and getStatus() for time and status. format picks the format, prec < 0 means: Use precision from CtrlInfo.
|
static |
Compare the value part of two RawValues, not the time stamp or status! (for full comparison, use equal()).
Both lhs, rhs must have the same type.
Check the value to see if it's above zero.
For numerics, that's obvious: value>0. Enums are treated like integers, strings are 'zero' if empty (zero length). Arrays are not really handled, we only consider the first element.
Set data from a double or return false.
Works for scalar short, int, long, float, double
|
static |
Convert current value to string.
Formatted as "<time><tab><value><tab>status" or just "<time><tab><value>" if the status is empty.