eccodes: Iterating on keys names

eccodes

- Main Page
- C Interface
- F90 Interface
- Python Interface

All Data Structures Namespaces Files Functions Groups Pages
Data Structures | Macros | Functions
Iterating on keys names

## Data Structures
struct | codes_keys_iterator

## Macros
#define | CODES_KEYS_ITERATOR_ALL_KEYS 0
#define | CODES_KEYS_ITERATOR_SKIP_READ_ONLY (1<<0)
#define | CODES_KEYS_ITERATOR_SKIP_OPTIONAL (1<<1)
#define | CODES_KEYS_ITERATOR_SKIP_EDITION_SPECIFIC (1<<2)
#define | CODES_KEYS_ITERATOR_SKIP_CODED (1<<3)
#define | CODES_KEYS_ITERATOR_SKIP_COMPUTED (1<<4)
#define | CODES_KEYS_ITERATOR_SKIP_DUPLICATES (1<<5)
#define | CODES_KEYS_ITERATOR_SKIP_FUNCTION (1<<6)
#define | CODES_KEYS_ITERATOR_DUMP_ONLY (1<<7)

## Functions
codes_keys_iterator * | codes_keys_iterator_new (codes_handle *h, unsigned long filter_flags, const char *name_space)
int | codes_keys_iterator_next (codes_keys_iterator *kiter)
const char * | codes_keys_iterator_get_name (codes_keys_iterator *kiter)
int | codes_keys_iterator_delete (codes_keys_iterator *kiter)
int | codes_keys_iterator_rewind (codes_keys_iterator *kiter)

## Detailed Description

The keys iterator is designed to get the key names defined in a message. Key names on which the iteration is carried out can be filtered through their attributes or by the namespace they belong to.

## Macro Definition Documentation

#define CODES_KEYS_ITERATOR_ALL_KEYS 0

    Iteration is carried out on all the keys available in the message

See Also
  codes_keys_iterator_new

#define CODES_KEYS_ITERATOR_DUMP_ONLY (1<<7)

     only keys present in the dump

See Also
  codes_keys_iterator_new

#define CODES_KEYS_ITERATOR_SKIP_CODED (1<<3)

    coded keys are skipped by keys iterator.

See Also
  codes_keys_iterator_new

#define CODES_KEYS_ITERATOR_SKIP_COMPUTED (1<<4)

    computed keys are skipped by keys iterator.

See Also
  codes_keys_iterator_new

#define CODES_KEYS_ITERATOR_SKIP_DUPLICATES (1<<5)

    duplicates of a key are skipped by keys iterator.

See Also
  codes_keys_iterator_new

#define CODES_KEYS_ITERATOR_SKIP_EDITION_SPECIFIC (1<<2)

    edition specific keys are skipped by keys iterator.

See Also
  codes_keys_iterator_new

#define CODES_KEYS_ITERATOR_SKIP_FUNCTION (1<<6)

    function keys are skipped by keys iterator.

See Also
  codes_keys_iterator_new

#define CODES_KEYS_ITERATOR_SKIP_OPTIONAL (1<<1)

    optional keys are skipped by keys iterator.

See Also
  codes_keys_iterator_new

#define CODES_KEYS_ITERATOR_SKIP_READ_ONLY (1<<0)

    read only keys are skipped by keys iterator.

See Also
  codes_keys_iterator_new

## Function Documentation

int codes_keys_iterator_delete | ( | codes_keys_iterator * | kiter | ) |

Delete the iterator.

Parameters

  kiter | : valid codes_keys_iterator

Returns
  0 if OK, integer value on error

const char* codes_keys_iterator_get_name | ( | codes_keys_iterator * | kiter | ) |

get the key name from the iterator

Parameters

  kiter | : valid codes_keys_iterator

Returns
  key name

codes_keys_iterator* codes_keys_iterator_new | ( | codes_handle * | h,
|  | unsigned long | filter_flags,
|  | const char * | name_space
| ) |  |

Create a new iterator from a valid and initialised handle.

Parameters

  h | : the handle whose keys you want to iterate
  filter_flags | : flags to filter out some of the keys through their attributes
  name_space | : if not null the iteration is carried out only on keys belonging to the namespace passed. (NULL for all the keys)

Returns
  keys iterator ready to iterate through keys according to filter_flags and namespace

int codes_keys_iterator_next | ( | codes_keys_iterator * | kiter | ) |

Step to the next iterator.

Parameters

  kiter | : valid codes_keys_iterator

Returns
  1 if next iterator exists, 0 if no more elements to iterate on

int codes_keys_iterator_rewind | ( | codes_keys_iterator * | kiter | ) |

Rewind the iterator.

Parameters

  kiter | : valid codes_keys_iterator

Returns
  0 if OK, integer value on error