Copyright | (c) Mattias Jakobsson 2015 |
---|---|
License | GPL-3 |
Maintainer | mjakob422@gmail.com |
Stability | unstable |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
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.
- newtype GribKeysIterator = GribKeysIterator (Ptr GribKeysIterator)
- gribKeysIteratorNew :: GribHandle -> [GribKeysIteratorFlag] -> Maybe String -> IO GribKeysIterator
- gribKeysIteratorNext :: GribKeysIterator -> IO Bool
- gribKeysIteratorGetName :: GribKeysIterator -> IO Key
- gribKeysIteratorRewind :: GribKeysIterator -> IO ()
- gribKeysIteratorDelete :: GribKeysIterator -> IO ()
- withGribKeysIterator :: GribHandle -> [GribKeysIteratorFlag] -> Maybe String -> (GribKeysIterator -> IO a) -> IO a
- data GribKeysIteratorFlag
- gribKeysIteratorSetFlags :: GribKeysIterator -> [GribKeysIteratorFlag] -> IO ()
The GRIB Keys Iterator
newtype GribKeysIterator Source
Grib keys iterator. Iterator over keys.
:: 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 |
-> 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.
:: 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 |
-> (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
data GribKeysIteratorFlag Source
Filter flags for GribKeysIterator
.
gribKeysIteratorSetFlags :: GribKeysIterator -> [GribKeysIteratorFlag] -> IO () Source
Update the flags of the iterator.