21 #ifndef _descriptor_h_
22 #define _descriptor_h_
43 typedef enum DescriptorType {
44 UNK_DESC=0, STREAM=14000,
45 PLANE=14001, PACKET=14002,
46 PHYSDIM=15001, DATASET=15002,
74 typedef struct das_descriptor {
98 const struct das_descriptor* parent;
110 #define DasDesc_type(P) ((P)->type)
145 DAS_API
DasDesc* new_Descriptor(
void);
147 DAS_API
void DasDesc_freeProps(
DasDesc* pThis);
294 DasDesc* pThis,
const char* sType,
const char* sName,
const char* sVal
303 DasDesc* pThis,
const char* sType, ubyte uType,
const char* sName,
304 const char* sVal,
char cSep,
das_units units,
int nStandard
310 DAS_API
const char* DasDesc_getType(
const DasDesc* pThis,
const char* sName);
312 DAS_API
const char* DasDesc_get(
const DasDesc* pThis,
const char* sName);
404 DasDesc* pThis,
const char* sName,
char* pBuf,
size_t uBufSz,
405 char** psVals,
size_t uMaxVals
418 DasDesc* pThis,
const char* sName,
char cSep,
419 char* pBuf,
size_t uBufSz,
char** psVals,
size_t uMaxVals
429 DasDesc* pThis,
const char* sName,
const char* sVal
436 DasDesc* pThis,
const char* sName,
const char* sFmt, ...
450 DasDesc* pThis,
const char* sName,
double value
507 DasDesc* pThis,
const char* sName,
int* pNumItems
514 DasDesc* pThis,
const char* sName,
int nItems,
double* pValues
550 DasDesc* pThis,
const char* sName,
bool bVal
568 DasDesc* pThis,
const char* sName,
char* sMin,
char* sMax,
577 DasDesc* pThis,
const char* sName,
int nItems,
float* pValues
588 #define DasDesc_encode DasDesc_encode2
A dynamic buffer with multi-dimensional array style access.
Utility to assist with encode and decode operations.
const DasProp * DasDesc_getProp(const DasDesc *pThis, const char *sName)
Get a property if present in descriptor or it's parent (das3)
DAS_API DasErrCode DasDesc_setProp(DasDesc *pThis, const DasProp *pProp)
Overwrite, or copy-in a fully formatted property.
DAS_API DasErrCode DasDesc_setBool(DasDesc *pThis, const char *sName, bool bVal)
Set a boolean property Encodes the value as either the string "true" or the string "false".
desc_type_t
enumeration of Descriptor types, used internally for type checking.
Definition: descriptor.h:43
DAS_API DasErrCode DasDesc_flexSet(DasDesc *pThis, const char *sType, ubyte uType, const char *sName, const char *sVal, char cSep, das_units units, int nStandard)
Create or set a existing property.
DAS_API DasErrCode DasDesc_encode3(DasDesc *pThis, DasBuf *pBuf, const char *sIndent)
Encode a generic set of properties to a buffer, in das3 format.
const DasProp * DasDesc_getLocal(const DasDesc *pThis, const char *sName)
Get a property if present in this descriptor only (das3)
DAS_API size_t DasDesc_getArray(DasDesc *pThis, const char *sName, char cSep, char *pBuf, size_t uBufSz, char **psVals, size_t uMaxVals)
Get string array with given seperator.
int DasErrCode
return code type 0 indicates success, negative integer indicates failure
Definition: defs.h:164
const char * das_units
Handle SI and other units, with accommodations for Epoch systems, from units.h.
Definition: units.h:139
Dynamic recursive ragged arrays.
Definition: array.h:270
Buffer class to handle accumulating byte streams.
Definition: buffer.h:47
Base structure for Stream Header Items.
Definition: descriptor.h:74
DAS_API DasErrCode DasDesc_setStr(DasDesc *pThis, const char *sName, const char *sVal)
SetProperty methods add properties to any Descriptor (stream,packet,plane).
DAS_API const char * DasDesc_getValByIdx(const DasDesc *pThis, size_t uIdx)
Get a property value by an index.
DAS_API const char * DasDesc_getStr(const DasDesc *pThis, const char *sName)
read the property of type String named sName.
DAS_API int DasDesc_getInt(const DasDesc *pThis, const char *sName)
Get a property integer value.
DAS_API const char * DasDesc_getTypeByIdx3(const DasDesc *pThis, size_t uIdx)
Get a data type of a property by an index, das3 covention.
DAS_API const char * DasDesc_getTypeByIdx(const DasDesc *pThis, size_t uIdx)
Get a data type of a property by an index.
DAS_API DasErrCode DasDesc_getStrRng(DasDesc *pThis, const char *sName, char *sMin, char *sMax, das_units *pUnits, size_t uLen)
Get a property of type DatumRange with unconverted strings.
DAS_API const char * DasDesc_getNameByIdx(const DasDesc *pThis, size_t uIdx)
Get a property name by an index.
DAS_API DasErrCode DasDesc_setDoubleArray(DasDesc *pThis, const char *sName, int nItems, double *pValues)
Set the property of type double array.
DAS_API bool DasDesc_equals(const DasDesc *pThis, const DasDesc *pOther)
Check to see if two descriptors contain the same properties Note, the order of the properties may be ...
DAS_API DasErrCode DasDesc_encode2(DasDesc *pThis, DasBuf *pBuf, const char *sIndent)
Encode a generic set of properties to a buffer.
DAS_API DasErrCode DasDesc_setDatum(DasDesc *pThis, const char *sName, double rVal, das_units units)
Set property of type Datum (double, UnitType pair)
DAS_API const DasDesc * DasDesc_parent(DasDesc *pThis)
The the parent of a Descriptor.
DAS_API char * DasDesc_info(const DasDesc *pThis, char *sBuf, int nLen, char *sIndent)
Print 1-line versions of each property in a descriptor.
DAS_API size_t DasDesc_getStrAry(DasDesc *pThis, const char *sName, char *pBuf, size_t uBufSz, char **psVals, size_t uMaxVals)
Get a multi-valued string property.
DAS_API double * DasDesc_getDoubleAry(DasDesc *pThis, const char *sName, int *pNumItems)
Get the values of an array property.
DAS_API DasErrCode DasDesc_setDouble(DasDesc *pThis, const char *sName, double value)
Set property of type double.
DAS_API size_t DasDesc_length(const DasDesc *pThis)
Get the number of properties in a descriptor.
DAS_API bool DasDesc_remove(DasDesc *pThis, const char *sName)
Remove a property from a descriptor, if preset.
DAS_API bool DasDesc_has(const DasDesc *pThis, const char *sName)
Determine if a property is present in a Descriptor or it's ancestors.
DAS_API DasErrCode DasDesc_setInt(DasDesc *pThis, const char *sName, int nVal)
Set the property of type int.
DAS_API DasErrCode DasDesc_setFloatAry(DasDesc *pThis, const char *sName, int nItems, float *pValues)
Set the property of type float array.
DAS_API DasErrCode DasDesc_vSetStr(DasDesc *pThis, const char *sName, const char *sFmt,...)
Set a string property in the manner of sprintf.
DAS_API const DasProp * DasDesc_getPropByIdx(const DasDesc *pThis, size_t uIdx)
Get a property name by an index.
DAS_API bool DasDesc_getBool(DasDesc *pThis, const char *sName)
Get a property boolean value.
DAS_API DasErrCode DasDesc_set(DasDesc *pThis, const char *sType, const char *sName, const char *sVal)
Generic property setter.
DAS_API void DasDesc_copyIn(DasDesc *pThis, const DasDesc *pOther)
Deepcopy properties into a descriptor.
DAS_API double DasDesc_getDatum(DasDesc *pThis, const char *sName, das_units units)
Get the a numeric property in the specified units.
DAS_API void DasDesc_init(DasDesc *pThis, desc_type_t type)
Initialize a memory location as a valid das descriptor.
DAS_API double DasDesc_getDouble(const DasDesc *pThis, const char *sName)
Read the property of type double named sName.
DAS_API DasErrCode DasDesc_setDatumRng(DasDesc *pThis, const char *sName, double beg, double end, das_units units)
Set property of type DatumRange (double, double, UnitType triple)
Individual properties of a desciptor.
Definition: property.h:49
Defines units used for items in the stream, most notably time units that reference an epoch and a ste...