37#define DAS_FILL_VALUE -1e31
40#define DAS_INT64_FILL -0x7FFFFFFFFFFFFFFFL
41#define DAS_INT32_FILL -0x7FFFFFFF
48typedef struct das_byte_seq_t{
53typedef struct das_const_byte_seq_t{
59#define DAS_BS_NULL ((das_byte_seq){NULL, 0})
60#define DAS_CBS_NULL ((das_cbyte_seq){NULL, 0})
63#define VT_MIN_SIMPLE vtUByte
64#define VT_MAX_SIMPLE vtTime
70#define VT_MIN_LOCAL vtUByte
71#define VT_MAX_LOCAL vtIndex
81typedef enum das_val_type_e {
174typedef enum das_elem_type_e {
191DAS_API
bool das_elem_asDouble(das_elem_type et,
const ubyte* p,
double* pOut);
204extern const char* DAS_ENC_UBYTE;
205extern const char* DAS_ENC_BEINT;
206extern const char* DAS_ENC_BEUINT;
207extern const char* DAS_ENC_BEREAL;
208extern const char* DAS_ENC_LEINT;
209extern const char* DAS_ENC_LEUINT;
210extern const char* DAS_ENC_LEREAL;
211extern const char* DAS_ENC_UTF8;
212extern const char* DAS_ENC_BLOB;
213extern const char* DAS_ENC_BASE64;
239extern const char* DAS_SEM_BOOL;
240extern const char* DAS_SEM_DATE;
241extern const char* DAS_SEM_INT;
242extern const char* DAS_SEM_REAL;
243extern const char* DAS_SEM_TEXT;
312 const char* sEncType,
int nItemBytes,
const char* sInterp
323#define das_vt_isint(VT) ( VT >= vtUByte && VT <= vtLong )
328#define das_vt_isreal(VT) ( VT == vtFloat || VT == vtDouble )
335#define das_vt_rank(VT) ( ((VT==vtText)||(VT==vtByteSeq)) ? 1:0)
393#define das_vt_cmpAny das_value_cmpAny
427#define DAS_VAL_NOERR_RNG 0x1
428#define DAS_VAL_ERR_RESLOSS 0x2
452 das_val_type vtIn,
const ubyte* pValIn,
const ubyte* pFillIn,
453 das_val_type vtOut, ubyte* pValOut,
const ubyte* pFillOut,
523 das_val_type vt, ubyte* pAccum,
const ubyte* pStep, ptrdiff_t nCount
544 char* sBuf,
int nBufLen,
das_val_type vt,
const char* sSemantic,
int nFitTo
563 ubyte* pBuf,
int uBufLen,
das_val_type vt,
const char* sStr
695DAS_API
char*
das_doubles2csv(
char* pBuf,
size_t uBufSz,
const double* pValues,
int nValues);
699DAS_API
char*
das_floats2csv(
char* pBuf,
size_t uBufSz,
const float* pValues,
int nValues);
int DasErrCode
return code type 0 indicates success, negative integer indicates failure
Definition defs.h:184
const char * das_sem_default(das_val_type vt, das_units units)
Suggest a default semantic for a (value type, units) pair.
const char * das_units
Handle SI and other units, with accommodations for Epoch systems, from units.h.
Definition units.h:144
const char * das_sem_fromStr(const char *sSemantic)
Resolve a semantic string to its canonical schema value.
const char * DAS_ENC_BYTE
The canonical wire-encoding vocabulary: the closed set that IS the schema's EncodingType pattern (das...
das_val_type das_vt_default(const char *sSemantic)
Given a semantic meaning, suggest a default value type.
const char * das_enc_fromStr(const char *sEncType)
Resolve a wire-encoding string to its canonical schema value.
das_val_type
Enumeration of types stored in Das Array (DasAry) objects from value.h.
Definition value.h:81
const char * DAS_SEM_BLOB
The canonical value-semantic vocabulary: the closed set that IS the schema's Semantic pattern (das-ba...
@ vtByte
Indicates array values are signed 8-bit integers (signed bytes)
Definition value.h:95
@ vtShort
Indicates array values are signed 16-bit integers (shorts)
Definition value.h:101
@ vtULong
Indicates array values are unsigned 64-bit unsigned integers (ulongs)
Definition value.h:110
@ vtFloat
Indicates array values are 32-bit floating point values (floats)
Definition value.h:116
@ vtInt
Indicates array values are signed 32-bit integers (ints)
Definition value.h:107
@ vtComposite
These values are run of simple elements plus the DasForm that says what they mean: a rotation,...
Definition value.h:161
@ vtUInt
Indicates array values are unsigned 32-bit integers (uints)
Definition value.h:104
@ vtLong
Indicates array values are unsigned 64-bit integers (longs)
Definition value.h:113
@ vtText
Indicates datum values are const char* pointers to null terminated UTF-8 strings.
Definition value.h:147
@ vtUByte
The basic types.
Definition value.h:92
@ vtUShort
Indicates array values are unsigned 16-bit integers (shorts)
Definition value.h:98
@ vtUnknown
For generic storage, designates elements as unknown, you have to cast the array return values yoursel...
Definition value.h:85
@ vtTime
Indicates array values are das_time_t structures.
Definition value.h:122
@ vtByteSeq
Values are a picture element, possibly in multiple planes.
Definition value.h:154
@ vtDouble
Indicates array values are 64-bit floating point values (doubles)
Definition value.h:119
Defines units used for items in the stream, most notably time units that reference an epoch and a ste...
DAS_API bool das_str2bool(const char *str, bool *pRes)
Convert a string value to a boolean value.
DAS_API DasErrCode das_value_fmt(char *sBuf, int nBufLen, das_val_type vt, const char *sSemantic, int nFitTo)
Generate a printf style format code for a value type, usage and buffer size.
DAS_API char * das_doubles2csv(char *pBuf, size_t uBufSz, const double *pValues, int nValues)
Print an array of doubles into a string buffer.
int(* das_valcmp_func)(const ubyte *, const ubyte *)
Comparison functions look like this.
Definition value.h:368
DAS_API bool das_str2double(const char *str, double *pRes)
Convert a string value to a 8-byte float, similar to strtod(3).
DAS_API bool das_str2baseint(const char *str, int base, int *pRes)
Convert a string to an integer with explicit base and overflow checking.
DAS_API bool das_str2int(const char *str, int *pRes)
Convert the initial portion of a string to an integer with explicit over/underflow checks.
DAS_API DasErrCode das_value_fromStr(ubyte *pBuf, int uBufLen, das_val_type vt, const char *sStr)
Get a das value from a null terminated string.
DAS_API void das_value_trimReal(char *sVal)
Small helper for printing reals in less space.
DAS_API das_valcmp_func das_vt_getcmp(das_val_type vt)
Get the comparison function for two values of this type.
DAS_API char * das_floats2csv(char *pBuf, size_t uBufSz, const float *pValues, int nValues)
Similar to das_doubles2csv, but for 32-bit floats.
DAS_API int das_value_cmpAny(const ubyte *pA, das_val_type vtA, const ubyte *pB, das_val_type vtB)
Compare any two value types for equality.
DAS_API das_val_type das_vt_merge(das_val_type right, int op, das_val_type left)
What would be the resulting type given an operation on the given value type.
DAS_API DasErrCode das_value_binXform(das_val_type vtIn, const ubyte *pValIn, const ubyte *pFillIn, das_val_type vtOut, ubyte *pValOut, const ubyte *pFillOut, uint32_t uFlags)
Convert any integral type to any other with range checking and swapping.
DAS_API double * das_csv2doubles(const char *s, int *nitems)
Parse a comma separated list of ASCII values into a double array.
DAS_API bool das_strn2baseint(const char *str, int nLen, int base, int *pRes)
Convert an explicit length string to an integer with explicit base with over/underflow checks.