ECC-424: Allow for filtering the bufr_keys_iter flags (Future)

This commit is contained in:
Shahram Najm 2017-02-06 16:47:23 +00:00
parent e769ac8fd8
commit 947b4cd9b7
8 changed files with 9 additions and 8 deletions

View File

@ -66,7 +66,7 @@ int main(int argc,char* argv[])
CODES_CHECK(codes_set_long(h,"unpack",1),0);
/* get BUFR key iterator */
kiter=codes_bufr_keys_iterator_new(h);
kiter=codes_bufr_keys_iterator_new(h,0);
if (!kiter) {
printf("ERROR: Unable to create BUFR keys iterator\n");
exit(1);

View File

@ -1367,7 +1367,7 @@ static int _codes_f_bufr_keys_iterator_new_(int* gid,int* iterid) {
return GRIB_NULL_HANDLE;
}
Assert(h->product_kind==PRODUCT_BUFR);
iter=codes_bufr_keys_iterator_new(h);
iter=codes_bufr_keys_iterator_new(h,0);
if (iter)
*iterid=push_bufr_keys_iterator(iter);
else

View File

@ -1031,7 +1031,7 @@ static int _codes_c_bufr_keys_iterator_new_(int* gid,int* iterid)
*iterid=-1;
return GRIB_NULL_HANDLE;
}
iter=codes_bufr_keys_iterator_new(h);
iter=codes_bufr_keys_iterator_new(h,0);
if (iter)
*iterid=push_bufr_keys_iterator(iter);
else

View File

@ -10,7 +10,7 @@
#include "grib_api_internal.h"
bufr_keys_iterator* codes_bufr_keys_iterator_new(grib_handle* h)
bufr_keys_iterator* codes_bufr_keys_iterator_new(grib_handle* h, unsigned long filter_flags)
{
bufr_keys_iterator* ki=NULL;
@ -25,6 +25,7 @@ bufr_keys_iterator* codes_bufr_keys_iterator_new(grib_handle* h)
ki= (bufr_keys_iterator*)grib_context_malloc_clear(h->context,sizeof(bufr_keys_iterator));
if (!ki) return NULL;
ki->filter_flags = filter_flags;
ki->handle = h;
Assert(h->product_kind == PRODUCT_BUFR);
ki->names = NULL;

View File

@ -1254,7 +1254,7 @@ attributes or by the namespace they belong to.
* and namespace
*/
grib_keys_iterator* grib_keys_iterator_new(grib_handle* h,unsigned long filter_flags, const char* name_space);
bufr_keys_iterator* codes_bufr_keys_iterator_new(grib_handle* h);
bufr_keys_iterator* codes_bufr_keys_iterator_new(grib_handle* h, unsigned long filter_flags);
bufr_keys_iterator* codes_bufr_data_section_keys_iterator_new(grib_handle* h);
/*! Step to the next iterator.

View File

@ -1353,7 +1353,6 @@ struct grib_keys_iterator{
grib_handle *handle;
unsigned long filter_flags; /** flags to filter out accessors */
unsigned long accessor_flags_skip;
unsigned long accessor_flags_only;
grib_accessor *current;
char *name_space;
int at_start;
@ -1367,6 +1366,7 @@ struct grib_keys_iterator{
/* BUFR-specific keys iterator */
struct bufr_keys_iterator{
grib_handle* handle;
unsigned long filter_flags; /** flags to filter out accessors */
unsigned long accessor_flags_skip;
unsigned long accessor_flags_only;
grib_accessor* current;

View File

@ -1144,7 +1144,7 @@ int grib_keys_iterator_get_bytes(grib_keys_iterator *kiter, unsigned char *v, si
int grib_keys_iterator_get_native_type(grib_keys_iterator *kiter);
/* bufr_keys_iterator.c */
bufr_keys_iterator *codes_bufr_keys_iterator_new(grib_handle *h);
bufr_keys_iterator *codes_bufr_keys_iterator_new(grib_handle *h, unsigned long filter_flags);
bufr_keys_iterator *codes_bufr_data_section_keys_iterator_new(grib_handle *h);
int codes_bufr_keys_iterator_rewind(bufr_keys_iterator *ki);
int codes_bufr_keys_iterator_next(bufr_keys_iterator *kiter);

View File

@ -36,7 +36,7 @@ int main(int argc,char* argv[])
CODES_CHECK(codes_set_long(h,"unpack",1), 0);
/*kiter=codes_bufr_data_section_keys_iterator_new(h);*/
kiter = codes_bufr_keys_iterator_new(h);
kiter = codes_bufr_keys_iterator_new(h, 0);
while(codes_bufr_keys_iterator_next(kiter))
{
char* kname = codes_bufr_keys_iterator_get_name(kiter);