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); CODES_CHECK(codes_set_long(h,"unpack",1),0);
/* get BUFR key iterator */ /* get BUFR key iterator */
kiter=codes_bufr_keys_iterator_new(h); kiter=codes_bufr_keys_iterator_new(h,0);
if (!kiter) { if (!kiter) {
printf("ERROR: Unable to create BUFR keys iterator\n"); printf("ERROR: Unable to create BUFR keys iterator\n");
exit(1); exit(1);

View File

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

View File

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

View File

@ -10,7 +10,7 @@
#include "grib_api_internal.h" #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; 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)); ki= (bufr_keys_iterator*)grib_context_malloc_clear(h->context,sizeof(bufr_keys_iterator));
if (!ki) return NULL; if (!ki) return NULL;
ki->filter_flags = filter_flags;
ki->handle = h; ki->handle = h;
Assert(h->product_kind == PRODUCT_BUFR); Assert(h->product_kind == PRODUCT_BUFR);
ki->names = NULL; ki->names = NULL;

View File

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

View File

@ -1353,7 +1353,6 @@ struct grib_keys_iterator{
grib_handle *handle; grib_handle *handle;
unsigned long filter_flags; /** flags to filter out accessors */ unsigned long filter_flags; /** flags to filter out accessors */
unsigned long accessor_flags_skip; unsigned long accessor_flags_skip;
unsigned long accessor_flags_only;
grib_accessor *current; grib_accessor *current;
char *name_space; char *name_space;
int at_start; int at_start;
@ -1367,6 +1366,7 @@ struct grib_keys_iterator{
/* BUFR-specific keys iterator */ /* BUFR-specific keys iterator */
struct bufr_keys_iterator{ struct bufr_keys_iterator{
grib_handle* handle; grib_handle* handle;
unsigned long filter_flags; /** flags to filter out accessors */
unsigned long accessor_flags_skip; unsigned long accessor_flags_skip;
unsigned long accessor_flags_only; unsigned long accessor_flags_only;
grib_accessor* current; 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); int grib_keys_iterator_get_native_type(grib_keys_iterator *kiter);
/* bufr_keys_iterator.c */ /* 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); 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_rewind(bufr_keys_iterator *ki);
int codes_bufr_keys_iterator_next(bufr_keys_iterator *kiter); 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); CODES_CHECK(codes_set_long(h,"unpack",1), 0);
/*kiter=codes_bufr_data_section_keys_iterator_new(h);*/ /*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)) while(codes_bufr_keys_iterator_next(kiter))
{ {
char* kname = codes_bufr_keys_iterator_get_name(kiter); char* kname = codes_bufr_keys_iterator_get_name(kiter);