48 #define DASIDX_RAGGED -1
49 #define DASIDX_FUNC -2
50 #define DASIDX_UNUSED -3
56 #define DASIDX_INIT_UNUSED {-3,-3,-3,-3,-3,-3,-3,-3}
57 #define DASIDX_INIT_BEGIN { 0, 0, 0, 0, 0, 0, 0, 0}
63 extern const ptrdiff_t g_aShapeZeros[
DASIDX_MAX];
82 ptrdiff_t* pShape,
int iFirstInternal,
int nShapeLen,
char* sBuf,
int nBufLen
86 char*
das_idx_prn(
int nRank, ptrdiff_t* pIdx,
size_t uLen,
char* sBuf);
89 #define RANK_1(I) 1, (size_t[1]){I}
90 #define RANK_2(I, J) 2, (size_t[2]){I, J}
91 #define RANK_3(I, J, K) 3, (size_t[3]){I, J, K}
92 #define RANK_4(I, J, K, L) 4, (size_t[4]){I, J, K, L}
93 #define RANK_5(I, J, K, L, M) 5, (size_t[5]){I, J, K, L, M}
94 #define RANK_6(I, J, K, L, M, N) 6, (size_t[6]){I, J, K, L, M, N}
95 #define RANK_7(I, J, K, L, M, N, O) 7, (size_t[7]){I, J, K, L, M, N, O}
96 #define RANK_8(I, J, K, L, M, N, O, P) 8, (size_t[8]){I, J, K, L, M, N, O, P}
98 #define DIM0 0, (NULL)
99 #define DIM1_AT(I) 1, (ptrdiff_t[1]){I}
100 #define DIM2_AT(I,J) 2, (ptrdiff_t[2]){I,J}
101 #define DIM3_AT(I,J,K) 3, (ptrdiff_t[3]){I,J,K}
102 #define DIM4_AT(I,J,K,L) 4, (ptrdiff_t[4]){I,J,K,L}
103 #define DIM5_AT(I,J,K,L,M) 5, (ptrdiff_t[5]){I,J,K,L,M}
104 #define DIM6_AT(I,J,K,L,M,N) 6, (ptrdiff_t[6]){I,J,K,L,M,N}
105 #define DIM7_AT(I,J,K,L,M,N,O) 7, (ptrdiff_t[7]){I,J,K,L,M,N,O}
107 #define IDX0(I) (ptrdiff_t[1]){I}
108 #define IDX1(I,J) (ptrdiff_t[2]){I,J}
109 #define IDX2(I,J,K) (ptrdiff_t[3]){I,J,K}
110 #define IDX3(I,J,K,L) (ptrdiff_t[4]){I,J,K,L}
111 #define IDX4(I,J,K,L,M) (ptrdiff_t[5]){I,J,K,L,M}
112 #define IDX5(I,J,K,L,M,N) (ptrdiff_t[6]){I,J,K,L,M,N}
113 #define IDX6(I,J,K,L,M,N,O) (ptrdiff_t[7]){I,J,K,L,M,N,O}
114 #define IDX7(I,J,K,L,M,N,O,P) (ptrdiff_t[8]){I,J,K,L,M,N,O,P}
124 #define RNG_1(i,I) 1, (ptrdiff_t[1]){i}, (ptrdiff_t[1]){I}
125 #define RNG_2(i,I,j,J) 2, (ptrdiff_t[2]){i,j}, (ptrdiff_t[2]){I,J}
126 #define RNG_3(i,I,j,J,k,K) 3, (ptrdiff_t[3]){i,j,k}, (ptrdiff_t[3]){I,J,K}
127 #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}
128 #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}
129 #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}
130 #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}
159 int nRngRank,
const ptrdiff_t* pMin,
const ptrdiff_t* pMax,
size_t* pShape
166 typedef struct child_info_t{
171 typedef struct dyna_buf{
181 ubyte fillBuf[
sizeof(das_idx_info)];
270 typedef struct das_array {
287 int (*compare)(
const ubyte* vpFirst,
const ubyte* vpSecond);
300 struct das_array* pMemOwner;
393 const char*
id,
das_val_type et,
size_t sz_each,
const ubyte* fill,
405 const ubyte* fill,
int rank,
size_t* shape,
das_units units
434 #define D2ARY_AS_SUBSEQ 0x00000001
440 #define D2ARY_FILL_TERM 0x00000003
446 #define D2ARY_AS_STRING 0x00000007
544 DasAry* pThis,
size_t* pLen,
size_t* pOffset
571 #define DasAry_rank(pThis) pThis->nRank
769 const DasAry* pThis, ptrdiff_t* pShape, ptrdiff_t* pStride
856 #define DasAry_getFloatAt(pThis, pLoc) *((float*)(DasAry_getAt(pThis, vtFloat, pLoc)))
859 #define DasAry_getDoubleAt(pThis, pLoc) *((double*)(DasAry_getAt(pThis, vtDouble, pLoc)))
862 #define DasAry_getByteAt(pThis, pLoc) *((ubyte*)(DasAry_getAt(pThis, vtUByte, pLoc)))
865 #define DasAry_getUShortAt(pThis, pLoc) *((uint16_t*)(DasAry_getAt(pThis, etUint16, pLoc)))
868 #define DasAry_getShortAt(pThis, pLoc) *((int16_t*)(DasAry_getAt(pThis, etInt16, pLoc)))
871 #define DasAry_getIntAt(pThis, pLoc) *((int32_t*)(DasAry_getAt(pThis, etInt32, pLoc)))
874 #define DasAry_getLongAt(pThis, pLoc) *((int64_t*)(DasAry_getAt(pThis, etInt64, pLoc)))
877 #define DasAry_getTimeAt(pThis, pLoc) *((das_time*)(DasAry_getAt(pThis, vtTime, pLoc)))
880 #define DasAry_getTextAt(pThis, pLoc) *((char**)(DasAry_getAt(pThis, vtText, pLoc)))
883 #define DasAry_getPtrAt(pThis, pLoc) *((void**)(DasAry_getAt(pThis, vtUnknown, pLoc)))
962 #define DasAry_getFloatsIn(T, ...) (const float*) DasAry_getIn(T, vtFloat, __VA_ARGS__)
966 #define DasAry_getDoublesIn(T, ...) (const double*) DasAry_getIn(T, vtDouble, __VA_ARGS__)
970 #define DasAry_getCharsIn(T, ...) (const char*) DasAry_getIn(T, vtUByte, __VA_ARGS__)
974 #define DasAry_getBytesIn(T, ...) (const ubyte*) DasAry_getIn(T, vtUByte, __VA_ARGS__)
978 #define DasAry_getUShortsIn(T, ...) (const uint16_t*) DasAry_getIn(T, vtUShort, __VA_ARGS__)
982 #define DasAry_getShortsIn(T, ...) (const int16_t*) DasAry_getIn(T, vtShort, __VA_ARGS__)
986 #define DasAry_getIntsIn(T, ...) (const int32_t*) DasAry_getIn(T, vtInt, __VA_ARGS__)
990 #define DasAry_getLongsIn(T, ...) (const int64_t*) DasAry_getIn(T, vtLong, __VA_ARGS__)
994 #define DasAry_getTimesIn(T, ...) (const das_time*) DasAry_getIn(T, vtTime, __VA_ARGS__)
998 #define DasAry_getTextIn(T, ...) (const char**) DasAry_getIn(T, vtText, __VA_ARGS__)
1021 const DasAry* pThis,
size_t* pElSize,
size_t* pElements
1058 DasAry* pThis,
const char*
id,
int nIndices, ptrdiff_t* pLoc
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.
char * das_idx_prn(int nRank, ptrdiff_t *pIdx, size_t uLen, char *sBuf)
print a generice set of ptrdiff_t values to a character array
DAS_API void DasAry_deInit(DasAry *pThis)
Similar to dec_dasAry, but for stack objects.
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.
DAS_API const ubyte * DasAry_getFill(const DasAry *pThis)
Return the fill value for this array.
const ptrdiff_t g_aShapeUnused[DASIDX_MAX]
Global instance of unused array, suitable for memcpy.
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.
#define DASIDX_MAX
The maximum number of array indices in das2.
Definition: array.h:43
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.
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 size_t DasAry_memIndexed(const DasAry *pThis)
Get the number of bytes needed to store these values and thier 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:139
das_val_type
Enumeration of types stored in Das Array (DasAry) objects from value.h.
Definition: value.h:64
Dynamic recursive ragged arrays.
Definition: array.h:270
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 offest 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_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 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:313
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:311
A generic value type for use in arrays, datums and variables.