libdas2
das2 core C utilities
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Data Fields
dasds_iterator Struct Reference

#include <das2/dataset.h>

Detailed Description

Dataset iterator structure.

Since dataset rank and shape is a union of the shape of it's components iterating over datasets can be tricky. This structure and it's associated functions are provided to simplify this task. Usage is demonstrated by the example below:

* // Assume a dataset with time, amplitude and frequency dimensions but with
* // arbitrary shape in index space.
*
* // pDs is a pointer to a das dataset
*
* DasDim* pDimTime = DasDs_getDim(pDs, "time", D2DIM_COORD);
* DasVar* pVarTime = DasDim_getPointVar(pDimTime);
*
* DasDim* pDimFreq = DasDs_getDim(pDs, "frequency", D2DIM_COORD);
* DasVar* pVarFreq = DasDim_getPointVar(pDimFreq);
*
* DasDim* pDimAmp = DasDs_getDim(pDs, "e_spec_dens", D2DIM_DATA;
* DasVar* pVarAmp = DasDim_getPointVar(pDimAmp);
*
* das_datum set[3];
*
* for(dasds_iter_init(&iter, pDs); !iter.done; dasds_iter_next(&iter)){
*
* DasVar_getDatum(pVarTime, index, set);
* DasVar_getDatum(pVarFreq, index, set + 1);
* DasVar_getDatum(pVarAmp, index, set + 2);
*
* // Plot, or bin, or what-have-you, the triplet here.
* // Plot() is not a real function in the libdas2 C API
* Plot(set);
* }
*
*

Public Member Functions

void dasds_iter_init (dasds_iterator *pIter, const DasDs *pDs)
 Initialize a const dataset iterator. More...
 
bool dasds_iter_next (dasds_iterator *pIter)
 Increment the iterator's index by one position, rolling as needed at data boundaries. More...
 

Data Fields

bool done
 If true the value in index is valid, false otherwise.
 
ptrdiff_t index [DASIDX_MAX]
 A dataset bulk iteration index suitable for use in DasVar functions like DasVar_getDatum.
 

The documentation for this struct was generated from the following file: