![]() |
das2C
das core C utilities (v3)
|
Individual properties of a desciptor. More...
#include <das2/property.h>
Public Member Functions | |
DasErrCode | DasProp_init (ubyte *pBuf, size_t uBufSz, const char *sType, ubyte uType, const char *sName, const char *sValue, char cSep, das_units units, int nStandard) |
Flexible das1, das2 and das3 compatable property memory initializer. More... | |
size_t | DasProp_size (const DasProp *pProp) |
Return the memory footprint of a property. | |
const char * | DasProp_name (const DasProp *pProp) |
Get name of a property. | |
const char * | DasProp_value (const DasProp *pProp) |
Get the string value for a property. | |
char | DasProp_sep (const DasProp *pProp) |
Get the value separator character for array-style properties. | |
bool | DasProp_equal (const DasProp *pOne, const DasProp *pTwo) |
Determine if two properties contain equal content. | |
const char * | DasProp_typeStr2 (const DasProp *pProp) |
Get a das2 type string for this property | |
const char * | DasProp_typeStr3 (const DasProp *pProp) |
Get a das3 type string for this property. | |
int | DasProp_convertInt (const DasProp *pProp, int64_t *pBuf, size_t uBufLen) |
Convert integer property values to 64-bit ints. More... | |
int | DasProp_convertReal (const DasProp *pProp, double *pBuf, size_t uBufLen) |
Convert real-value properties to double. More... | |
int | DasProp_convertBool (const DasProp *pProp, uint8_t *pBuf, size_t uBufLen) |
Convert boolean property values to bytes. More... | |
int | DasProp_convertTt2k (const DasProp *pProp, int64_t *pBuf, size_t uBufLen) |
Convert datatime properties TT2K long integers. | |
int | DasProp_convertTime (const DasProp *pProp, uint64_t *pBuf, size_t uBufLen) |
Convert datatime properties to a double based value of units. | |
ubyte | DasProp_type (const DasProp *pProp) |
Get a property type code. More... | |
void | DasProp_invalidate (DasProp *pProp) |
Mark this property as invalid, this erases the type information and is thus a non-reversable operation. | |
bool | DasProp_isValid (const DasProp *pProp) |
Determine if this property has a valid type definition. | |
int | DasProp_items (const DasProp *pProp) |
Determine the number of items in a multi valued property. | |
#define | DasProp_isRange(P) (P->flags & DASPROP_RANGE) |
Returns true if this property has range multiplicity (aka 2 items) | |
Individual properties of a desciptor.
DasProp objects assume that some other object, such as a DasAry the storage buffer and that these functions configure and read that storage. Thus there are no "new_" or "del_" function for properties.
Each property has:
DasErrCode DasProp_init | ( | ubyte * | pBuf, |
size_t | uBufSz, | ||
const char * | sType, | ||
ubyte | uType, | ||
const char * | sName, | ||
const char * | sValue, | ||
char | cSep, | ||
das_units | units, | ||
int | nStandard | ||
) |
Flexible das1, das2 and das3 compatable property memory initializer.
pBuf | A byte buffer that is at least dasprop_memsz() bytes long |
sType | The data type of the property, can be one of:
|
uType | An alternate and more efficent method of specifying the property type. If sType is NULL, this is read instead. To set uType or together one constant from each set below. |
Item type: DASPROP_STRING, DASPROP_BOOL, DASPROP_INT, DASPROP_REAL, DASPROP_DATETIME
Multiplicity: DASPROP_SINGLE, DASPROP_RANGE, DASPROP_SET
sName | The name of the property, can be no longer then 127 bytes. This is a looser restriction then associated XSDs. |
sValue | The data value, can be no longer then 130,943 bytes. |
cSep | For array values, this (in addition to possible whitespace) is the separator between values. Ignored if Mulitplicity is not DASPROP_SET. |
units | The units for this value. If the type is Datum or DatumRange this value will be ignored, otherwise if this value is NULL then UNIT_DIMENSIONLESS will be assigned. |
nStandard. | One of 1, 2 or 3 for das1, das2, or das3. For das2 & 3, property names may only consist of the characters [a-z][A-Z][0-9] and '_'. |
int DasProp_convertInt | ( | const DasProp * | pProp, |
int64_t * | pBuf, | ||
size_t | uBufLen | ||
) |
Convert integer property values to 64-bit ints.
Returns the number of conversions, or a negative error value
int DasProp_convertReal | ( | const DasProp * | pProp, |
double * | pBuf, | ||
size_t | uBufLen | ||
) |
Convert real-value properties to double.
Returns the number of conversions, or a negative error value
int DasProp_convertBool | ( | const DasProp * | pProp, |
uint8_t * | pBuf, | ||
size_t | uBufLen | ||
) |
Convert boolean property values to bytes.
Returns the number of conversions, or a negative error value
ubyte DasProp_type | ( | const DasProp * | pProp | ) |
Get a property type code.
Use the values: DASPROP_MULTI_MASK & DASPROP_TYPE_MASK to extract sections