From 8529fc3a1f6d3e2a6cfeecf118928b3d1c550698 Mon Sep 17 00:00:00 2001 From: Eugen Betke Date: Tue, 19 Mar 2024 12:17:17 +0000 Subject: [PATCH] Enable disabled BUFR function calls --- src/grib_bufr_descriptor.cc | 9 +++------ src/grib_query.cc | 12 +++--------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/grib_bufr_descriptor.cc b/src/grib_bufr_descriptor.cc index ef6bc1fbc..6b7f2b3ce 100644 --- a/src/grib_bufr_descriptor.cc +++ b/src/grib_bufr_descriptor.cc @@ -9,16 +9,13 @@ */ -#include "grib_scaling.h" #include "grib_api_internal.h" +#include "accessor/grib_accessor_class_bufr_data_array.h" +#include "grib_scaling.h" bufr_descriptor* grib_bufr_descriptor_new(grib_accessor* tables_accessor, int code, int silent, int* err) { - // ===== TODO(maee): Enable this when grib_accessor_class_bufr_elements_table.cc is moved to C++ ===== - throw std::runtime_error("grib_bufr_descriptor_new not implemented"); - bufr_descriptor* ret = NULL; - //bufr_descriptor* ret = accessor_bufr_elements_table_get_descriptor(tables_accessor, code, err); - // ===== END TODO ===== + bufr_descriptor* ret = accessor_bufr_elements_table_get_descriptor(tables_accessor, code, err); if (!silent && *err) grib_context_log(tables_accessor->context, GRIB_LOG_ERROR, "unable to get descriptor %06d from table", code); diff --git a/src/grib_query.cc b/src/grib_query.cc index e8d82541d..7b2ecb08a 100644 --- a/src/grib_query.cc +++ b/src/grib_query.cc @@ -14,6 +14,7 @@ * * ***************************************************************************/ #include "grib_api_internal.h" +#include "accessor/grib_accessor_class_bufr_data_array.h" /* Note: A fast cut-down version of strcmp which does NOT return -1 */ /* 0 means input strings are equal and 1 means not equal */ @@ -213,11 +214,7 @@ static char* get_condition(const char* name, codes_condition* condition) static grib_accessor* _search_by_rank(grib_accessor* a, const char* name, int rank) { - // ===== TODO(maee): Enable when grib_accessor_class_bufr_data_array.cc is moved to C++ ===== - throw "grib_accessor_class_bufr_data_array.cc is not yet moved to C++"; - grib_trie_with_rank* t = NULL; - //grib_trie_with_rank* t = accessor_bufr_data_array_get_dataAccessorsTrie(a); - // ===== END TODO ===== + grib_trie_with_rank* t = accessor_bufr_data_array_get_dataAccessorsTrie(a); grib_accessor* ret = (grib_accessor*)grib_trie_with_rank_get(t, name, rank); return ret; } @@ -438,10 +435,7 @@ static grib_accessors_list* search_by_condition(grib_handle* h, const char* name grib_accessors_list* result = NULL; grib_accessor* data = search_and_cache(h, "dataAccessors", 0); if (data && condition->left) { - // ===== TODO(maee): Enable when grib_accessor_class_bufr_data_array.cc is moved to C++ ===== - //al = accessor_bufr_data_array_get_dataAccessors(data); - throw "grib_accessor_class_bufr_data_array.cc is not yet moved to C++"; - // ===== END TODO ===== + al = accessor_bufr_data_array_get_dataAccessors(data); if (!al) return NULL; result = (grib_accessors_list*)grib_context_malloc_clear(al->accessor->context, sizeof(grib_accessors_list));