46#define ARYIDX_LAST {-1,-1,-1,-1,-1,-1,-1,-1}
52#define ARYIDX_UNBOUND 0
55#define VARIDX_RAGGED -1
83 ptrdiff_t* pShape,
int iFirstInternal,
int nShapeLen,
char* sBuf,
int nBufLen
87char*
das_idx_prn(
int nRank, ptrdiff_t* pIdx,
size_t uLen,
char* sBuf);
90#define RANK_1(I) 1, (size_t[1]){I}
91#define RANK_2(I, J) 2, (size_t[2]){I, J}
92#define RANK_3(I, J, K) 3, (size_t[3]){I, J, K}
93#define RANK_4(I, J, K, L) 4, (size_t[4]){I, J, K, L}
94#define RANK_5(I, J, K, L, M) 5, (size_t[5]){I, J, K, L, M}
95#define RANK_6(I, J, K, L, M, N) 6, (size_t[6]){I, J, K, L, M, N}
96#define RANK_7(I, J, K, L, M, N, O) 7, (size_t[7]){I, J, K, L, M, N, O}
97#define RANK_8(I, J, K, L, M, N, O, P) 8, (size_t[8]){I, J, K, L, M, N, O, P}
100#define DIM1_AT(I) 1, (ptrdiff_t[1]){I}
101#define DIM2_AT(I,J) 2, (ptrdiff_t[2]){I,J}
102#define DIM3_AT(I,J,K) 3, (ptrdiff_t[3]){I,J,K}
103#define DIM4_AT(I,J,K,L) 4, (ptrdiff_t[4]){I,J,K,L}
104#define DIM5_AT(I,J,K,L,M) 5, (ptrdiff_t[5]){I,J,K,L,M}
105#define DIM6_AT(I,J,K,L,M,N) 6, (ptrdiff_t[6]){I,J,K,L,M,N}
106#define DIM7_AT(I,J,K,L,M,N,O) 7, (ptrdiff_t[7]){I,J,K,L,M,N,O}
108#define IDX0(I) (ptrdiff_t[1]){I}
109#define IDX1(I,J) (ptrdiff_t[2]){I,J}
110#define IDX2(I,J,K) (ptrdiff_t[3]){I,J,K}
111#define IDX3(I,J,K,L) (ptrdiff_t[4]){I,J,K,L}
112#define IDX4(I,J,K,L,M) (ptrdiff_t[5]){I,J,K,L,M}
113#define IDX5(I,J,K,L,M,N) (ptrdiff_t[6]){I,J,K,L,M,N}
114#define IDX6(I,J,K,L,M,N,O) (ptrdiff_t[7]){I,J,K,L,M,N,O}
115#define IDX7(I,J,K,L,M,N,O,P) (ptrdiff_t[8]){I,J,K,L,M,N,O,P}
125#define RNG_1(i,I) 1, (ptrdiff_t[1]){i}, (ptrdiff_t[1]){I}
126#define RNG_2(i,I,j,J) 2, (ptrdiff_t[2]){i,j}, (ptrdiff_t[2]){I,J}
127#define RNG_3(i,I,j,J,k,K) 3, (ptrdiff_t[3]){i,j,k}, (ptrdiff_t[3]){I,J,K}
128#define RNG_4(i,I,j,J,k,K,l,L) 4, (ptrdiff_t[4]){i,j,k,l}, (ptrdiff_t[4]){I,J,K,L}
129#define RNG_5(i,I,j,J,k,K,l,L,m,M) 5, (ptrdiff_t[5]){i,j,k,l,m}, (ptrdiff_t[5]){I,J,K,L,M}
130#define RNG_6(i,I,j,J,k,K,l,L,m,M,n,N) 6, (ptrdiff_t[6]){i,j,k,l,m,n}, (ptrdiff_t[6]){I,J,K,L,M,N}
131#define RNG_7(i,I,j,J,k,K,l,L,m,M,n,N,o,O) 7, (ptrdiff_t[7]){i,j,k,l,m,n,o}, (ptrdiff_t[7]){I,J,K,L,M,N,O}
160 int nRngRank,
const ptrdiff_t* pMin,
const ptrdiff_t* pMax,
size_t* pShape
167typedef struct child_info_t{
172typedef struct dyna_buf{
182 ubyte fillBuf[
sizeof(das_idx_info)];
271typedef struct das_array {
288 int (*compare)(
const ubyte* vpFirst,
const ubyte* vpSecond);
301 struct das_array* pMemOwner;
394 const char*
id,
das_val_type et,
size_t sz_each,
const ubyte* fill,
406 const ubyte* fill,
int rank,
size_t* shape,
das_units units
435#define D2ARY_AS_SUBSEQ 0x00000001
441#define D2ARY_FILL_TERM 0x00000003
447#define D2ARY_AS_STRING 0x00000007
550 DasAry* pThis,
size_t* pLen,
size_t* pOffset
585#define DasAry_rank(pThis) pThis->nRank
802 const DasAry* pThis, ptrdiff_t* pShape, ptrdiff_t* pStride
889#define DasAry_getFloatAt(pThis, pLoc) *((float*)(DasAry_getAt(pThis, vtFloat, pLoc)))
892#define DasAry_getDoubleAt(pThis, pLoc) *((double*)(DasAry_getAt(pThis, vtDouble, pLoc)))
895#define DasAry_getByteAt(pThis, pLoc) *((ubyte*)(DasAry_getAt(pThis, vtUByte, pLoc)))
898#define DasAry_getUShortAt(pThis, pLoc) *((uint16_t*)(DasAry_getAt(pThis, etUint16, pLoc)))
901#define DasAry_getShortAt(pThis, pLoc) *((int16_t*)(DasAry_getAt(pThis, etInt16, pLoc)))
904#define DasAry_getIntAt(pThis, pLoc) *((int32_t*)(DasAry_getAt(pThis, etInt32, pLoc)))
907#define DasAry_getLongAt(pThis, pLoc) *((int64_t*)(DasAry_getAt(pThis, etInt64, pLoc)))
910#define DasAry_getTimeAt(pThis, pLoc) *((das_time*)(DasAry_getAt(pThis, vtTime, pLoc)))
913#define DasAry_getTextAt(pThis, pLoc) *((char**)(DasAry_getAt(pThis, vtText, pLoc)))
916#define DasAry_getPtrAt(pThis, pLoc) *((void**)(DasAry_getAt(pThis, vtUnknown, pLoc)))
995#define DasAry_getFloatsIn(T, ...) (const float*) DasAry_getIn(T, vtFloat, __VA_ARGS__)
999#define DasAry_getDoublesIn(T, ...) (const double*) DasAry_getIn(T, vtDouble, __VA_ARGS__)
1003#define DasAry_getCharsIn(T, ...) (const char*) DasAry_getIn(T, vtUByte, __VA_ARGS__)
1007#define DasAry_getBytesIn(T, ...) (const ubyte*) DasAry_getIn(T, vtUByte, __VA_ARGS__)
1011#define DasAry_getUShortsIn(T, ...) (const uint16_t*) DasAry_getIn(T, vtUShort, __VA_ARGS__)
1015#define DasAry_getShortsIn(T, ...) (const int16_t*) DasAry_getIn(T, vtShort, __VA_ARGS__)
1019#define DasAry_getIntsIn(T, ...) (const int32_t*) DasAry_getIn(T, vtInt, __VA_ARGS__)
1023#define DasAry_getLongsIn(T, ...) (const int64_t*) DasAry_getIn(T, vtLong, __VA_ARGS__)
1027#define DasAry_getTimesIn(T, ...) (const das_time*) DasAry_getIn(T, vtTime, __VA_ARGS__)
1031#define DasAry_getTextIn(T, ...) (const char**) DasAry_getIn(T, vtText, __VA_ARGS__)
1054 const DasAry* pThis,
size_t* pElSize,
size_t* pElements
1091 DasAry* pThis,
const char*
id,
int nIndices, ptrdiff_t* pLoc
DAS_API const ubyte * DasAry_getFill(const DasAry *pThis)
Return the fill value for this array.
DAS_API void DasAry_deInit(DasAry *pThis)
Similar to dec_dasAry, but for stack objects.
char * das_shape_prnRng(ptrdiff_t *pShape, int iFirstInternal, int nShapeLen, char *sBuf, int nBufLen)
Print shape information using symbols i,j,k etc for index positions.
DAS_API size_t DasAry_memUsed(const DasAry *pThis)
Get number of bytes currently used for data values and associated indexes by this dynamic array.
char * das_idx_prn(int nRank, ptrdiff_t *pIdx, size_t uLen, char *sBuf)
print a generic set of ptrdiff_t values to a character array
const char g_sIdxLower[ARYIDX_MAX]
Index letters i,j,k,... for printing external index positions, and I,J,K,... for internal (item) inde...
DAS_API ubyte * DasAry_getBuf(DasAry *pThis, das_val_type et, int nDim, ptrdiff_t *pLoc, size_t *pCount)
This is the writable pointer version of DasAry_getIn.
DAS_API DasAry * new_DasPtrAry(const char *sType, int rank, size_t *shape)
A convenience wrapper for storing arrays of pointers.
DAS_API size_t DasAry_memOwned(const DasAry *pThis)
Get the number of bytes currently owned for use in storing data values and indexes.
DAS_API bool DasAry_init(DasAry *pThis, const char *id, das_val_type et, size_t sz_each, const ubyte *fill, int rank, size_t *shape, das_units units)
Same as new_DasAry, but for initializing stack objects instead of making new heap objects.
DAS_API const ubyte * DasAry_getAllVals(const DasAry *pThis, size_t *pElSize, size_t *pElements)
Forget all the fancy indexing, just get a pointer to all the elements.
#define ARYIDX_MAX
The maximum number of array indices in das3.
Definition array.h:43
DAS_API size_t DasAry_memIndexed(const DasAry *pThis)
Get the number of bytes needed to store these values and their associated indexes.
int das_rng2shape(int nRngRank, const ptrdiff_t *pMin, const ptrdiff_t *pMax, size_t *pShape)
Calculate a strided array shape from a min/max range.
const char * das_units
Handle SI and other units, with accommodations for Epoch systems, from units.h.
Definition units.h:144
das_val_type
Enumeration of types stored in Das Array (DasAry) objects from value.h.
Definition value.h:81
Dynamic recursive ragged arrays.
Definition array.h:271
DAS_API int inc_DasAry(DasAry *pThis)
Increment the count of objects using this Das Array.
DAS_API bool DasAry_ownsElements(const DasAry *pThis)
Does this array own it's own memory?
DAS_API char * DasAry_toStr(const DasAry *pThis, char *sInfo, size_t uLen)
Get a informational string representing the array.
DAS_API const char * DasAry_valTypeStr(const DasAry *pThis)
Get the type of value stored in the array as a text string.
DAS_API size_t DasAry_valSize(const DasAry *pThis)
Get the size in bytes of each element stored in the das array.
DAS_API int DasAry_shape(const DasAry *pThis, ptrdiff_t *pShape)
Return current valid ranges for this array indices.
DAS_API bool DasAry_putAt(DasAry *pThis, ptrdiff_t *pStart, const ubyte *pVals, size_t uVals)
Set values starting at a complete index.
DAS_API unsigned int DasAry_setUsage(DasAry *pThis, unsigned int uFlags)
Set usage flags to assist arbitrary consumers understand how to use this array.
DAS_API void DasAry_setSrc(DasAry *pThis, int nPktId, size_t uStartItem, size_t uItems)
Record which packets contain data destine for this array.
DAS_API int DasAry_stride(const DasAry *pThis, ptrdiff_t *pShape, ptrdiff_t *pStride)
Return the strides used for offset calculations.
DAS_API const ubyte * DasAry_getIn(const DasAry *pThis, das_val_type et, int nDim, ptrdiff_t *pLoc, size_t *pCount)
Get a pointer to the elements contained by a partial index.
DAS_API const char * DasAry_id(const DasAry *pThis)
Get the name of an array.
DAS_API size_t DasAry_itemsIn(const DasAry *pThis, int nIdx, ptrdiff_t *pLoc)
Count the logical items in a subset of the array.
DAS_API size_t DasAry_size(const DasAry *pThis)
Get the total number of data values in an array, regardless of it's shape.
DAS_API int DasAry_cmp(DasAry *pThis, const ubyte *vpFirst, const ubyte *vpSecond)
Compare two items of the type in the array.
DAS_API das_val_type DasAry_valType(const DasAry *pThis)
Get the type of value stored in the array if knownh.
DAS_API size_t DasAry_clear(DasAry *pThis)
Clear all values from the array.
DAS_API ubyte * DasAry_disownElements(DasAry *pThis, size_t *pLen, size_t *pOffset)
Take ownership of array element memory.
DAS_API ubyte * DasAry_append(DasAry *pThis, const ubyte *pVals, size_t uCount)
Append some number of items to the end of the array.
DAS_API void DasAry_markEnd(DasAry *pThis, int iDim)
Mark a ragged dimension as finished.
DAS_API bool DasAry_validAt(const DasAry *pThis, ptrdiff_t *pLoc)
Is a valid item located at a complete index.
DAS_API size_t DasAry_lengthIn(const DasAry *pThis, int nIdx, ptrdiff_t *pLoc)
Return the current max value + 1 for any index.
DAS_API const ubyte * DasAry_getAt(const DasAry *pThis, das_val_type et, ptrdiff_t *pLoc)
Get a pointer to an element at a complete index.
DAS_API das_units DasAry_units(const DasAry *pThis)
Get the units for the values in the array.
DAS_API size_t DasAry_qubeIn(DasAry *pThis, int iRecDim)
Use fill values to make sure the last subset in a dimension is a QUBE.
DAS_API DasAry * new_DasAry(const char *id, das_val_type et, size_t sz_each, const ubyte *fill, int rank, size_t *shape, das_units units)
Creates a new dynamic array buffer.
DAS_API unsigned int DasAry_getUsage(DasAry *pThis)
Returns the usage flags for this array.
DAS_API bool DasAry_setFill(DasAry *pThis, das_val_type vt, const ubyte *pFill)
Change the fill value for this array.
DAS_API void dec_DasAry(DasAry *pThis)
Maybe remove the array.
DAS_API int ref_DasAry(const DasAry *pThis)
Return the reference count of objects using this array.
DAS_API void DasAry_setId(DasAry *pThis, const char *sId)
Set the name of an array.
DAS_API DasAry * DasAry_subSetIn(DasAry *pThis, const char *id, int nIndices, ptrdiff_t *pLoc)
Get a lower rank array that is a sub-set of the current array.
void * pUser
User data pointer.
Definition array.h:314
Defines units used for items in the stream, most notably time units that reference an epoch and a ste...
#define DAS_MAX_ID_BUFSZ
The size of an char buffer large enough to hold valid object IDs.
Definition util.h:349
A generic value type for use in arrays, datums and variables.