Skip to content

Commit

Permalink
Modernisation: Dumper
Browse files Browse the repository at this point in the history
  • Loading branch information
joobog committed Dec 17, 2024
1 parent 3d7b6f5 commit a829113
Show file tree
Hide file tree
Showing 133 changed files with 11,743 additions and 10,807 deletions.
37 changes: 18 additions & 19 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#

include_directories(
"${CMAKE_CURRENT_SOURCE_DIR}/dumper"
"${CMAKE_CURRENT_SOURCE_DIR}/accessor"
"${CMAKE_CURRENT_SOURCE_DIR}/geo_iterator"
"${CMAKE_CURRENT_SOURCE_DIR}/geo_nearest"
Expand Down Expand Up @@ -272,23 +273,22 @@ list( APPEND eccodes_src_files
accessor/grib_accessor_class_reference_value_error.cc
grib_memory.cc
grib_buffer.cc
grib_dumper.cc
grib_dumper_class_serialize.cc
grib_dumper_class_debug.cc
grib_dumper_class_default.cc
grib_dumper_class_bufr_encode_C.cc
grib_dumper_class_bufr_encode_filter.cc
grib_dumper_class_bufr_encode_fortran.cc
grib_dumper_class_bufr_encode_python.cc
grib_dumper_class_bufr_decode_C.cc
grib_dumper_class_bufr_decode_filter.cc
grib_dumper_class_bufr_decode_fortran.cc
grib_dumper_class_bufr_decode_python.cc
grib_dumper_class_bufr_simple.cc
grib_dumper_class_json.cc
grib_dumper_class_grib_encode_C.cc
grib_dumper_class_wmo.cc
grib_dumper_class.cc
dumper/grib_dumper.cc
dumper/grib_dumper_class_serialize.cc
dumper/grib_dumper_class_debug.cc
dumper/grib_dumper_class_default.cc
dumper/grib_dumper_class_bufr_encode_C.cc
dumper/grib_dumper_class_bufr_encode_filter.cc
dumper/grib_dumper_class_bufr_encode_fortran.cc
dumper/grib_dumper_class_bufr_encode_python.cc
dumper/grib_dumper_class_bufr_decode_C.cc
dumper/grib_dumper_class_bufr_decode_filter.cc
dumper/grib_dumper_class_bufr_decode_fortran.cc
dumper/grib_dumper_class_bufr_decode_python.cc
dumper/grib_dumper_class_bufr_simple.cc
dumper/grib_dumper_class_json.cc
dumper/grib_dumper_class_grib_encode_C.cc
dumper/grib_dumper_class_wmo.cc
grib_context.cc
grib_date.cc
grib_fieldset.cc
Expand Down Expand Up @@ -361,8 +361,7 @@ list( APPEND eccodes_src_files
grib_accessor_factory.h
grib_api_internal.h
eccodes_prototypes.h
grib_dumper_class.h
grib_dumper_factory.h
grib_dumper_factory.cc
grib_iterator_factory.cc
grib_nearest_factory.cc
grib_yacc.h
Expand Down
1 change: 0 additions & 1 deletion src/accessor/grib_accessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
***************************************************************************/

#include "grib_accessor.h"
#include <iostream>

// Note: A fast cut-down version of strcmp which does NOT return -1
// 0 means input strings are equal and 1 means not equal
Expand Down
7 changes: 5 additions & 2 deletions src/accessor/grib_accessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@
#pragma once

#include "grib_api_internal.h"
#include "grib_dumper.h"
#include "grib_value.h"
#include "dumper/grib_dumper.h"

namespace eccodes {
class Dumper;
}

class grib_accessor {
public:
Expand Down
2 changes: 1 addition & 1 deletion src/accessor/grib_accessor_class_ascii.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ size_t grib_accessor_ascii_t::string_length()

void grib_accessor_ascii_t::dump(eccodes::Dumper* dumper)
{
grib_dump_string(dumper, this, NULL);
dumper->dump_string(this, NULL);
}

long grib_accessor_ascii_t::get_native_type()
Expand Down
2 changes: 1 addition & 1 deletion src/accessor/grib_accessor_class_bitmap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void grib_accessor_bitmap_t::dump(eccodes::Dumper* dumper)

value_count(&len);
snprintf(label, sizeof(label), "Bitmap of %ld values", len);
grib_dump_bytes(dumper, this, label);
dumper->dump_bytes(this, label);
}

int grib_accessor_bitmap_t::unpack_long(long* val, size_t* len)
Expand Down
2 changes: 1 addition & 1 deletion src/accessor/grib_accessor_class_blob.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ int grib_accessor_blob_t::unpack_bytes(unsigned char* buffer, size_t* len)

void grib_accessor_blob_t::dump(eccodes::Dumper* dumper)
{
grib_dump_bytes(dumper, this, NULL);
dumper->dump_bytes(this, NULL);
}
2 changes: 1 addition & 1 deletion src/accessor/grib_accessor_class_bufr_data_array.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3229,7 +3229,7 @@ void grib_accessor_bufr_data_array_t::dump(eccodes::Dumper* dumper)
{
// grib_accessor_bufr_data_array_t *self =(grib_accessor_bufr_data_array_t*)a;
// int err=process_elements(a,PROCESS_DECODE);
// grib_dump_section(dumper,a,self->dataKeys_ ->block);
// dumper->dump_section(a,self->dataKeys_ ->block);
return;
}

Expand Down
6 changes: 3 additions & 3 deletions src/accessor/grib_accessor_class_bufr_data_element.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ void grib_accessor_bufr_data_element_t::dump(eccodes::Dumper* dumper)

switch (ntype) {
case GRIB_TYPE_LONG:
grib_dump_long(dumper, this, NULL);
dumper->dump_long(this, NULL);
break;
case GRIB_TYPE_DOUBLE:
grib_dump_values(dumper, this);
dumper->dump_values(this);
break;
case GRIB_TYPE_STRING:
grib_dump_string_array(dumper, this, NULL);
dumper->dump_string_array(this, NULL);
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/accessor/grib_accessor_class_bufr_group.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ grib_accessor* grib_accessor_bufr_group = &_grib_accessor_bufr_group;

void grib_accessor_bufr_group_t::dump(eccodes::Dumper* dumper)
{
grib_dump_section(dumper, this, sub_section_->block);
dumper->dump_section(this, sub_section_->block);
}

grib_accessor* grib_accessor_bufr_group_t::next(grib_accessor* a, int explore)
Expand Down
2 changes: 1 addition & 1 deletion src/accessor/grib_accessor_class_bufr_string_values.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void grib_accessor_bufr_string_values_t::init(const long len, grib_arguments* ar

void grib_accessor_bufr_string_values_t::dump(eccodes::Dumper* dumper)
{
grib_dump_string_array(dumper, this, NULL);
dumper->dump_string_array(this, NULL);
}

grib_accessor* grib_accessor_bufr_string_values_t::get_accessor()
Expand Down
2 changes: 1 addition & 1 deletion src/accessor/grib_accessor_class_closest_date.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void grib_accessor_closest_date_t::init(const long l, grib_arguments* c)

void grib_accessor_closest_date_t::dump(eccodes::Dumper* dumper)
{
grib_dump_string(dumper, this, NULL);
dumper->dump_string(this, NULL);
}

int grib_accessor_closest_date_t::unpack_long(long* val, size_t* len)
Expand Down
2 changes: 1 addition & 1 deletion src/accessor/grib_accessor_class_codeflag.cc
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,5 @@ void grib_accessor_codeflag_t::dump(eccodes::Dumper* dumper)
unpack_long(&v, &llen);
grib_get_codeflag(v, flagname);

grib_dump_bits(dumper, this, flagname);
dumper->dump_bits(this, flagname);
}
2 changes: 1 addition & 1 deletion src/accessor/grib_accessor_class_codetable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ void grib_accessor_codetable_t::dump(eccodes::Dumper* dumper)
}
strcat(comment, ") ");

grib_dump_long(dumper, this, comment);
dumper->dump_long(this, comment);
}

int grib_accessor_codetable_t::unpack_string(char* buffer, size_t* len)
Expand Down
2 changes: 1 addition & 1 deletion src/accessor/grib_accessor_class_concept.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void grib_accessor_concept_t::init(const long len, grib_arguments* args)

void grib_accessor_concept_t::dump(eccodes::Dumper* dumper)
{
grib_dump_string(dumper, this, NULL);
dumper->dump_string(this, NULL);
}

// See ECC-1905
Expand Down
2 changes: 1 addition & 1 deletion src/accessor/grib_accessor_class_data_apply_bitmap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void grib_accessor_data_apply_bitmap_t::init(const long v, grib_arguments* args)
}
void grib_accessor_data_apply_bitmap_t::dump(eccodes::Dumper* dumper)
{
grib_dump_values(dumper, this);
dumper->dump_values(this);
}

int grib_accessor_data_apply_bitmap_t::value_count(long* count)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void grib_accessor_data_apply_boustrophedonic_t::init(const long v, grib_argumen
}
void grib_accessor_data_apply_boustrophedonic_t::dump(eccodes::Dumper* dumper)
{
grib_dump_values(dumper, this);
dumper->dump_values(this);
}

int grib_accessor_data_apply_boustrophedonic_t::value_count(long* numberOfPoints)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void grib_accessor_data_apply_boustrophedonic_bitmap_t::init(const long v, grib_

void grib_accessor_data_apply_boustrophedonic_bitmap_t::dump(eccodes::Dumper* dumper)
{
grib_dump_values(dumper, this);
dumper->dump_values(this);
}

int grib_accessor_data_apply_boustrophedonic_bitmap_t::value_count(long* count)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ long number_of_bits(grib_handle* h, unsigned long x)
n++;
i++;
if (i >= count) {
/*grib_dump_content(h, stdout,"debug", ~0, NULL);*/
/*h->dump_content(stdout,"debug", ~0, NULL);*/
grib_context_log(h->context, GRIB_LOG_FATAL,
"grib_accessor_data_g1second_order_general_extended_packing: Number out of range: %ld", x);
}
Expand Down
2 changes: 1 addition & 1 deletion src/accessor/grib_accessor_class_data_secondary_bitmap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void grib_accessor_data_secondary_bitmap_t::init(const long v, grib_arguments* a

void grib_accessor_data_secondary_bitmap_t::dump(eccodes::Dumper* dumper)
{
grib_dump_values(dumper, this);
dumper->dump_values(this);
}

int grib_accessor_data_secondary_bitmap_t::unpack_double(double* val, size_t* len)
Expand Down
2 changes: 1 addition & 1 deletion src/accessor/grib_accessor_class_data_shsimple_packing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void grib_accessor_data_shsimple_packing_t::init(const long v, grib_arguments* a

void grib_accessor_data_shsimple_packing_t::dump(eccodes::Dumper* dumper)
{
grib_dump_values(dumper, this);
dumper->dump_values(this);
}

int grib_accessor_data_shsimple_packing_t::pack_double(const double* val, size_t* len)
Expand Down
6 changes: 3 additions & 3 deletions src/accessor/grib_accessor_class_dictionary.cc
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,13 @@ void grib_accessor_dictionary_t::dump(eccodes::Dumper* dumper)
{
switch (get_native_type()) {
case GRIB_TYPE_STRING:
grib_dump_string(dumper, this, NULL);
dumper->dump_string(this, NULL);
break;
case GRIB_TYPE_LONG:
grib_dump_long(dumper, this, NULL);
dumper->dump_long(this, NULL);
break;
case GRIB_TYPE_DOUBLE:
grib_dump_double(dumper, this, NULL);
dumper->dump_double(this, NULL);
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/accessor/grib_accessor_class_double.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ int grib_accessor_double_t::unpack_string(char* v, size_t* len)

void grib_accessor_double_t::dump(eccodes::Dumper* dumper)
{
grib_dump_values(dumper, this);
dumper->dump_values(this);
}

int grib_accessor_double_t::compare(grib_accessor* b)
Expand Down
2 changes: 1 addition & 1 deletion src/accessor/grib_accessor_class_g1_half_byte_codeflag.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void grib_accessor_g1_half_byte_codeflag_t::init(const long len, grib_arguments*

void grib_accessor_g1_half_byte_codeflag_t::dump(eccodes::Dumper* dumper)
{
grib_dump_long(dumper, this, NULL);
dumper->dump_long(this, NULL);
}

int grib_accessor_g1_half_byte_codeflag_t::unpack_long(long* val, size_t* len)
Expand Down
2 changes: 1 addition & 1 deletion src/accessor/grib_accessor_class_g1day_of_the_year_date.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void grib_accessor_g1day_of_the_year_date_t::init(const long l, grib_arguments*

void grib_accessor_g1day_of_the_year_date_t::dump(eccodes::Dumper* dumper)
{
grib_dump_string(dumper, this, NULL);
dumper->dump_string(this, NULL);
}

int grib_accessor_g1day_of_the_year_date_t::unpack_string(char* val, size_t* len)
Expand Down
2 changes: 1 addition & 1 deletion src/accessor/grib_accessor_class_g1forecastmonth.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void grib_accessor_g1forecastmonth_t::init(const long l, grib_arguments* c)

void grib_accessor_g1forecastmonth_t::dump(eccodes::Dumper* dumper)
{
grib_dump_long(dumper, this, NULL);
dumper->dump_long(this, NULL);
}

static int calculate_fcmonth(grib_accessor* a, long verification_yearmonth, long base_date, long day, long hour, long* result)
Expand Down
2 changes: 1 addition & 1 deletion src/accessor/grib_accessor_class_g1step_range.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void grib_accessor_g1step_range_t::init(const long l, grib_arguments* c)

void grib_accessor_g1step_range_t::dump(eccodes::Dumper* dumper)
{
grib_dump_string(dumper, this, NULL);
dumper->dump_string(this, NULL);
}

static const int u2s1[] = {
Expand Down
2 changes: 1 addition & 1 deletion src/accessor/grib_accessor_class_g2end_step.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void grib_accessor_g2end_step_t::init(const long l, grib_arguments* c)

void grib_accessor_g2end_step_t::dump(eccodes::Dumper* dumper)
{
grib_dump_double(dumper, this, NULL);
dumper->dump_double(this, NULL);
}

// See GRIB-488
Expand Down
2 changes: 1 addition & 1 deletion src/accessor/grib_accessor_class_g2step_range.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void grib_accessor_g2step_range_t::init(const long l, grib_arguments* c)

// static void dump(grib_accessor* a, eccodes::Dumper* dumper)
//{
// grib_dump_string(dumper, a, NULL);
// dumper->dump_string(a, NULL);
//}

int grib_accessor_g2step_range_t::unpack_string(char* val, size_t* len)
Expand Down
1 change: 1 addition & 0 deletions src/accessor/grib_accessor_class_gen.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#include "grib_api_internal.h"
#include "grib_accessor.h"
#include "grib_value.h"
#include <bitset>


Expand Down
2 changes: 1 addition & 1 deletion src/accessor/grib_accessor_class_group.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ size_t grib_accessor_group_t::string_length()

void grib_accessor_group_t::dump(eccodes::Dumper* dumper)
{
grib_dump_string(dumper, this, NULL);
dumper->dump_string(this, NULL);
}

long grib_accessor_group_t::get_native_type()
Expand Down
2 changes: 1 addition & 1 deletion src/accessor/grib_accessor_class_hash_array.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void grib_accessor_hash_array_t::init(const long len, grib_arguments* args)

void grib_accessor_hash_array_t::dump(eccodes::Dumper* dumper)
{
grib_dump_string(dumper, this, NULL);
dumper->dump_string(this, NULL);
}

int grib_accessor_hash_array_t::pack_double(const double* val, size_t* len)
Expand Down
2 changes: 1 addition & 1 deletion src/accessor/grib_accessor_class_iterator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ void grib_accessor_iterator_t::init(const long l, grib_arguments* args)
void grib_accessor_iterator_t::dump(eccodes::Dumper* dumper)
{
/* TODO: pass args */
grib_dump_label(dumper, this, NULL);
dumper->dump_label(this, NULL);
}
2 changes: 1 addition & 1 deletion src/accessor/grib_accessor_class_julian_date.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void grib_accessor_julian_date_t::init(const long l, grib_arguments* c)

void grib_accessor_julian_date_t::dump(eccodes::Dumper* dumper)
{
grib_dump_string(dumper, this, NULL);
dumper->dump_string(this, NULL);
}

int grib_accessor_julian_date_t::unpack_double(double* val, size_t* len)
Expand Down
2 changes: 1 addition & 1 deletion src/accessor/grib_accessor_class_julian_day.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void grib_accessor_julian_day_t::init(const long l, grib_arguments* c)

void grib_accessor_julian_day_t::dump(eccodes::Dumper* dumper)
{
grib_dump_string(dumper, this, NULL);
dumper->dump_string(this, NULL);
}

int grib_accessor_julian_day_t::pack_long(const long* val, size_t* len)
Expand Down
2 changes: 1 addition & 1 deletion src/accessor/grib_accessor_class_label.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void grib_accessor_label_t::init(const long len, grib_arguments* arg)

void grib_accessor_label_t::dump(eccodes::Dumper* dumper)
{
grib_dump_label(dumper, this, NULL);
dumper->dump_label(this, NULL);
}

long grib_accessor_label_t::get_native_type()
Expand Down
2 changes: 1 addition & 1 deletion src/accessor/grib_accessor_class_long.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ long grib_accessor_long_t::get_native_type()

void grib_accessor_long_t::dump(eccodes::Dumper* dumper)
{
grib_dump_long(dumper, this, NULL);
dumper->dump_long(this, NULL);
}

int grib_accessor_long_t::unpack_string(char* v, size_t* len)
Expand Down
2 changes: 1 addition & 1 deletion src/accessor/grib_accessor_class_lookup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void grib_accessor_lookup_t::dump(eccodes::Dumper* dumper)

snprintf(buf, sizeof(buf), "%s %lu %ld-%ld", msg, v, (long)offset_ + loffset_, (long)llength_);

grib_dump_long(dumper, this, buf);
dumper->dump_long(this, buf);
}

int grib_accessor_lookup_t::unpack_string(char* v, size_t* len)
Expand Down
Loading

0 comments on commit a829113

Please sign in to comment.