From cc4ef5a62d49376ff0276978a90bd4e79a1abc88 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Fri, 30 Dec 2022 17:13:20 +0000 Subject: [PATCH] ECC-1467: Add codes_keys_iterator_get_float --- src/eccodes.c | 6 ++++++ src/eccodes.h | 1 + src/eccodes_prototypes.h | 1 + src/grib_api.h | 1 + src/grib_keys_iterator.c | 4 ++++ 5 files changed, 13 insertions(+) diff --git a/src/eccodes.c b/src/eccodes.c index ec5e538e3..8c696788e 100644 --- a/src/eccodes.c +++ b/src/eccodes.c @@ -472,10 +472,16 @@ int codes_keys_iterator_get_long(const grib_keys_iterator* kiter, long* v, size_ { return grib_keys_iterator_get_long(kiter, v, len); } + int codes_keys_iterator_get_double(const grib_keys_iterator* kiter, double* v, size_t* len) { return grib_keys_iterator_get_double(kiter, v, len); } +int codes_keys_iterator_get_float(const grib_keys_iterator* kiter, float* v, size_t* len) +{ + return grib_keys_iterator_get_float(kiter, v, len); +} + int codes_keys_iterator_get_string(const grib_keys_iterator* kiter, char* v, size_t* len) { return grib_keys_iterator_get_string(kiter, v, len); diff --git a/src/eccodes.h b/src/eccodes.h index dfe7d53be..d65c53cec 100644 --- a/src/eccodes.h +++ b/src/eccodes.h @@ -1316,6 +1316,7 @@ int codes_keys_iterator_rewind(codes_keys_iterator* kiter); int codes_keys_iterator_set_flags(codes_keys_iterator* kiter, unsigned long flags); int codes_keys_iterator_get_long(const codes_keys_iterator* kiter, long* v, size_t* len); int codes_keys_iterator_get_double(const codes_keys_iterator* kiter, double* v, size_t* len); +int codes_keys_iterator_get_float(const codes_keys_iterator* kiter, float* v, size_t* len); int codes_keys_iterator_get_string(const codes_keys_iterator* kiter, char* v, size_t* len); int codes_keys_iterator_get_bytes(const codes_keys_iterator* kiter, unsigned char* v, size_t* len); diff --git a/src/eccodes_prototypes.h b/src/eccodes_prototypes.h index f9d1524e1..f0d38bcb8 100644 --- a/src/eccodes_prototypes.h +++ b/src/eccodes_prototypes.h @@ -1153,6 +1153,7 @@ grib_accessor* grib_keys_iterator_get_accessor(grib_keys_iterator* kiter); int grib_keys_iterator_delete(grib_keys_iterator* kiter); int grib_keys_iterator_get_long(const grib_keys_iterator* kiter, long* v, size_t* len); int grib_keys_iterator_get_double(const grib_keys_iterator* kiter, double* v, size_t* len); +int grib_keys_iterator_get_float(const grib_keys_iterator* kiter, float* v, size_t* len); int grib_keys_iterator_get_string(const grib_keys_iterator* kiter, char* v, size_t* len); int grib_keys_iterator_get_bytes(const grib_keys_iterator* kiter, unsigned char* v, size_t* len); int grib_keys_iterator_get_native_type(const grib_keys_iterator* kiter); diff --git a/src/grib_api.h b/src/grib_api.h index eba9441ab..bc7f5fb51 100644 --- a/src/grib_api.h +++ b/src/grib_api.h @@ -1319,6 +1319,7 @@ int grib_keys_iterator_set_flags(grib_keys_iterator* kiter, unsigned long flags) int grib_keys_iterator_get_long(const grib_keys_iterator* kiter, long* v, size_t* len); int grib_keys_iterator_get_double(const grib_keys_iterator* kiter, double* v, size_t* len); +int grib_keys_iterator_get_float(const grib_keys_iterator* kiter, float* v, size_t* len); int grib_keys_iterator_get_string(const grib_keys_iterator* kiter, char* v, size_t* len); int grib_keys_iterator_get_bytes(const grib_keys_iterator* kiter, unsigned char* v, size_t* len); int codes_copy_key(grib_handle* h1, grib_handle* h2, const char* key, int type); diff --git a/src/grib_keys_iterator.c b/src/grib_keys_iterator.c index aebff8095..854b4a2c5 100644 --- a/src/grib_keys_iterator.c +++ b/src/grib_keys_iterator.c @@ -207,6 +207,10 @@ int grib_keys_iterator_get_double(const grib_keys_iterator* kiter, double* v, si { return grib_unpack_double(kiter->current, v, len); } +int grib_keys_iterator_get_float(const grib_keys_iterator* kiter, float* v, size_t* len) +{ + return grib_unpack_float(kiter->current, v, len); +} int grib_keys_iterator_get_string(const grib_keys_iterator* kiter, char* v, size_t* len) {