23 #ifndef _das_encoding_h_
24 #define _das_encoding_h_
42 #define DAS2DT_BE_REAL 0x0001
45 #define DAS2DT_LE_REAL 0x0002
47 #ifdef HOST_IS_LSB_FIRST
48 #define DAS2DT_HOST_REAL 0x0002
50 #define DAS2DT_HOST_REAL 0x0001
58 #define DAS2DT_ASCII 0x0003
65 #define DAS2DT_TIME 0x0004
68 #define DAS2DT_BE_INT 0x0005
71 #define DAS2DT_LE_INT 0x0006
74 #define DAS2DT_BE_UINT 0x0007
77 #define DAS2DT_LE_UINT 0x0008
79 #define DASENC_FMT_LEN 64
80 #define DASENC_TYPE_LEN 48
108 typedef struct das_encoding{
133 char sFmt[DASENC_FMT_LEN];
140 char sType[DASENC_TYPE_LEN];
275 #define DAS2DT_BE_REAL_8 0x0801
278 #define DAS2DT_LE_REAL_8 0x0802
281 #ifdef HOST_IS_LSB_FIRST
282 #define DAS2DT_DOUBLE 0x0802
284 #define DAS2DT_DOUBLE 0x0801
288 #define DAS2DT_BE_REAL_4 0x0401
291 #define DAS2DT_LE_REAL_4 0x0402
295 #ifdef HOST_IS_LSB_FIRST
296 #define DAS2DT_FLOAT 0x0402
298 #define DAS2DT_FLOAT 0x0401
302 #define DAS2DT_ASCII_10 0x0A03
303 #define DAS2DT_ASCII_24 0x1804
304 #define DAS2DT_ASCII_14 0x0E04
306 #define DAS2DT_TIME_25 0x1904
307 #define DAS2DT_TIME_28 0x1c04
int DasErrCode
return code type 0 indicates success, negative integer indicates failure
Definition: util.h:117
void DasEnc_setTimeFormat(DasEncoding *pThis, const char *sTimeFmt, int nFmtWidth)
Set the output format to be used when converting binary time values to to ASCII strings.
Little buffer class to handle accumulating string data.
Definition: buffer.h:49
void DasEnc_setAsciiFormat(DasEncoding *pThis, const char *sValFmt, int nFmtWidth)
Set the output format to be used when converting interal binary values to ASCII strings.
DasErrCode DasEnc_read(const DasEncoding *pThis, DasBuf *pBuf, das_units units, double *pOut)
Read and Decode a value from a string.
unsigned int nCat
The basic encoding category.
Definition: encoding.h:119
DasEncoding * new_DasEncoding_str(const char *sType)
Create a new encoding based on the encoding type string.
Reading and writing values on das2 streams.
Definition: encoding.h:108
bool DasEnc_equals(const DasEncoding *pOne, const DasEncoding *pTwo)
Check for equality between two encodings.
DasEncoding * new_DasEncoding(int nCat, int nWidth, const char *sFmt)
Make a new data encoder/decoder.
DasErrCode DasEnc_toStr(DasEncoding *pThis, char *sType, size_t nLen)
Get a string representation of the data type.
Defines units used for items in the stream, most notably time units that reference an epoch and a ste...
DasEncoding * DasEnc_copy(DasEncoding *pThis)
Deepcopy a DasEncoding pointer.
Utility to assist with encode and decode operations.
double getDas2Fill(void)
An inconvenient way to get canonical fill value, -1e31.
unsigned int DasEnc_hash(const DasEncoding *pThis)
Get a hash value suitable for use in switch statements.
DasErrCode DasEnc_write(DasEncoding *pThis, DasBuf *pBuf, double value, das_units units)
Encode and write a value onto a string.
unsigned int nWidth
The width in bytes of the encoded values.
Definition: encoding.h:126
const char * das_units
Enumeration of unit types, that correspond to physical unit types.
Definition: units.h:135
int isDas2Fill(double value)
An inconvenient way to check for the canonical fill value, -1e31.