20 #ifndef _das_variable_h_
21 #define _das_variable_h_
37 D2V_DATUM, D2V_SEQUENCE, D2V_ARRAY, D2V_UNARY_OP, D2V_BINARY_OP
40 #define MAP_0 0, (NULL)
41 #define MAP_1(I) 1, (int8_t[1]){I}
42 #define MAP_2(I,J) 2, (int8_t[2]){I,J}
43 #define MAP_3(I,J,K) 3, (int8_t[3]){I,J,K}
44 #define MAP_4(I,J,K,L) 4, (int8_t[4]){I,J,K,L}
45 #define MAP_5(I,J,K,L,M) 5, (int8_t[5]){I,J,K,L,M}
46 #define MAP_6(I,J,K,L,M,N) 6, (int8_t[6]){I,J,K,L,M,N}
47 #define MAP_7(I,J,K,L,M,N,O) 7, (int8_t[7]){I,J,K,L,M,N,O}
60 void das_varindex_merge(
int nRank, ptrdiff_t* pDest, ptrdiff_t* pSrc);
63 ptrdiff_t das_varlength_merge(ptrdiff_t nLeft, ptrdiff_t nRight);
65 #define D2V_EXP_UNITS 0x02
66 #define D2V_EXP_RANGE 0x04
207 typedef struct das_variable{
208 enum var_type vartype;
231 int (*shape)(
const struct das_variable* pThis, ptrdiff_t* pShape);
234 ptrdiff_t (*lengthIn)(
235 const struct das_variable* pThis,
int nIdx, ptrdiff_t* pLoc
240 const struct das_variable* pThis, ptrdiff_t* pIdx,
das_datum* pDatum
244 int (*incRef)(
struct das_variable* pThis);
251 int (*decRef)(
struct das_variable* pThis);
262 char* (*expression)(
const struct das_variable* pThis,
char* sBuf,
int nLen,
263 unsigned int uFlags);
295 DasVar* new_DasVarUnary_tok(
int nOpTok,
const DasVar* pVar);
378 const char* sId,
das_val_type vt,
size_t vSz,
const void* pMin,
379 const void* pInterval, int8_t* pMap,
das_units units
DasAry * DasVarAry_getArray(DasVar *pThis)
Get the backing array if present.
Das2 fexible variables.
Definition: variable.h:207
A value and it's units.
Definition: datum.h:62
DasVar * new_DasVarEval(const DasVar *pVar)
Evaluate all sub-variable expressions and a single array variable.
das_val_type
Enumeration of types stored in Das Array (DasAry) objects Not that any kind of value may be stored in...
Definition: value.h:51
ptrdiff_t DasVar_lengthIn(const DasVar *pThis, int nIdx, ptrdiff_t *pLoc)
Return the current max value index value + 1 for any partial index.
A dynamic buffer with multi-dimensional array style access.
DasVar * new_DasVarSeq(const char *sId, das_val_type vt, size_t vSz, const void *pMin, const void *pInterval, int8_t *pMap, das_units units)
Create a sequence variable.
int DasVar_shape(const DasVar *pThis, ptrdiff_t *pShape)
Return the current shape of this variable.
DasVar * new_DasConstant(das_val_type vt, size_t sz, const void *val, das_units units)
Create a constant value on the heap.
DasVar * new_DasVarBinary(DasVar *pLeft, const char *sOp, DasVar *pRight)
Create a new variable from a binary operation on two other variables.
bool DasVar_isComposite(const DasVar *pVar)
Is this a simple variable or more than one variable combinded via operators?
void dec_DasVar(DasVar *pThis)
Decrement the reference count on a variable.
bool DasVar_getDatum(const DasVar *pThis, ptrdiff_t *pIdx, das_datum *pDatum)
Get a value given an index.
Defines units used for items in the stream, most notably time units that reference an epoch and a ste...
bool DasVar_orthoginal(const DasVar *pThis, const DasVar *pOther)
Getting data from a variable.
DasVar * new_DasVarArray(DasAry *pAry, int iInternal, int8_t *pMap)
Create a function backed by an Array.
DasVar * new_DasVarUnary(const char *sOp, const DasVar *pVar)
Create a new variable from unary operation on an existing variable.
const char * das_units
Enumeration of unit types, that correspond to physical unit types.
Definition: units.h:135
char * DasVar_toStr(const DasVar *pThis, char *sBuf, int nLen)
Get a string representation of this variable.
Dynamic recursive ragged arrays.
Definition: array.h:193