das2C
das core C utilities (v3)
Loading...
Searching...
No Matches
Public Member Functions | Data Fields
DasDsUniqIter Struct Reference

A non-degenerate iterator. More...

#include <das3/iterator.h>

Collaboration diagram for DasDsUniqIter:
Collaboration graph
[legend]

Public Member Functions

DAS_API void DasDsUniqIter_init (DasDsUniqIter *pThis, const DasDs *pDs, const DasVar *pVar)
 Initialize a non-degenerate iterator for a variable.
 
DAS_API bool DasDsUniqIter_next (DasDsUniqIter *pThis)
 Increment the iterator's index by one position, rolling as needed at data boundaries.
 

Data Fields

bool done
 If true the current value in the index is valid, false otherwise.
 
ptrdiff_t index [VARIDX_MAX]
 A dataset bulk iteration index suitable for use in DasVar functions like ::DasVar_get.
 
bool lock [VARIDX_MAX]
 A list of index values that will be auto assigned to zero.
 
int first
 Shortcut iteration by saving off the indexes that matter.
 

Detailed Description

A non-degenerate iterator.

Member Function Documentation

◆ DasDsUniqIter_init()

DAS_API void DasDsUniqIter_init ( DasDsUniqIter pThis,
const DasDs pDs,
const DasVar *  pVar 
)

Initialize a non-degenerate iterator for a variable.

This iterator type runs over all indexes in a dataset except for those that are not used by the given variable. It works for ragged and cubic datasets. This is a convenient way to extract unique values for a variable.

For usage see the example in ::das_iterator

Parameters
pThisA pointer to an iterator, will be initialize to index 0
pDsA pointer to a dataset. If the dataset changes while the iterator is in use invalid memory access could occur

◆ DasDsUniqIter_next()

DAS_API bool DasDsUniqIter_next ( DasDsUniqIter pThis)

Increment the iterator's index by one position, rolling as needed at data boundaries.

For efficiency this function does not re-check array bounds on each call a slower but safer version of this function could be created if needed.

For usage see the example in ::das_iterator

Parameters
pThisA pointer to an iterator. The index member of the iterator will be incremented.
Returns
true if the new index is within range, false if the index could not be incremented without producing an invalid location.

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