3 #ifndef __RAW_VALUE_H__
4 #define __RAW_VALUE_H__
11 #include <db_access.h>
14 #include "tools/NoCopy.h"
15 #include "tools/MemoryBuffer.h"
18 #include "storage/StorageTypes.h"
33 ARCH_BASE_MASK = 0x0007,
34 ARCH_EST_REPEAT = 0x0f80,
35 ARCH_DISCONNECT = 0x0f40,
36 ARCH_STOPPED = 0x0f20,
38 ARCH_DISABLED = 0x0f08
55 typedef dbr_time_double
Data;
71 {
return memcmp(lhs, rhs,
getSize(type, count)) == 0; }
78 size_t size,
const Data *lhs,
const Data *rhs);
86 { memcpy(lhs, rhs,
getSize(type, count)); }
90 {
return value->status; }
94 {
return value->severity; }
97 static void getStatus(
const Data* value, std::string& status);
103 short s = value->severity;
104 return s==ARCH_DISCONNECT || s==ARCH_STOPPED || s==ARCH_DISABLED;
117 value->status = status;
118 value->severity = severity;
122 static bool parseStatus(
const std::string& text,
short& stat,
short& sevr);
126 {
return epicsTime(value->stamp); }
129 static void getTime(
const Data* value, std::string& time);
133 { value->stamp = (epicsTimeStamp)stamp; }
141 const Data* value,
double& d,
int i=0);
149 const Data *value,
long &l,
int i=0);
157 Data *value,
double d);
170 char *buffer,
size_t max_len);
193 static void show(FILE *file,
236 operator bool ()
const
~RawValueAutoPtr()
Destructor deletes owned pointer.
Definition: RawValue.h:216
RawValueSpecialSeverities
Non-CA events to the archiver; some are archived - some are directives.
Definition: RawValue.h:31
unsigned short DbrType
DbrType is used to hold dbr_time_xxx types.
Definition: RawValue.h:24
static bool getDouble(DbrType type, DbrCount count, const Data *value, double &d, int i=0)
Get data as a double or return false.
Exponential notation.
Definition: RawValue.h:165
Meta-information for values: Units, limits, etc .
Definition: CtrlInfo.h:75
RawValue::Data * operator->() const
Allow access just like ordinary pointer.
Definition: RawValue.h:248
NumberFormat
Used by getValueString.
Definition: RawValue.h:160
RawValue::Data * release()
Release ownership.
Definition: RawValue.h:268
void assign(RawValue::Data *new_ptr)
Assign a new pointer, deleting existing one.
Definition: RawValue.h:260
static short getStat(const Data *value)
Get status.
Definition: RawValue.h:89
static void setStatus(Data *value, short status, short severity)
Set status and severity.
Definition: RawValue.h:115
Decimal or exponential, "%g" format.
Definition: RawValue.h:162
static void setTime(Data *value, const epicsTime &stamp)
Set time stamp.
Definition: RawValue.h:132
Exponential 0.000e000 with exponent = 3*N.
Definition: RawValue.h:164
static size_t formatDouble(double number, NumberFormat format, int prec, char *buffer, size_t max_len)
Concert value to buffer.
static short getSevr(const Data *value)
Get severity.
Definition: RawValue.h:93
Helper class for raw dbr_time_xxx values.
Definition: RawValue.h:49
unsigned short DbrCount
DbrCount is used to hold the array size of CA channels.
Definition: RawValue.h:27
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.
static void show(FILE *file, DbrType type, DbrCount count, const Data *value, const class CtrlInfo *info=0)
Display value, using CtrlInfo if available.
RawValueAutoPtr & operator=(RawValueAutoPtr &rhs)
Copying from other AutoPtr causes rhs to release ownership.
Definition: RawValue.h:222
static void copy(DbrType type, DbrCount count, Data *lhs, const Data *rhs)
Full copy (stat, time, value). Only valid for Values of same type.
Definition: RawValue.h:85
static bool isAboveZero(DbrType type, const Data *value)
Check the value to see if it's above zero.
static bool isInfo(const Data *value)
Does the severity represent one of the special ARCH_xxx values that does not carry any value...
Definition: RawValue.h:101
static size_t getSize(DbrType type, DbrCount count)
Calculate size of a single value of type/count.
RawValueAutoPtr(RawValue::Data *in)
Assign pointer to AutoPtr.
Definition: RawValue.h:207
static const epicsTime getTime(const Data *value)
Get time stamp.
Definition: RawValue.h:125
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()).
static void toString(std::string &text, DbrType type, DbrCount count, const Data *value, const class CtrlInfo *info=0)
Convert current value to string.
RawValue::Data & operator*() const
Allow access just like ordinary pointer.
Definition: RawValue.h:242
static bool parseStatus(const std::string &text, short &stat, short &sevr)
Parse stat/sevr from text.
RawValueAutoPtr(RawValueAutoPtr &rhs)
Copying from other AutoPtr causes rhs to release ownership.
Definition: RawValue.h:210
static Data * allocate(DbrType type, DbrCount count, size_t num)
Allocate space (via calloc) for num samples of type/count.
static bool setDouble(DbrType type, DbrCount count, Data *value, double d)
Set data from a double or return false.
static bool getLong(DbrType type, DbrCount count, const Data *value, long &l, int i=0)
Get data as a long or return false.
static bool equal(DbrType type, DbrCount count, const Data *lhs, const Data *rhs)
Are two values equal?
Definition: RawValue.h:69
static void getStatus(const Data *value, std::string &status)
Get status/severity as string.
dbr_time_double Data
Type for accessing the raw data and its common fields.
Definition: RawValue.h:55
Decimal notation, 0.000.
Definition: RawValue.h:163
AutoPtr for RawValue.
Definition: RawValue.h:201
static void free(Data *value)
Free space for num samples of type/count.