hgrib-0.1.0.0: Unofficial bindings for GRIB API

Copyright(c) Mattias Jakobsson 2015
LicenseGPL-3
Maintainermjakob422@gmail.com
Stabilityunstable
Portabilityportable
Safe HaskellSafe
LanguageHaskell2010

Data.Grib.Raw.KeysIterator

Contents

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.

Most of the documentation herein was copied from the official documentation of grib_api.

Synopsis

The GRIB Keys Iterator

newtype GribKeysIterator Source

Grib keys iterator. Iterator over keys.

gribKeysIteratorNew Source

Arguments

:: GribHandle

the handle whose keys you want to iterate

-> [GribKeysIteratorFlag]

flags to filter out some of the keys through their attributes

-> Maybe String

if not Nothing, the iteration is carried out only on keys belonging to the namespace passed

-> IO GribKeysIterator

an IO action that will return the new iterator

Create a new iterator from a valid and initialized handle.

The returned iterator needs to be manually deleted with gribKeysIteratorDelete. However, due to the reason given in that function, withGribKeysIterator should be preferred over this function.

This operation may fail with:

  • NullPtrReturned if the handle is invalid or the memory allocation fails.

gribKeysIteratorNext :: GribKeysIterator -> IO Bool Source

Try to step to the next key and return True if successful.

gribKeysIteratorGetName :: GribKeysIterator -> IO Key Source

Get the key name from the iterator.

gribKeysIteratorRewind :: GribKeysIterator -> IO () Source

Rewind the iterator.

gribKeysIteratorDelete :: GribKeysIterator -> IO () Source

Delete the iterator.

If the GribHandle used to create the iterator has been garbage collected by the time this function is called, the behavior is undefined. Because of this, withGribKeysIterator should be preferred over directly using gribKeysIteratorNew and this function.

withGribKeysIterator Source

Arguments

:: GribHandle

the handle whose keys you want to iterate

-> [GribKeysIteratorFlag]

flags to filter out some of the keys through their attributes

-> Maybe String

if not Nothing, the iteration is carried out only on keys belonging to the namespace passed

-> (GribKeysIterator -> IO a)

a function that will be called with the newly created iterator

-> IO a

the result of the above function

Safely create, use and delete a GribKeysIterator.

This function should be preferred over directly using gribKeysIteratorNew and gribKeysIteratorDelete.

This operation may fail with:

  • NullPtrReturned if the handle is invalid or the memory allocation fails.

Iterator flags

gribKeysIteratorSetFlags :: GribKeysIterator -> [GribKeysIteratorFlag] -> IO () Source

Update the flags of the iterator.