From b8aeecafa20378578ddc8298252c3c571e7e9a39 Mon Sep 17 00:00:00 2001 From: kevstone Date: Fri, 14 Jul 2023 16:00:46 +0100 Subject: [PATCH] Interim: New Accessor design with proj_string example. All tests pass --- src/grib_accessor.cc | 153 +++--- src/grib_accessor_class.cc | 13 +- src/grib_accessor_impl/Accessor.cpp | 196 ++++++++ src/grib_accessor_impl/Accessor.h | 140 ++++++ src/grib_accessor_impl/AccessorConcept.h | 64 +++ src/grib_accessor_impl/AccessorFactory.cpp | 105 +++++ src/grib_accessor_impl/AccessorFactory.h | 21 + src/grib_accessor_impl/AccessorMaker.cpp | 37 ++ src/grib_accessor_impl/AccessorMaker.h | 48 ++ src/grib_accessor_impl/AccessorPtr.cpp | 21 + src/grib_accessor_impl/AccessorPtr.h | 31 ++ src/grib_accessor_impl/Accessor_TEMPLATE.h | 62 +++ src/grib_accessor_impl/Accessor_Utils.cpp | 26 ++ src/grib_accessor_impl/Accessor_Utils.h | 13 + src/grib_accessor_impl/CMakeLists.txt | 24 +- src/grib_accessor_impl/Generic.cpp | 87 ++++ src/grib_accessor_impl/Generic.h | 311 +++++++++++++ src/grib_accessor_impl/ProjString.cpp | 75 +++ src/grib_accessor_impl/ProjString.h | 21 + src/grib_accessor_impl_v1/CMakeLists.txt | 28 ++ .../ga_impl_creator_targets.h | 0 .../ga_impl_creators.cpp | 0 .../ga_impl_creators.h | 0 .../grib_accessor_impl.h | 0 ...rib_accessor_impl_abstract_long_vector.cpp | 0 .../grib_accessor_impl_abstract_long_vector.h | 0 .../grib_accessor_impl_factory.cpp | 0 .../grib_accessor_impl_factory.h | 0 .../grib_accessor_impl_g1step_range.cpp | 0 .../grib_accessor_impl_g1step_range.h | 0 .../grib_accessor_impl_gen.cpp | 0 .../grib_accessor_impl_gen.h | 0 .../grib_accessor_impl_helper.cpp | 0 .../grib_accessor_impl_helper.h | 0 .../grib_accessor_impl_proj_string.cpp | 0 .../grib_accessor_impl_proj_string.h | 0 .../grib_cpp_utils.cpp | 0 .../grib_cpp_utils.h | 0 src/grib_accessor_impl_v1/pack_buffer.cpp | 264 +++++++++++ src/grib_accessor_impl_v1/pack_buffer.h | 41 ++ .../proj_string_helper.cpp | 198 ++++++++ .../proj_string_helper.h | 14 + .../templates/grib_accessor_class_list.sh | 434 +++++++++++++++++ .../grib_accessor_class_list_FULL.sh | 438 ++++++++++++++++++ .../templates/grib_accessor_impl_TEMPLATE.cpp | 62 +++ .../templates/grib_accessor_impl_TEMPLATE.h | 72 +++ .../grib_accessor_impl_abstract_vector.cpp | 62 +++ .../grib_accessor_impl_abstract_vector.h | 72 +++ .../grib_accessor_impl_apply_operators.cpp | 62 +++ .../grib_accessor_impl_apply_operators.h | 72 +++ .../templates/grib_accessor_impl_array.cpp | 62 +++ .../templates/grib_accessor_impl_array.h | 72 +++ .../templates/grib_accessor_impl_ascii.cpp | 62 +++ .../templates/grib_accessor_impl_ascii.h | 72 +++ .../templates/grib_accessor_impl_assert.cpp | 62 +++ .../templates/grib_accessor_impl_assert.h | 72 +++ .../templates/grib_accessor_impl_bit.cpp | 62 +++ .../templates/grib_accessor_impl_bit.h | 72 +++ .../templates/grib_accessor_impl_bitmap.cpp | 62 +++ .../templates/grib_accessor_impl_bitmap.h | 72 +++ .../templates/grib_accessor_impl_bits.cpp | 62 +++ .../templates/grib_accessor_impl_bits.h | 72 +++ .../grib_accessor_impl_bits_per_value.cpp | 62 +++ .../grib_accessor_impl_bits_per_value.h | 72 +++ .../templates/grib_accessor_impl_blob.cpp | 62 +++ .../templates/grib_accessor_impl_blob.h | 72 +++ .../templates/grib_accessor_impl_box.cpp | 62 +++ .../templates/grib_accessor_impl_box.h | 72 +++ .../templates/grib_accessor_impl_budgdate.cpp | 62 +++ .../templates/grib_accessor_impl_budgdate.h | 72 +++ .../grib_accessor_impl_bufr_data_array.cpp | 62 +++ .../grib_accessor_impl_bufr_data_array.h | 72 +++ .../grib_accessor_impl_bufr_data_element.cpp | 62 +++ .../grib_accessor_impl_bufr_data_element.h | 72 +++ ...grib_accessor_impl_bufr_elements_table.cpp | 62 +++ .../grib_accessor_impl_bufr_elements_table.h | 72 +++ ...ccessor_impl_bufr_extract_area_subsets.cpp | 62 +++ ..._accessor_impl_bufr_extract_area_subsets.h | 72 +++ ...sor_impl_bufr_extract_datetime_subsets.cpp | 62 +++ ...essor_impl_bufr_extract_datetime_subsets.h | 72 +++ ...rib_accessor_impl_bufr_extract_subsets.cpp | 62 +++ .../grib_accessor_impl_bufr_extract_subsets.h | 72 +++ .../grib_accessor_impl_bufr_group.cpp | 62 +++ .../templates/grib_accessor_impl_bufr_group.h | 72 +++ ...rib_accessor_impl_bufr_simple_thinning.cpp | 62 +++ .../grib_accessor_impl_bufr_simple_thinning.h | 72 +++ .../grib_accessor_impl_bufr_string_values.cpp | 62 +++ .../grib_accessor_impl_bufr_string_values.h | 72 +++ ...essor_impl_bufrdc_expanded_descriptors.cpp | 62 +++ ...ccessor_impl_bufrdc_expanded_descriptors.h | 72 +++ .../templates/grib_accessor_impl_bytes.cpp | 62 +++ .../templates/grib_accessor_impl_bytes.h | 72 +++ ...r_impl_change_alternative_row_scanning.cpp | 62 +++ ...sor_impl_change_alternative_row_scanning.h | 72 +++ ...ccessor_impl_change_scanning_direction.cpp | 62 +++ ..._accessor_impl_change_scanning_direction.h | 72 +++ ...b_accessor_impl_check_internal_version.cpp | 62 +++ ...rib_accessor_impl_check_internal_version.h | 72 +++ .../grib_accessor_impl_closest_date.cpp | 62 +++ .../grib_accessor_impl_closest_date.h | 72 +++ .../templates/grib_accessor_impl_codeflag.cpp | 62 +++ .../templates/grib_accessor_impl_codeflag.h | 72 +++ .../grib_accessor_impl_codetable.cpp | 62 +++ .../templates/grib_accessor_impl_codetable.h | 72 +++ .../grib_accessor_impl_codetable_title.cpp | 62 +++ .../grib_accessor_impl_codetable_title.h | 72 +++ .../grib_accessor_impl_codetable_units.cpp | 62 +++ .../grib_accessor_impl_codetable_units.h | 72 +++ .../templates/grib_accessor_impl_concept.cpp | 62 +++ .../templates/grib_accessor_impl_concept.h | 72 +++ .../templates/grib_accessor_impl_constant.cpp | 62 +++ .../templates/grib_accessor_impl_constant.h | 72 +++ .../grib_accessor_impl_count_file.cpp | 62 +++ .../templates/grib_accessor_impl_count_file.h | 72 +++ .../grib_accessor_impl_count_missing.cpp | 62 +++ .../grib_accessor_impl_count_missing.h | 72 +++ .../grib_accessor_impl_count_total.cpp | 62 +++ .../grib_accessor_impl_count_total.h | 72 +++ ...grib_accessor_impl_data_2order_packing.cpp | 62 +++ .../grib_accessor_impl_data_2order_packing.h | 72 +++ .../grib_accessor_impl_data_apply_bitmap.cpp | 62 +++ .../grib_accessor_impl_data_apply_bitmap.h | 72 +++ ...cessor_impl_data_apply_boustrophedonic.cpp | 62 +++ ...accessor_impl_data_apply_boustrophedonic.h | 72 +++ ...impl_data_apply_boustrophedonic_bitmap.cpp | 62 +++ ...r_impl_data_apply_boustrophedonic_bitmap.h | 72 +++ ...accessor_impl_data_apply_gdsnotpresent.cpp | 62 +++ ...b_accessor_impl_data_apply_gdsnotpresent.h | 72 +++ .../grib_accessor_impl_data_ccsds_packing.cpp | 62 +++ .../grib_accessor_impl_data_ccsds_packing.h | 72 +++ ...rib_accessor_impl_data_complex_packing.cpp | 62 +++ .../grib_accessor_impl_data_complex_packing.h | 72 +++ .../grib_accessor_impl_data_dummy_field.cpp | 62 +++ .../grib_accessor_impl_data_dummy_field.h | 72 +++ ...b_accessor_impl_data_g1complex_packing.cpp | 62 +++ ...rib_accessor_impl_data_g1complex_packing.h | 72 +++ ..._g1second_order_constant_width_packing.cpp | 62 +++ ...ta_g1second_order_constant_width_packing.h | 72 +++ ...1second_order_general_extended_packing.cpp | 62 +++ ..._g1second_order_general_extended_packing.h | 72 +++ ...pl_data_g1second_order_general_packing.cpp | 62 +++ ...impl_data_g1second_order_general_packing.h | 72 +++ ...data_g1second_order_row_by_row_packing.cpp | 62 +++ ...l_data_g1second_order_row_by_row_packing.h | 72 +++ ..._accessor_impl_data_g1secondary_bitmap.cpp | 62 +++ ...ib_accessor_impl_data_g1secondary_bitmap.h | 72 +++ ..._accessor_impl_data_g1shsimple_packing.cpp | 62 +++ ...ib_accessor_impl_data_g1shsimple_packing.h | 72 +++ ...ib_accessor_impl_data_g1simple_packing.cpp | 62 +++ ...grib_accessor_impl_data_g1simple_packing.h | 72 +++ ...ib_accessor_impl_data_g22order_packing.cpp | 62 +++ ...grib_accessor_impl_data_g22order_packing.h | 72 +++ ...accessor_impl_data_g2bifourier_packing.cpp | 62 +++ ...b_accessor_impl_data_g2bifourier_packing.h | 72 +++ ...b_accessor_impl_data_g2complex_packing.cpp | 62 +++ ...rib_accessor_impl_data_g2complex_packing.h | 72 +++ ..._accessor_impl_data_g2secondary_bitmap.cpp | 62 +++ ...ib_accessor_impl_data_g2secondary_bitmap.h | 72 +++ ..._accessor_impl_data_g2shsimple_packing.cpp | 62 +++ ...ib_accessor_impl_data_g2shsimple_packing.h | 72 +++ ...ib_accessor_impl_data_g2simple_packing.cpp | 62 +++ ...grib_accessor_impl_data_g2simple_packing.h | 72 +++ ...ta_g2simple_packing_with_preprocessing.cpp | 62 +++ ...data_g2simple_packing_with_preprocessing.h | 72 +++ ...ib_accessor_impl_data_jpeg2000_packing.cpp | 62 +++ ...grib_accessor_impl_data_jpeg2000_packing.h | 72 +++ .../grib_accessor_impl_data_png_packing.cpp | 62 +++ .../grib_accessor_impl_data_png_packing.h | 72 +++ .../grib_accessor_impl_data_raw_packing.cpp | 62 +++ .../grib_accessor_impl_data_raw_packing.h | 72 +++ ..._accessor_impl_data_run_length_packing.cpp | 62 +++ ...ib_accessor_impl_data_run_length_packing.h | 72 +++ ...ib_accessor_impl_data_secondary_bitmap.cpp | 62 +++ ...grib_accessor_impl_data_secondary_bitmap.h | 72 +++ .../grib_accessor_impl_data_sh_packed.cpp | 62 +++ .../grib_accessor_impl_data_sh_packed.h | 72 +++ .../grib_accessor_impl_data_sh_unpacked.cpp | 62 +++ .../grib_accessor_impl_data_sh_unpacked.h | 72 +++ ...ib_accessor_impl_data_shsimple_packing.cpp | 62 +++ ...grib_accessor_impl_data_shsimple_packing.h | 72 +++ ...grib_accessor_impl_data_simple_packing.cpp | 62 +++ .../grib_accessor_impl_data_simple_packing.h | 72 +++ .../grib_accessor_impl_decimal_precision.cpp | 62 +++ .../grib_accessor_impl_decimal_precision.h | 72 +++ .../grib_accessor_impl_dictionary.cpp | 62 +++ .../templates/grib_accessor_impl_dictionary.h | 72 +++ .../templates/grib_accessor_impl_dirty.cpp | 62 +++ .../templates/grib_accessor_impl_dirty.h | 72 +++ .../grib_accessor_impl_divdouble.cpp | 62 +++ .../templates/grib_accessor_impl_divdouble.h | 72 +++ .../templates/grib_accessor_impl_double.cpp | 62 +++ .../templates/grib_accessor_impl_double.h | 72 +++ .../templates/grib_accessor_impl_element.cpp | 62 +++ .../templates/grib_accessor_impl_element.h | 72 +++ .../templates/grib_accessor_impl_evaluate.cpp | 62 +++ .../templates/grib_accessor_impl_evaluate.h | 72 +++ ...rib_accessor_impl_expanded_descriptors.cpp | 62 +++ .../grib_accessor_impl_expanded_descriptors.h | 72 +++ .../templates/grib_accessor_impl_forward.cpp | 62 +++ .../templates/grib_accessor_impl_forward.h | 72 +++ ...or_impl_from_scale_factor_scaled_value.cpp | 62 +++ ...ssor_impl_from_scale_factor_scaled_value.h | 72 +++ ...ib_accessor_impl_g1_half_byte_codeflag.cpp | 62 +++ ...grib_accessor_impl_g1_half_byte_codeflag.h | 72 +++ .../grib_accessor_impl_g1_message_length.cpp | 62 +++ .../grib_accessor_impl_g1_message_length.h | 72 +++ .../grib_accessor_impl_g1_section4_length.cpp | 62 +++ .../grib_accessor_impl_g1_section4_length.h | 72 +++ .../templates/grib_accessor_impl_g1area.cpp | 62 +++ .../templates/grib_accessor_impl_g1area.h | 72 +++ .../templates/grib_accessor_impl_g1bitmap.cpp | 62 +++ .../templates/grib_accessor_impl_g1bitmap.h | 72 +++ .../templates/grib_accessor_impl_g1date.cpp | 62 +++ .../templates/grib_accessor_impl_g1date.h | 72 +++ ...b_accessor_impl_g1day_of_the_year_date.cpp | 62 +++ ...rib_accessor_impl_g1day_of_the_year_date.h | 72 +++ ...ccessor_impl_g1end_of_interval_monthly.cpp | 62 +++ ..._accessor_impl_g1end_of_interval_monthly.h | 72 +++ .../grib_accessor_impl_g1fcperiod.cpp | 62 +++ .../templates/grib_accessor_impl_g1fcperiod.h | 72 +++ .../grib_accessor_impl_g1forecastmonth.cpp | 62 +++ .../grib_accessor_impl_g1forecastmonth.h | 72 +++ .../grib_accessor_impl_g1monthlydate.cpp | 62 +++ .../grib_accessor_impl_g1monthlydate.h | 72 +++ ...pl_g1number_of_coded_values_sh_complex.cpp | 62 +++ ...impl_g1number_of_coded_values_sh_complex.h | 72 +++ ...mpl_g1number_of_coded_values_sh_simple.cpp | 62 +++ ..._impl_g1number_of_coded_values_sh_simple.h | 72 +++ .../grib_accessor_impl_g1verificationdate.cpp | 62 +++ .../grib_accessor_impl_g1verificationdate.h | 72 +++ .../grib_accessor_impl_g2_aerosol.cpp | 62 +++ .../templates/grib_accessor_impl_g2_aerosol.h | 72 +++ .../grib_accessor_impl_g2_chemical.cpp | 62 +++ .../grib_accessor_impl_g2_chemical.h | 72 +++ .../templates/grib_accessor_impl_g2_eps.cpp | 62 +++ .../templates/grib_accessor_impl_g2_eps.h | 72 +++ .../grib_accessor_impl_g2_mars_labeling.cpp | 62 +++ .../grib_accessor_impl_g2_mars_labeling.h | 72 +++ .../templates/grib_accessor_impl_g2bitmap.cpp | 62 +++ .../templates/grib_accessor_impl_g2bitmap.h | 72 +++ .../grib_accessor_impl_g2bitmap_present.cpp | 62 +++ .../grib_accessor_impl_g2bitmap_present.h | 72 +++ .../templates/grib_accessor_impl_g2date.cpp | 62 +++ .../templates/grib_accessor_impl_g2date.h | 72 +++ .../grib_accessor_impl_g2end_step.cpp | 62 +++ .../templates/grib_accessor_impl_g2end_step.h | 72 +++ .../templates/grib_accessor_impl_g2grid.cpp | 62 +++ .../templates/grib_accessor_impl_g2grid.h | 72 +++ .../templates/grib_accessor_impl_g2latlon.cpp | 62 +++ .../templates/grib_accessor_impl_g2latlon.h | 72 +++ .../templates/grib_accessor_impl_g2level.cpp | 62 +++ .../templates/grib_accessor_impl_g2level.h | 72 +++ .../templates/grib_accessor_impl_g2lon.cpp | 62 +++ .../templates/grib_accessor_impl_g2lon.h | 72 +++ .../grib_accessor_impl_g2step_range.cpp | 62 +++ .../grib_accessor_impl_g2step_range.h | 72 +++ .../grib_accessor_impl_gaussian_grid_name.cpp | 62 +++ .../grib_accessor_impl_gaussian_grid_name.h | 72 +++ .../grib_accessor_impl_gds_is_present.cpp | 62 +++ .../grib_accessor_impl_gds_is_present.h | 72 +++ ...b_accessor_impl_gds_not_present_bitmap.cpp | 62 +++ ...rib_accessor_impl_gds_not_present_bitmap.h | 72 +++ .../templates/grib_accessor_impl_getenv.cpp | 62 +++ .../templates/grib_accessor_impl_getenv.h | 72 +++ .../grib_accessor_impl_global_gaussian.cpp | 62 +++ .../grib_accessor_impl_global_gaussian.h | 72 +++ .../templates/grib_accessor_impl_group.cpp | 62 +++ .../templates/grib_accessor_impl_group.h | 72 +++ .../grib_accessor_impl_gts_header.cpp | 62 +++ .../templates/grib_accessor_impl_gts_header.h | 72 +++ .../grib_accessor_impl_hash_array.cpp | 62 +++ .../templates/grib_accessor_impl_hash_array.h | 72 +++ .../grib_accessor_impl_headers_only.cpp | 62 +++ .../grib_accessor_impl_headers_only.h | 72 +++ .../templates/grib_accessor_impl_ibmfloat.cpp | 62 +++ .../templates/grib_accessor_impl_ibmfloat.h | 72 +++ .../grib_accessor_impl_ieeefloat.cpp | 62 +++ .../templates/grib_accessor_impl_ieeefloat.h | 72 +++ .../grib_accessor_impl_ifs_param.cpp | 62 +++ .../templates/grib_accessor_impl_ifs_param.h | 72 +++ .../templates/grib_accessor_impl_int16.cpp | 62 +++ .../templates/grib_accessor_impl_int16.h | 72 +++ ...grib_accessor_impl_int16_little_endian.cpp | 62 +++ .../grib_accessor_impl_int16_little_endian.h | 72 +++ .../templates/grib_accessor_impl_int32.cpp | 62 +++ .../templates/grib_accessor_impl_int32.h | 72 +++ ...grib_accessor_impl_int32_little_endian.cpp | 62 +++ .../grib_accessor_impl_int32_little_endian.h | 72 +++ .../templates/grib_accessor_impl_int64.cpp | 62 +++ .../templates/grib_accessor_impl_int64.h | 72 +++ ...grib_accessor_impl_int64_little_endian.cpp | 62 +++ .../grib_accessor_impl_int64_little_endian.h | 72 +++ .../templates/grib_accessor_impl_int8.cpp | 62 +++ .../templates/grib_accessor_impl_int8.h | 72 +++ .../templates/grib_accessor_impl_iterator.cpp | 62 +++ .../templates/grib_accessor_impl_iterator.h | 72 +++ .../grib_accessor_impl_julian_date.cpp | 62 +++ .../grib_accessor_impl_julian_date.h | 72 +++ .../grib_accessor_impl_julian_day.cpp | 62 +++ .../templates/grib_accessor_impl_julian_day.h | 72 +++ .../grib_accessor_impl_ksec1expver.cpp | 62 +++ .../grib_accessor_impl_ksec1expver.h | 72 +++ .../templates/grib_accessor_impl_label.cpp | 62 +++ .../templates/grib_accessor_impl_label.h | 72 +++ .../grib_accessor_impl_laplacian.cpp | 62 +++ .../templates/grib_accessor_impl_laplacian.h | 72 +++ .../grib_accessor_impl_latitudes.cpp | 62 +++ .../templates/grib_accessor_impl_latitudes.h | 72 +++ .../grib_accessor_impl_latlon_increment.cpp | 62 +++ .../grib_accessor_impl_latlon_increment.h | 72 +++ .../grib_accessor_impl_latlonvalues.cpp | 62 +++ .../grib_accessor_impl_latlonvalues.h | 72 +++ .../grib_accessor_impl_library_version.cpp | 62 +++ .../grib_accessor_impl_library_version.h | 72 +++ .../grib_accessor_impl_local_definition.cpp | 62 +++ .../grib_accessor_impl_local_definition.h | 72 +++ .../templates/grib_accessor_impl_long.cpp | 62 +++ .../templates/grib_accessor_impl_long.h | 72 +++ .../grib_accessor_impl_long_vector.cpp | 62 +++ .../grib_accessor_impl_long_vector.h | 72 +++ .../grib_accessor_impl_longitudes.cpp | 62 +++ .../templates/grib_accessor_impl_longitudes.h | 72 +++ .../templates/grib_accessor_impl_lookup.cpp | 62 +++ .../templates/grib_accessor_impl_lookup.h | 72 +++ .../grib_accessor_impl_mars_param.cpp | 62 +++ .../templates/grib_accessor_impl_mars_param.h | 72 +++ .../grib_accessor_impl_mars_step.cpp | 62 +++ .../templates/grib_accessor_impl_mars_step.h | 72 +++ .../templates/grib_accessor_impl_md5.cpp | 62 +++ .../templates/grib_accessor_impl_md5.h | 72 +++ .../templates/grib_accessor_impl_message.cpp | 62 +++ .../templates/grib_accessor_impl_message.h | 72 +++ .../grib_accessor_impl_message_copy.cpp | 62 +++ .../grib_accessor_impl_message_copy.h | 72 +++ .../templates/grib_accessor_impl_missing.cpp | 62 +++ .../templates/grib_accessor_impl_missing.h | 72 +++ .../templates/grib_accessor_impl_nearest.cpp | 62 +++ .../templates/grib_accessor_impl_nearest.h | 72 +++ .../grib_accessor_impl_non_alpha.cpp | 62 +++ .../templates/grib_accessor_impl_non_alpha.h | 72 +++ ...b_accessor_impl_number_of_coded_values.cpp | 62 +++ ...rib_accessor_impl_number_of_coded_values.h | 72 +++ .../grib_accessor_impl_number_of_points.cpp | 62 +++ .../grib_accessor_impl_number_of_points.h | 72 +++ ...ccessor_impl_number_of_points_gaussian.cpp | 62 +++ ..._accessor_impl_number_of_points_gaussian.h | 72 +++ .../grib_accessor_impl_number_of_values.cpp | 62 +++ .../grib_accessor_impl_number_of_values.h | 72 +++ ...impl_number_of_values_data_raw_packing.cpp | 62 +++ ...r_impl_number_of_values_data_raw_packing.h | 72 +++ ...grib_accessor_impl_octahedral_gaussian.cpp | 62 +++ .../grib_accessor_impl_octahedral_gaussian.h | 72 +++ .../grib_accessor_impl_octet_number.cpp | 62 +++ .../grib_accessor_impl_octet_number.h | 72 +++ .../grib_accessor_impl_offset_file.cpp | 62 +++ .../grib_accessor_impl_offset_file.h | 72 +++ .../grib_accessor_impl_offset_values.cpp | 62 +++ .../grib_accessor_impl_offset_values.h | 72 +++ .../grib_accessor_impl_pack_bufr_values.cpp | 62 +++ .../grib_accessor_impl_pack_bufr_values.h | 72 +++ .../templates/grib_accessor_impl_pad.cpp | 62 +++ .../templates/grib_accessor_impl_pad.h | 72 +++ .../templates/grib_accessor_impl_padding.cpp | 62 +++ .../templates/grib_accessor_impl_padding.h | 72 +++ .../templates/grib_accessor_impl_padto.cpp | 62 +++ .../templates/grib_accessor_impl_padto.h | 72 +++ .../grib_accessor_impl_padtoeven.cpp | 62 +++ .../templates/grib_accessor_impl_padtoeven.h | 72 +++ .../grib_accessor_impl_padtomultiple.cpp | 62 +++ .../grib_accessor_impl_padtomultiple.h | 72 +++ .../templates/grib_accessor_impl_position.cpp | 62 +++ .../templates/grib_accessor_impl_position.h | 72 +++ .../templates/grib_accessor_impl_raw.cpp | 62 +++ .../templates/grib_accessor_impl_raw.h | 72 +++ .../grib_accessor_impl_rdbtime_guess_date.cpp | 62 +++ .../grib_accessor_impl_rdbtime_guess_date.h | 72 +++ ...ib_accessor_impl_reference_value_error.cpp | 62 +++ ...grib_accessor_impl_reference_value_error.h | 72 +++ .../templates/grib_accessor_impl_round.cpp | 62 +++ .../templates/grib_accessor_impl_round.h | 72 +++ .../templates/grib_accessor_impl_scale.cpp | 62 +++ .../templates/grib_accessor_impl_scale.h | 72 +++ .../grib_accessor_impl_scale_values.cpp | 62 +++ .../grib_accessor_impl_scale_values.h | 72 +++ ...essor_impl_second_order_bits_per_value.cpp | 62 +++ ...ccessor_impl_second_order_bits_per_value.h | 72 +++ .../templates/grib_accessor_impl_section.cpp | 62 +++ .../templates/grib_accessor_impl_section.h | 72 +++ .../grib_accessor_impl_section_length.cpp | 62 +++ .../grib_accessor_impl_section_length.h | 72 +++ .../grib_accessor_impl_section_padding.cpp | 62 +++ .../grib_accessor_impl_section_padding.h | 72 +++ .../grib_accessor_impl_section_pointer.cpp | 62 +++ .../grib_accessor_impl_section_pointer.h | 72 +++ ...rib_accessor_impl_select_step_template.cpp | 62 +++ .../grib_accessor_impl_select_step_template.h | 72 +++ ...grib_accessor_impl_sexagesimal2decimal.cpp | 62 +++ .../grib_accessor_impl_sexagesimal2decimal.h | 72 +++ .../templates/grib_accessor_impl_signed.cpp | 62 +++ .../templates/grib_accessor_impl_signed.h | 72 +++ .../grib_accessor_impl_signed_bits.cpp | 62 +++ .../grib_accessor_impl_signed_bits.h | 72 +++ ...rib_accessor_impl_simple_packing_error.cpp | 62 +++ .../grib_accessor_impl_simple_packing_error.h | 72 +++ .../templates/grib_accessor_impl_size.cpp | 62 +++ .../templates/grib_accessor_impl_size.h | 72 +++ .../grib_accessor_impl_smart_table.cpp | 62 +++ .../grib_accessor_impl_smart_table.h | 72 +++ .../grib_accessor_impl_smart_table_column.cpp | 62 +++ .../grib_accessor_impl_smart_table_column.h | 72 +++ .../templates/grib_accessor_impl_spd.cpp | 62 +++ .../templates/grib_accessor_impl_spd.h | 72 +++ ...grib_accessor_impl_spectral_truncation.cpp | 62 +++ .../grib_accessor_impl_spectral_truncation.h | 72 +++ .../templates/grib_accessor_impl_sprintf.cpp | 62 +++ .../templates/grib_accessor_impl_sprintf.h | 72 +++ .../grib_accessor_impl_statistics.cpp | 62 +++ .../templates/grib_accessor_impl_statistics.h | 72 +++ ...grib_accessor_impl_statistics_spectral.cpp | 62 +++ .../grib_accessor_impl_statistics_spectral.h | 72 +++ ...grib_accessor_impl_step_human_readable.cpp | 62 +++ .../grib_accessor_impl_step_human_readable.h | 72 +++ .../grib_accessor_impl_step_in_units.cpp | 62 +++ .../grib_accessor_impl_step_in_units.h | 72 +++ .../templates/grib_accessor_impl_sum.cpp | 62 +++ .../templates/grib_accessor_impl_sum.h | 72 +++ .../grib_accessor_impl_suppressed.cpp | 62 +++ .../templates/grib_accessor_impl_suppressed.h | 72 +++ .../templates/grib_accessor_impl_time.cpp | 62 +++ .../templates/grib_accessor_impl_time.h | 72 +++ .../templates/grib_accessor_impl_times.cpp | 62 +++ .../templates/grib_accessor_impl_times.h | 72 +++ .../grib_accessor_impl_to_double.cpp | 62 +++ .../templates/grib_accessor_impl_to_double.h | 72 +++ .../grib_accessor_impl_to_integer.cpp | 62 +++ .../templates/grib_accessor_impl_to_integer.h | 72 +++ .../grib_accessor_impl_to_string.cpp | 62 +++ .../templates/grib_accessor_impl_to_string.h | 72 +++ .../grib_accessor_impl_transient.cpp | 62 +++ .../templates/grib_accessor_impl_transient.h | 72 +++ .../grib_accessor_impl_transient_darray.cpp | 62 +++ .../grib_accessor_impl_transient_darray.h | 72 +++ .../templates/grib_accessor_impl_trim.cpp | 62 +++ .../templates/grib_accessor_impl_trim.h | 72 +++ .../templates/grib_accessor_impl_uint16.cpp | 62 +++ .../templates/grib_accessor_impl_uint16.h | 72 +++ ...rib_accessor_impl_uint16_little_endian.cpp | 62 +++ .../grib_accessor_impl_uint16_little_endian.h | 72 +++ .../templates/grib_accessor_impl_uint32.cpp | 62 +++ .../templates/grib_accessor_impl_uint32.h | 72 +++ ...rib_accessor_impl_uint32_little_endian.cpp | 62 +++ .../grib_accessor_impl_uint32_little_endian.h | 72 +++ .../templates/grib_accessor_impl_uint64.cpp | 62 +++ .../templates/grib_accessor_impl_uint64.h | 72 +++ ...rib_accessor_impl_uint64_little_endian.cpp | 62 +++ .../grib_accessor_impl_uint64_little_endian.h | 72 +++ .../templates/grib_accessor_impl_uint8.cpp | 62 +++ .../templates/grib_accessor_impl_uint8.h | 72 +++ ...b_accessor_impl_unexpanded_descriptors.cpp | 62 +++ ...rib_accessor_impl_unexpanded_descriptors.h | 72 +++ .../grib_accessor_impl_unpack_bufr_values.cpp | 62 +++ .../grib_accessor_impl_unpack_bufr_values.h | 72 +++ .../templates/grib_accessor_impl_unsigned.cpp | 62 +++ .../templates/grib_accessor_impl_unsigned.h | 72 +++ .../grib_accessor_impl_unsigned_bits.cpp | 62 +++ .../grib_accessor_impl_unsigned_bits.h | 72 +++ .../grib_accessor_impl_validity_date.cpp | 62 +++ .../grib_accessor_impl_validity_date.h | 72 +++ .../grib_accessor_impl_validity_time.cpp | 62 +++ .../grib_accessor_impl_validity_time.h | 72 +++ .../templates/grib_accessor_impl_values.cpp | 62 +++ .../templates/grib_accessor_impl_values.h | 72 +++ .../templates/grib_accessor_impl_variable.cpp | 62 +++ .../templates/grib_accessor_impl_variable.h | 72 +++ .../templates/grib_accessor_impl_vector.cpp | 62 +++ .../templates/grib_accessor_impl_vector.h | 72 +++ .../templates/grib_accessor_impl_when.cpp | 62 +++ .../templates/grib_accessor_impl_when.h | 72 +++ .../tests/pack_buffer_tests.cpp | 70 +++ .../tests/pack_buffer_tests.h | 9 + src/grib_accessor_impl_v1/type_view.h | 30 ++ 481 files changed, 31961 insertions(+), 91 deletions(-) create mode 100644 src/grib_accessor_impl/Accessor.cpp create mode 100644 src/grib_accessor_impl/Accessor.h create mode 100644 src/grib_accessor_impl/AccessorConcept.h create mode 100644 src/grib_accessor_impl/AccessorFactory.cpp create mode 100644 src/grib_accessor_impl/AccessorFactory.h create mode 100644 src/grib_accessor_impl/AccessorMaker.cpp create mode 100644 src/grib_accessor_impl/AccessorMaker.h create mode 100644 src/grib_accessor_impl/AccessorPtr.cpp create mode 100644 src/grib_accessor_impl/AccessorPtr.h create mode 100644 src/grib_accessor_impl/Accessor_TEMPLATE.h create mode 100644 src/grib_accessor_impl/Accessor_Utils.cpp create mode 100644 src/grib_accessor_impl/Accessor_Utils.h create mode 100644 src/grib_accessor_impl/Generic.cpp create mode 100644 src/grib_accessor_impl/Generic.h create mode 100644 src/grib_accessor_impl/ProjString.cpp create mode 100644 src/grib_accessor_impl/ProjString.h create mode 100644 src/grib_accessor_impl_v1/CMakeLists.txt rename src/{grib_accessor_impl => grib_accessor_impl_v1}/ga_impl_creator_targets.h (100%) rename src/{grib_accessor_impl => grib_accessor_impl_v1}/ga_impl_creators.cpp (100%) rename src/{grib_accessor_impl => grib_accessor_impl_v1}/ga_impl_creators.h (100%) rename src/{grib_accessor_impl => grib_accessor_impl_v1}/grib_accessor_impl.h (100%) rename src/{grib_accessor_impl => grib_accessor_impl_v1}/grib_accessor_impl_abstract_long_vector.cpp (100%) rename src/{grib_accessor_impl => grib_accessor_impl_v1}/grib_accessor_impl_abstract_long_vector.h (100%) rename src/{grib_accessor_impl => grib_accessor_impl_v1}/grib_accessor_impl_factory.cpp (100%) rename src/{grib_accessor_impl => grib_accessor_impl_v1}/grib_accessor_impl_factory.h (100%) rename src/{grib_accessor_impl => grib_accessor_impl_v1}/grib_accessor_impl_g1step_range.cpp (100%) rename src/{grib_accessor_impl => grib_accessor_impl_v1}/grib_accessor_impl_g1step_range.h (100%) rename src/{grib_accessor_impl => grib_accessor_impl_v1}/grib_accessor_impl_gen.cpp (100%) rename src/{grib_accessor_impl => grib_accessor_impl_v1}/grib_accessor_impl_gen.h (100%) rename src/{grib_accessor_impl => grib_accessor_impl_v1}/grib_accessor_impl_helper.cpp (100%) rename src/{grib_accessor_impl => grib_accessor_impl_v1}/grib_accessor_impl_helper.h (100%) rename src/{grib_accessor_impl => grib_accessor_impl_v1}/grib_accessor_impl_proj_string.cpp (100%) rename src/{grib_accessor_impl => grib_accessor_impl_v1}/grib_accessor_impl_proj_string.h (100%) rename src/{grib_accessor_impl => grib_accessor_impl_v1}/grib_cpp_utils.cpp (100%) rename src/{grib_accessor_impl => grib_accessor_impl_v1}/grib_cpp_utils.h (100%) create mode 100644 src/grib_accessor_impl_v1/pack_buffer.cpp create mode 100644 src/grib_accessor_impl_v1/pack_buffer.h create mode 100644 src/grib_accessor_impl_v1/proj_string_helper.cpp create mode 100644 src/grib_accessor_impl_v1/proj_string_helper.h create mode 100755 src/grib_accessor_impl_v1/templates/grib_accessor_class_list.sh create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_class_list_FULL.sh create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_TEMPLATE.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_TEMPLATE.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_abstract_vector.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_abstract_vector.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_apply_operators.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_apply_operators.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_array.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_array.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_ascii.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_ascii.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_assert.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_assert.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_bit.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_bit.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_bitmap.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_bitmap.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_bits.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_bits.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_bits_per_value.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_bits_per_value.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_blob.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_blob.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_box.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_box.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_budgdate.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_budgdate.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_data_array.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_data_array.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_data_element.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_data_element.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_elements_table.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_elements_table.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_extract_area_subsets.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_extract_area_subsets.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_extract_datetime_subsets.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_extract_datetime_subsets.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_extract_subsets.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_extract_subsets.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_group.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_group.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_simple_thinning.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_simple_thinning.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_string_values.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_string_values.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufrdc_expanded_descriptors.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufrdc_expanded_descriptors.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_bytes.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_bytes.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_change_alternative_row_scanning.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_change_alternative_row_scanning.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_change_scanning_direction.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_change_scanning_direction.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_check_internal_version.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_check_internal_version.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_closest_date.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_closest_date.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_codeflag.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_codeflag.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_codetable.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_codetable.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_codetable_title.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_codetable_title.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_codetable_units.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_codetable_units.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_concept.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_concept.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_constant.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_constant.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_count_file.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_count_file.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_count_missing.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_count_missing.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_count_total.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_count_total.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_2order_packing.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_2order_packing.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_apply_bitmap.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_apply_bitmap.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_apply_boustrophedonic.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_apply_boustrophedonic.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_apply_boustrophedonic_bitmap.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_apply_boustrophedonic_bitmap.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_apply_gdsnotpresent.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_apply_gdsnotpresent.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_ccsds_packing.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_ccsds_packing.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_complex_packing.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_complex_packing.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_dummy_field.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_dummy_field.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1complex_packing.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1complex_packing.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1second_order_constant_width_packing.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1second_order_constant_width_packing.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1second_order_general_extended_packing.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1second_order_general_extended_packing.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1second_order_general_packing.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1second_order_general_packing.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1second_order_row_by_row_packing.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1second_order_row_by_row_packing.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1secondary_bitmap.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1secondary_bitmap.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1shsimple_packing.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1shsimple_packing.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1simple_packing.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1simple_packing.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g22order_packing.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g22order_packing.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2bifourier_packing.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2bifourier_packing.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2complex_packing.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2complex_packing.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2secondary_bitmap.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2secondary_bitmap.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2shsimple_packing.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2shsimple_packing.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2simple_packing.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2simple_packing.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2simple_packing_with_preprocessing.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2simple_packing_with_preprocessing.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_jpeg2000_packing.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_jpeg2000_packing.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_png_packing.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_png_packing.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_raw_packing.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_raw_packing.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_run_length_packing.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_run_length_packing.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_secondary_bitmap.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_secondary_bitmap.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_sh_packed.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_sh_packed.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_sh_unpacked.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_sh_unpacked.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_shsimple_packing.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_shsimple_packing.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_simple_packing.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_simple_packing.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_decimal_precision.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_decimal_precision.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_dictionary.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_dictionary.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_dirty.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_dirty.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_divdouble.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_divdouble.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_double.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_double.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_element.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_element.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_evaluate.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_evaluate.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_expanded_descriptors.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_expanded_descriptors.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_forward.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_forward.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_from_scale_factor_scaled_value.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_from_scale_factor_scaled_value.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1_half_byte_codeflag.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1_half_byte_codeflag.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1_message_length.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1_message_length.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1_section4_length.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1_section4_length.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1area.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1area.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1bitmap.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1bitmap.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1date.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1date.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1day_of_the_year_date.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1day_of_the_year_date.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1end_of_interval_monthly.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1end_of_interval_monthly.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1fcperiod.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1fcperiod.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1forecastmonth.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1forecastmonth.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1monthlydate.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1monthlydate.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1number_of_coded_values_sh_complex.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1number_of_coded_values_sh_complex.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1number_of_coded_values_sh_simple.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1number_of_coded_values_sh_simple.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1verificationdate.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1verificationdate.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2_aerosol.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2_aerosol.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2_chemical.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2_chemical.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2_eps.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2_eps.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2_mars_labeling.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2_mars_labeling.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2bitmap.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2bitmap.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2bitmap_present.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2bitmap_present.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2date.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2date.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2end_step.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2end_step.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2grid.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2grid.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2latlon.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2latlon.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2level.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2level.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2lon.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2lon.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2step_range.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2step_range.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_gaussian_grid_name.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_gaussian_grid_name.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_gds_is_present.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_gds_is_present.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_gds_not_present_bitmap.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_gds_not_present_bitmap.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_getenv.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_getenv.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_global_gaussian.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_global_gaussian.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_group.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_group.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_gts_header.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_gts_header.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_hash_array.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_hash_array.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_headers_only.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_headers_only.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_ibmfloat.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_ibmfloat.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_ieeefloat.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_ieeefloat.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_ifs_param.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_ifs_param.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_int16.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_int16.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_int16_little_endian.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_int16_little_endian.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_int32.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_int32.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_int32_little_endian.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_int32_little_endian.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_int64.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_int64.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_int64_little_endian.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_int64_little_endian.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_int8.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_int8.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_iterator.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_iterator.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_julian_date.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_julian_date.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_julian_day.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_julian_day.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_ksec1expver.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_ksec1expver.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_label.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_label.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_laplacian.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_laplacian.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_latitudes.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_latitudes.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_latlon_increment.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_latlon_increment.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_latlonvalues.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_latlonvalues.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_library_version.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_library_version.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_local_definition.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_local_definition.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_long.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_long.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_long_vector.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_long_vector.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_longitudes.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_longitudes.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_lookup.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_lookup.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_mars_param.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_mars_param.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_mars_step.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_mars_step.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_md5.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_md5.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_message.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_message.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_message_copy.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_message_copy.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_missing.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_missing.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_nearest.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_nearest.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_non_alpha.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_non_alpha.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_number_of_coded_values.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_number_of_coded_values.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_number_of_points.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_number_of_points.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_number_of_points_gaussian.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_number_of_points_gaussian.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_number_of_values.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_number_of_values.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_number_of_values_data_raw_packing.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_number_of_values_data_raw_packing.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_octahedral_gaussian.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_octahedral_gaussian.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_octet_number.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_octet_number.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_offset_file.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_offset_file.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_offset_values.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_offset_values.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_pack_bufr_values.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_pack_bufr_values.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_pad.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_pad.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_padding.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_padding.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_padto.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_padto.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_padtoeven.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_padtoeven.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_padtomultiple.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_padtomultiple.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_position.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_position.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_raw.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_raw.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_rdbtime_guess_date.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_rdbtime_guess_date.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_reference_value_error.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_reference_value_error.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_round.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_round.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_scale.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_scale.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_scale_values.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_scale_values.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_second_order_bits_per_value.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_second_order_bits_per_value.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_section.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_section.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_section_length.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_section_length.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_section_padding.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_section_padding.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_section_pointer.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_section_pointer.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_select_step_template.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_select_step_template.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_sexagesimal2decimal.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_sexagesimal2decimal.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_signed.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_signed.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_signed_bits.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_signed_bits.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_simple_packing_error.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_simple_packing_error.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_size.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_size.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_smart_table.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_smart_table.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_smart_table_column.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_smart_table_column.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_spd.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_spd.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_spectral_truncation.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_spectral_truncation.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_sprintf.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_sprintf.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_statistics.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_statistics.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_statistics_spectral.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_statistics_spectral.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_step_human_readable.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_step_human_readable.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_step_in_units.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_step_in_units.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_sum.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_sum.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_suppressed.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_suppressed.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_time.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_time.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_times.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_times.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_to_double.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_to_double.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_to_integer.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_to_integer.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_to_string.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_to_string.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_transient.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_transient.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_transient_darray.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_transient_darray.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_trim.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_trim.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint16.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint16.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint16_little_endian.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint16_little_endian.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint32.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint32.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint32_little_endian.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint32_little_endian.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint64.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint64.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint64_little_endian.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint64_little_endian.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint8.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint8.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_unexpanded_descriptors.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_unexpanded_descriptors.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_unpack_bufr_values.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_unpack_bufr_values.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_unsigned.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_unsigned.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_unsigned_bits.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_unsigned_bits.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_validity_date.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_validity_date.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_validity_time.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_validity_time.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_values.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_values.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_variable.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_variable.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_vector.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_vector.h create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_when.cpp create mode 100644 src/grib_accessor_impl_v1/templates/grib_accessor_impl_when.h create mode 100644 src/grib_accessor_impl_v1/tests/pack_buffer_tests.cpp create mode 100644 src/grib_accessor_impl_v1/tests/pack_buffer_tests.h create mode 100644 src/grib_accessor_impl_v1/type_view.h diff --git a/src/grib_accessor.cc b/src/grib_accessor.cc index bfbf1f376..c79230df0 100644 --- a/src/grib_accessor.cc +++ b/src/grib_accessor.cc @@ -17,8 +17,8 @@ #include "grib_accessor.h" // C++ support -#include "grib_accessor_impl/grib_accessor_impl_factory.h" -#include "grib_accessor_impl/grib_accessor_impl_helper.h" +#include "grib_accessor_impl/AccessorFactory.h" +#include "grib_accessor_impl/Accessor.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 */ @@ -35,9 +35,9 @@ GRIB_INLINE static int grib_inline_strcmp(const char* a, const char* b) void grib_accessor_dump(grib_accessor* a, grib_dumper* f) { - if(eccodes::grib_accessor_impl_gen* ga_impl = eccodes::get_grib_accessor_impl(a); ga_impl) + if(eccodes::AccessorPtr accessorPtr = eccodes::getAccessor(a); accessorPtr) { - return ga_impl->dump(f); + return accessorDump(*accessorPtr, f); } grib_accessor_class* c = a->cclass; @@ -53,9 +53,9 @@ void grib_accessor_dump(grib_accessor* a, grib_dumper* f) int grib_pack_missing(grib_accessor* a) { - if(eccodes::grib_accessor_impl_gen* ga_impl = eccodes::get_grib_accessor_impl(a); ga_impl) + if(eccodes::AccessorPtr accessorPtr = eccodes::getAccessor(a); accessorPtr) { - return ga_impl->pack_missing(); + return accessorPackMissing(*accessorPtr); } grib_accessor_class* c = a->cclass; @@ -72,9 +72,9 @@ int grib_pack_missing(grib_accessor* a) int grib_pack_zero(grib_accessor* a) { - if(eccodes::grib_accessor_impl_gen* ga_impl = eccodes::get_grib_accessor_impl(a); ga_impl) + if(eccodes::AccessorPtr accessorPtr = eccodes::getAccessor(a); accessorPtr) { - return ga_impl->clear(); + return accessorClear(*accessorPtr); } grib_accessor_class* c = a->cclass; @@ -91,9 +91,9 @@ int grib_pack_zero(grib_accessor* a) int grib_is_missing_internal(grib_accessor* a) { - if(eccodes::grib_accessor_impl_gen* ga_impl = eccodes::get_grib_accessor_impl(a); ga_impl) + if(eccodes::AccessorPtr accessorPtr = eccodes::getAccessor(a); accessorPtr) { - return ga_impl->is_missing(); + return accessorIsMissing(*accessorPtr); } grib_accessor_class* c = a->cclass; @@ -110,9 +110,9 @@ int grib_is_missing_internal(grib_accessor* a) int grib_pack_double(grib_accessor* a, const double* v, size_t* len) { - if(eccodes::grib_accessor_impl_gen* ga_impl = eccodes::get_grib_accessor_impl(a); ga_impl) + if(eccodes::AccessorPtr accessorPtr = eccodes::getAccessor(a); accessorPtr) { - return ga_impl->pack_double(v, len); + return accessorPackDouble(*accessorPtr, v, len); } grib_accessor_class* c = a->cclass; @@ -129,9 +129,9 @@ int grib_pack_double(grib_accessor* a, const double* v, size_t* len) int grib_pack_float(grib_accessor* a, const float* v, size_t* len) { - if(eccodes::grib_accessor_impl_gen* ga_impl = eccodes::get_grib_accessor_impl(a); ga_impl) + if(eccodes::AccessorPtr accessorPtr = eccodes::getAccessor(a); accessorPtr) { - return ga_impl->pack_float(v, len); + return accessorPackFloat(*accessorPtr, v, len); } grib_accessor_class* c = a->cclass; @@ -147,9 +147,9 @@ int grib_pack_float(grib_accessor* a, const float* v, size_t* len) int grib_pack_expression(grib_accessor* a, grib_expression* e) { - if(eccodes::grib_accessor_impl_gen* ga_impl = eccodes::get_grib_accessor_impl(a); ga_impl) + if(eccodes::AccessorPtr accessorPtr = eccodes::getAccessor(a); accessorPtr) { - return ga_impl->pack_expression(e); + return accessorPackExpression(*accessorPtr, e); } grib_accessor_class* c = a->cclass; @@ -166,9 +166,9 @@ int grib_pack_expression(grib_accessor* a, grib_expression* e) int grib_pack_string(grib_accessor* a, const char* v, size_t* len) { - if(eccodes::grib_accessor_impl_gen* ga_impl = eccodes::get_grib_accessor_impl(a); ga_impl) + if(eccodes::AccessorPtr accessorPtr = eccodes::getAccessor(a); accessorPtr) { - return ga_impl->pack_string(v, len); + return accessorPackString(*accessorPtr, v, len); } grib_accessor_class* c = a->cclass; @@ -185,9 +185,9 @@ int grib_pack_string(grib_accessor* a, const char* v, size_t* len) int grib_pack_string_array(grib_accessor* a, const char** v, size_t* len) { - if(eccodes::grib_accessor_impl_gen* ga_impl = eccodes::get_grib_accessor_impl(a); ga_impl) + if(eccodes::AccessorPtr accessorPtr = eccodes::getAccessor(a); accessorPtr) { - return ga_impl->pack_string_array(v, len); + return accessorPackStringArray(*accessorPtr, v, len); } grib_accessor_class* c = a->cclass; @@ -204,9 +204,9 @@ int grib_pack_string_array(grib_accessor* a, const char** v, size_t* len) int grib_pack_long(grib_accessor* a, const long* v, size_t* len) { - if(eccodes::grib_accessor_impl_gen* ga_impl = eccodes::get_grib_accessor_impl(a); ga_impl) + if(eccodes::AccessorPtr accessorPtr = eccodes::getAccessor(a); accessorPtr) { - return ga_impl->pack_long(v, len); + return accessorPackLong(*accessorPtr, v, len); } grib_accessor_class* c = a->cclass; @@ -223,9 +223,9 @@ int grib_pack_long(grib_accessor* a, const long* v, size_t* len) int grib_pack_bytes(grib_accessor* a, const unsigned char* v, size_t* len) { - if(eccodes::grib_accessor_impl_gen* ga_impl = eccodes::get_grib_accessor_impl(a); ga_impl) + if(eccodes::AccessorPtr accessorPtr = eccodes::getAccessor(a); accessorPtr) { - return ga_impl->pack_bytes(v, len); + return accessorPackBytes(*accessorPtr, v, len); } grib_accessor_class* c = a->cclass; @@ -242,9 +242,9 @@ int grib_pack_bytes(grib_accessor* a, const unsigned char* v, size_t* len) int grib_unpack_bytes(grib_accessor* a, unsigned char* v, size_t* len) { - if(eccodes::grib_accessor_impl_gen* ga_impl = eccodes::get_grib_accessor_impl(a); ga_impl) + if(eccodes::AccessorPtr accessorPtr = eccodes::getAccessor(a); accessorPtr) { - return ga_impl->unpack_bytes(v, len); + return accessorUnpackBytes(*accessorPtr, v, len); } grib_accessor_class* c = a->cclass; @@ -261,9 +261,9 @@ int grib_unpack_bytes(grib_accessor* a, unsigned char* v, size_t* len) int grib_unpack_double_subarray(grib_accessor* a, double* v, size_t start, size_t len) { - if(eccodes::grib_accessor_impl_gen* ga_impl = eccodes::get_grib_accessor_impl(a); ga_impl) + if(eccodes::AccessorPtr accessorPtr = eccodes::getAccessor(a); accessorPtr) { - return ga_impl->unpack_double_subarray(v, start, len); + return accessorUnpackDoubleSubarray(*accessorPtr, v, start, len); } grib_accessor_class* c = a->cclass; @@ -279,9 +279,9 @@ int grib_unpack_double_subarray(grib_accessor* a, double* v, size_t start, size_ int grib_unpack_double(grib_accessor* a, double* v, size_t* len) { - if(eccodes::grib_accessor_impl_gen* ga_impl = eccodes::get_grib_accessor_impl(a); ga_impl) + if(eccodes::AccessorPtr accessorPtr = eccodes::getAccessor(a); accessorPtr) { - return ga_impl->unpack_double(v, len); + return accessorUnpackDouble(*accessorPtr, v, len); } grib_accessor_class* c = a->cclass; @@ -298,9 +298,9 @@ int grib_unpack_double(grib_accessor* a, double* v, size_t* len) int grib_unpack_float(grib_accessor* a, float* v, size_t* len) { - if(eccodes::grib_accessor_impl_gen* ga_impl = eccodes::get_grib_accessor_impl(a); ga_impl) + if(eccodes::AccessorPtr accessorPtr = eccodes::getAccessor(a); accessorPtr) { - return ga_impl->unpack_float(v, len); + return accessorUnpackFloat(*accessorPtr, v, len); } grib_accessor_class* c = a->cclass; @@ -329,9 +329,9 @@ int grib_unpack(grib_accessor* a, float* v, size_t* len) int grib_unpack_double_element(grib_accessor* a, size_t i, double* v) { - if(eccodes::grib_accessor_impl_gen* ga_impl = eccodes::get_grib_accessor_impl(a); ga_impl) + if(eccodes::AccessorPtr accessorPtr = eccodes::getAccessor(a); accessorPtr) { - return ga_impl->unpack_double_element(i, v); + return accessorUnpackDoubleElement(*accessorPtr, i, v); } grib_accessor_class* c = a->cclass; @@ -345,9 +345,9 @@ int grib_unpack_double_element(grib_accessor* a, size_t i, double* v) } int grib_unpack_float_element(grib_accessor* a, size_t i, float* v) { - if(eccodes::grib_accessor_impl_gen* ga_impl = eccodes::get_grib_accessor_impl(a); ga_impl) + if(eccodes::AccessorPtr accessorPtr = eccodes::getAccessor(a); accessorPtr) { - return ga_impl->unpack_float_element(i, v); + return accessorUnpackFloatElement(*accessorPtr, i, v); } /* grib_accessor_class* c = a->cclass; @@ -366,9 +366,9 @@ int grib_unpack_float_element(grib_accessor* a, size_t i, float* v) */ int grib_unpack_double_element_set(grib_accessor* a, const size_t* index_array, size_t len, double* val_array) { - if(eccodes::grib_accessor_impl_gen* ga_impl = eccodes::get_grib_accessor_impl(a); ga_impl) + if(eccodes::AccessorPtr accessorPtr = eccodes::getAccessor(a); accessorPtr) { - return ga_impl->unpack_double_element_set(index_array, len, val_array); + return accessorUnpackDoubleElementSet(*accessorPtr, index_array, len, val_array); } grib_accessor_class* c = a->cclass; @@ -383,9 +383,9 @@ int grib_unpack_double_element_set(grib_accessor* a, const size_t* index_array, } int grib_unpack_float_element_set(grib_accessor* a, const size_t* index_array, size_t len, float* val_array) { - if(eccodes::grib_accessor_impl_gen* ga_impl = eccodes::get_grib_accessor_impl(a); ga_impl) + if(eccodes::AccessorPtr accessorPtr = eccodes::getAccessor(a); accessorPtr) { - return ga_impl->unpack_float_element_set(index_array, len, val_array); + return accessorUnpackFloatElementSet(*accessorPtr, index_array, len, val_array); } /* @@ -403,9 +403,9 @@ int grib_unpack_float_element_set(grib_accessor* a, const size_t* index_array, s int grib_unpack_string(grib_accessor* a, char* v, size_t* len) { - if(eccodes::grib_accessor_impl_gen* ga_impl = eccodes::get_grib_accessor_impl(a); ga_impl) + if(eccodes::AccessorPtr accessorPtr = eccodes::getAccessor(a); accessorPtr) { - return ga_impl->unpack_string(v, len); + return accessorUnpackString(*accessorPtr, v, len); } grib_accessor_class* c = a->cclass; @@ -422,9 +422,9 @@ int grib_unpack_string(grib_accessor* a, char* v, size_t* len) int grib_unpack_string_array(grib_accessor* a, char** v, size_t* len) { - if(eccodes::grib_accessor_impl_gen* ga_impl = eccodes::get_grib_accessor_impl(a); ga_impl) + if(eccodes::AccessorPtr accessorPtr = eccodes::getAccessor(a); accessorPtr) { - return ga_impl->unpack_string_array(v, len); + return accessorUnpackStringArray(*accessorPtr, v, len); } grib_accessor_class* c = a->cclass; @@ -508,9 +508,9 @@ int grib_accessors_list_unpack_string(grib_accessors_list* al, char** val, size_ int grib_unpack_long(grib_accessor* a, long* v, size_t* len) { - if(eccodes::grib_accessor_impl_gen* ga_impl = eccodes::get_grib_accessor_impl(a); ga_impl) + if(eccodes::AccessorPtr accessorPtr = eccodes::getAccessor(a); accessorPtr) { - return ga_impl->unpack_long(v, len); + return accessorUnpackLong(*accessorPtr, v, len); } grib_accessor_class* c = a->cclass; @@ -527,9 +527,9 @@ int grib_unpack_long(grib_accessor* a, long* v, size_t* len) long grib_accessor_get_native_type(grib_accessor* a) { - if(eccodes::grib_accessor_impl_gen* ga_impl = eccodes::get_grib_accessor_impl(a); ga_impl) + if(eccodes::AccessorPtr accessorPtr = eccodes::getAccessor(a); accessorPtr) { - return ga_impl->native_type(); + return accessorNativeType(*accessorPtr); } grib_accessor_class* c = NULL; @@ -547,9 +547,9 @@ long grib_accessor_get_native_type(grib_accessor* a) long grib_get_next_position_offset(grib_accessor* a) { - if(eccodes::grib_accessor_impl_gen* ga_impl = eccodes::get_grib_accessor_impl(a); ga_impl) + if(eccodes::AccessorPtr accessorPtr = eccodes::getAccessor(a); accessorPtr) { - return ga_impl->next_offset(); + return accessorNextOffset(*accessorPtr); } grib_accessor_class* c = NULL; @@ -568,9 +568,9 @@ long grib_get_next_position_offset(grib_accessor* a) long grib_string_length(grib_accessor* a) { - if(eccodes::grib_accessor_impl_gen* ga_impl = eccodes::get_grib_accessor_impl(a); ga_impl) + if(eccodes::AccessorPtr accessorPtr = eccodes::getAccessor(a); accessorPtr) { - return ga_impl->string_length(); + return accessorStringLength(*accessorPtr); } grib_accessor_class* c = NULL; @@ -588,9 +588,9 @@ long grib_string_length(grib_accessor* a) long grib_byte_offset(grib_accessor* a) { - if(eccodes::grib_accessor_impl_gen* ga_impl = eccodes::get_grib_accessor_impl(a); ga_impl) + if(eccodes::AccessorPtr accessorPtr = eccodes::getAccessor(a); accessorPtr) { - return ga_impl->byte_offset(); + return accessorByteOffset(*accessorPtr); } grib_accessor_class* c = NULL; @@ -608,9 +608,9 @@ long grib_byte_offset(grib_accessor* a) long grib_byte_count(grib_accessor* a) { - if(eccodes::grib_accessor_impl_gen* ga_impl = eccodes::get_grib_accessor_impl(a); ga_impl) + if(eccodes::AccessorPtr accessorPtr = eccodes::getAccessor(a); accessorPtr) { - return ga_impl->byte_count(); + return accessorByteCount(*accessorPtr); } grib_accessor_class* c = NULL; @@ -628,9 +628,9 @@ long grib_byte_count(grib_accessor* a) int grib_value_count(grib_accessor* a, long* count) { - if(eccodes::grib_accessor_impl_gen* ga_impl = eccodes::get_grib_accessor_impl(a); ga_impl) + if(eccodes::AccessorPtr accessorPtr = eccodes::getAccessor(a); accessorPtr) { - return ga_impl->value_count(count); + return accessorValueCount(*accessorPtr, count); } grib_accessor_class* c = NULL; @@ -663,9 +663,9 @@ int grib_accessors_list_value_count(grib_accessors_list* al, size_t* count) int grib_accessor_notify_change(grib_accessor* a, grib_accessor* changed) { - if(eccodes::grib_accessor_impl_gen* ga_impl = eccodes::get_grib_accessor_impl(a); ga_impl) + if(eccodes::AccessorPtr accessorPtr = eccodes::getAccessor(a); accessorPtr) { - return ga_impl->notify_change(changed); + return accessorNotifyChange(*accessorPtr, changed); } grib_accessor_class* c = NULL; @@ -697,9 +697,9 @@ static void init_accessor(grib_accessor_class* c, grib_accessor* a, const long l void grib_init_accessor(grib_accessor* a, const long len, grib_arguments* args) { - if(eccodes::grib_accessor_impl_gen* ga_impl = eccodes::get_grib_accessor_impl(a); ga_impl) + if(eccodes::AccessorPtr accessorPtr = eccodes::getAccessor(a); accessorPtr) { - return ga_impl->init(len, args); + return; // Part of constructor } init_accessor(a->cclass, a, len, args); @@ -720,7 +720,7 @@ static void post_init_accessor(grib_accessor_class* c,grib_accessor* a) void grib_accessor_delete(grib_context* ct, grib_accessor* a) { - if(eccodes::destroy_grib_accessor_impl(a) == GRIB_SUCCESS) + if(eccodes::destroyAccessor(a) == GRIB_SUCCESS) { return; } @@ -740,9 +740,9 @@ void grib_accessor_delete(grib_context* ct, grib_accessor* a) grib_accessor* grib_accessor_clone(grib_accessor* a, grib_section* s, int* err) { - if(eccodes::grib_accessor_impl_gen* ga_impl = eccodes::get_grib_accessor_impl(a); ga_impl) + if(eccodes::AccessorPtr accessorPtr = eccodes::getAccessor(a); accessorPtr) { - return (grib_accessor*)ga_impl->make_clone(s, err); + return accessorMakeClone(*accessorPtr, s, err); } grib_accessor_class* c = a->cclass; @@ -760,9 +760,9 @@ grib_accessor* grib_accessor_clone(grib_accessor* a, grib_section* s, int* err) void grib_update_size(grib_accessor* a, size_t len) { - if(eccodes::grib_accessor_impl_gen* ga_impl = eccodes::get_grib_accessor_impl(a); ga_impl) + if(eccodes::AccessorPtr accessorPtr = eccodes::getAccessor(a); accessorPtr) { - return ga_impl->update_size(len); + return accessorUpdateSize(*accessorPtr, len); } grib_accessor_class* c = a->cclass; @@ -779,9 +779,9 @@ void grib_update_size(grib_accessor* a, size_t len) int grib_nearest_smaller_value(grib_accessor* a, double val, double* nearest) { - if(eccodes::grib_accessor_impl_gen* ga_impl = eccodes::get_grib_accessor_impl(a); ga_impl) + if(eccodes::AccessorPtr accessorPtr = eccodes::getAccessor(a); accessorPtr) { - return ga_impl->nearest_smaller_value(val, nearest); + return accessorNearestSmallerValue(*accessorPtr, val, nearest); } grib_accessor_class* c = a->cclass; @@ -798,9 +798,9 @@ int grib_nearest_smaller_value(grib_accessor* a, double val, double* nearest) size_t grib_preferred_size(grib_accessor* a, int from_handle) { - if(eccodes::grib_accessor_impl_gen* ga_impl = eccodes::get_grib_accessor_impl(a); ga_impl) + if(eccodes::AccessorPtr accessorPtr = eccodes::getAccessor(a); accessorPtr) { - return ga_impl->preferred_size(from_handle); + return accessorPreferredSize(*accessorPtr, from_handle); } grib_accessor_class* c = a->cclass; @@ -817,9 +817,9 @@ size_t grib_preferred_size(grib_accessor* a, int from_handle) grib_accessor* grib_next_accessor(grib_accessor* a) { - if(eccodes::grib_accessor_impl_gen* ga_impl = eccodes::get_grib_accessor_impl(a); ga_impl) + if(eccodes::AccessorPtr accessorPtr = eccodes::getAccessor(a); accessorPtr) { - return ga_impl->next_accessor(1); + return accessorNext(*accessorPtr, 1); } grib_accessor_class* c = a->cclass; @@ -835,9 +835,9 @@ grib_accessor* grib_next_accessor(grib_accessor* a) void grib_resize(grib_accessor* a, size_t new_size) { - if(eccodes::grib_accessor_impl_gen* ga_impl = eccodes::get_grib_accessor_impl(a); ga_impl) + if(eccodes::AccessorPtr accessorPtr = eccodes::getAccessor(a); accessorPtr) { - return ga_impl->resize(new_size); + return accessorResize(*accessorPtr, new_size); } grib_accessor_class* c = a->cclass; @@ -855,13 +855,14 @@ void grib_resize(grib_accessor* a, size_t new_size) int grib_compare_accessors(grib_accessor* a1, grib_accessor* a2, int compare_flags) { +#if 0 eccodes::grib_accessor_impl_gen* ga_impl1 = eccodes::get_grib_accessor_impl(a1); eccodes::grib_accessor_impl_gen* ga_impl2 = eccodes::get_grib_accessor_impl(a2); if(ga_impl1 && ga_impl2) { return eccodes::compare_accessors(ga_impl1, ga_impl2, compare_flags); } - +#endif int ret = 0; long type1 = 0; long type2 = 0; diff --git a/src/grib_accessor_class.cc b/src/grib_accessor_class.cc index 980cb26a1..a2a2124bf 100644 --- a/src/grib_accessor_class.cc +++ b/src/grib_accessor_class.cc @@ -19,7 +19,8 @@ // C++ support -#include "grib_accessor_impl/grib_accessor_impl_factory.h" +#include "grib_accessor_impl/AccessorFactory.h" +#include "grib_accessor_impl/Accessor.h" #if GRIB_PTHREADS static pthread_once_t once = PTHREAD_ONCE_INIT; @@ -139,9 +140,9 @@ grib_accessor* grib_accessor_factory(grib_section* p, grib_action* creator, size_t size = 0; // See if we have a cpp implementation - if(eccodes::grib_accessor_impl_gen* ga_impl = eccodes::create_grib_accessor_impl(p, creator); ga_impl) + if(eccodes::AccessorPtr accessorPtr = eccodes::makeAccessor(p, creator, len, params); accessorPtr) { - a = (grib_accessor*)ga_impl; + a = asGribAccessor(*accessorPtr); } else { @@ -187,13 +188,13 @@ grib_accessor* grib_accessor_factory(grib_section* p, grib_action* creator, else a->offset = 0; } + + grib_init_accessor(a, len, params); } - // Verify that we created either a valid object + // Verify that we created a valid object Assert(a); - grib_init_accessor(a, len, params); - size = grib_get_next_position_offset(a); if (size > p->h->buffer->ulength) { diff --git a/src/grib_accessor_impl/Accessor.cpp b/src/grib_accessor_impl/Accessor.cpp new file mode 100644 index 000000000..63c774ce9 --- /dev/null +++ b/src/grib_accessor_impl/Accessor.cpp @@ -0,0 +1,196 @@ +#include "Accessor.h" + +namespace eccodes { + +grib_accessor* asGribAccessor(Accessor const& accessor) +{ + return accessor.pimpl->operator grib_accessor*(); +} + +void accessorDump(Accessor const& accessor, grib_dumper* dumper) +{ + return accessor.pimpl->accessorDump(dumper); +} + +long accessorNextOffset(Accessor const& accessor) +{ + return accessor.pimpl->accessorNextOffset(); +} + +size_t accessorStringLength(Accessor const& accessor) +{ + return accessor.pimpl->accessorStringLength(); +} + +int accessorValueCount(Accessor const& accessor, long* count) +{ + return accessor.pimpl->accessorValueCount(count); +} + +long accessorByteCount(Accessor const& accessor) +{ + return accessor.pimpl->accessorByteCount(); +} + +long accessorByteOffset(Accessor const& accessor) +{ + return accessor.pimpl->accessorByteOffset(); +} + +int accessorNativeType(Accessor const& accessor) +{ + return accessor.pimpl->accessorNativeType(); +} + +grib_section* accessorSubSection(Accessor const& accessor) +{ + return accessor.pimpl->accessorSubSection(); +} + +int accessorPackMissing(Accessor const& accessor) +{ + return accessor.pimpl->accessorPackMissing(); +} + +int accessorIsMissing(Accessor const& accessor) +{ + return accessor.pimpl->accessorIsMissing(); +} + +int accessorPackLong(Accessor const& accessor, const long* val, size_t* len) +{ + return accessor.pimpl->accessorPackLong(val, len); +} + +int accessorUnpackLong(Accessor const& accessor, long* val, size_t* len) +{ + return accessor.pimpl->accessorUnpackLong(val, len); +} + +int accessorPackDouble(Accessor const& accessor, const double* val, size_t* len) +{ + return accessor.pimpl->accessorPackDouble(val, len); +} + +int accessorPackFloat(Accessor const& accessor, const float* val, size_t* len) +{ + return accessor.pimpl->accessorPackFloat(val, len); +} + +int accessorUnpackDouble(Accessor const& accessor, double* val, size_t* len) +{ + return accessor.pimpl->accessorUnpackDouble(val, len); +} + +int accessorUnpackFloat(Accessor const& accessor, float* val, size_t* len) +{ + return accessor.pimpl->accessorUnpackFloat(val, len); +} + +int accessorPackString(Accessor const& accessor, const char* v, size_t* len) +{ + return accessor.pimpl->accessorPackString(v, len); +} + +int accessorUnpackString(Accessor const& accessor, char* v, size_t* len) +{ + return accessor.pimpl->accessorUnpackString(v, len); +} + +int accessorPackStringArray(Accessor const& accessor, const char** v, size_t* len) +{ + return accessor.pimpl->accessorPackStringArray(v, len); +} + +int accessorUnpackStringArray(Accessor const& accessor, char** v, size_t* len) +{ + return accessor.pimpl->accessorUnpackStringArray(v, len); +} + +int accessorPackBytes(Accessor const& accessor, const unsigned char* val, size_t* len) +{ + return accessor.pimpl->accessorPackBytes(val, len); +} + +int accessorUnpackBytes(Accessor const& accessor, unsigned char* val, size_t* len) +{ + return accessor.pimpl->accessorUnpackBytes(val, len); +} + +int accessorPackExpression(Accessor const& accessor, grib_expression* e) +{ + return accessor.pimpl->accessorPackExpression(e); +} + +int accessorNotifyChange(Accessor const& accessor, grib_accessor* observed) +{ + return accessor.pimpl->accessorNotifyChange(observed); +} + +void accessorUpdateSize(Accessor const& accessor, size_t s) +{ + return accessor.pimpl->accessorUpdateSize(s); +} + +size_t accessorPreferredSize(Accessor const& accessor, int from_handle) +{ + return accessor.pimpl->accessorPreferredSize(from_handle); +} + +void accessorResize(Accessor const& accessor, size_t new_size) +{ + return accessor.pimpl->accessorResize(new_size); +} + +int accessorNearestSmallerValue(Accessor const& accessor, double val, double* nearest) +{ + return accessor.pimpl->accessorNearestSmallerValue(val, nearest); +} + +grib_accessor* accessorNext(Accessor const& accessor, int mod) +{ + return accessor.pimpl->accessorNext(mod); +} + +int accessorCompare(Accessor const& accessor, grib_accessor* b) +{ + return accessor.pimpl->accessorCompare(b); +} + +int accessorUnpackDoubleElement(Accessor const& accessor, size_t i, double* val) +{ + return accessor.pimpl->accessorUnpackDoubleElement(i, val); +} + +int accessorUnpackFloatElement(Accessor const& accessor, size_t i, float* val) +{ + return accessor.pimpl->accessorUnpackFloatElement(i, val); +} + +int accessorUnpackDoubleElementSet(Accessor const& accessor, const size_t* index_array, size_t len, double* val_array) +{ + return accessor.pimpl->accessorUnpackDoubleElementSet(index_array, len, val_array); +} + +int accessorUnpackFloatElementSet(Accessor const& accessor, const size_t* index_array, size_t len, float* val_array) +{ + return accessor.pimpl->accessorUnpackFloatElementSet(index_array, len, val_array); +} + +int accessorUnpackDoubleSubarray(Accessor const& accessor, double* val, size_t start, size_t len) +{ + return accessor.pimpl->accessorUnpackDoubleSubarray(val, start, len); +} + +int accessorClear(Accessor const& accessor) +{ + return accessor.pimpl->accessorClear(); +} + +grib_accessor* accessorMakeClone(Accessor const& accessor, grib_section* s, int* err) +{ + return accessor.pimpl->accessorMakeClone(s, err); +} + +} + diff --git a/src/grib_accessor_impl/Accessor.h b/src/grib_accessor_impl/Accessor.h new file mode 100644 index 000000000..80c8d524f --- /dev/null +++ b/src/grib_accessor_impl/Accessor.h @@ -0,0 +1,140 @@ +#ifndef _ACCESSOR_H_20230630_ +#define _ACCESSOR_H_20230630_ + +#include + +struct grib_accessor; + +#include "AccessorConcept.h" +#include "ProjString.h" + +namespace eccodes { + +// Helper for template type deduction +template +struct AccessorType{}; + +class Accessor +{ +private: + template + struct AccessorModel : AccessorConcept + { + AccessorModel(ACCESSOR_TYPE const& accessor) : accessor_{accessor} {} + AccessorModel(ACCESSOR_TYPE && accessor) : accessor_{std::move(accessor)} {} + + AccessorModel(grib_section* p, grib_action* creator, const long len, grib_arguments* arg) : + accessor_{p, creator, len, arg} {} + + operator grib_accessor*() override { return accessor_; } + + void accessorDump(grib_dumper* dumper) final { return dump(accessor_, dumper); } + long accessorNextOffset() final { return nextOffset(accessor_); } + size_t accessorStringLength() final { return stringLength(accessor_); } + int accessorValueCount(long* count) final { return valueCount(accessor_, count); } + long accessorByteCount() final { return byteCount(accessor_); } + long accessorByteOffset() final { return byteOffset(accessor_); } + int accessorNativeType() final { return nativeType(accessor_); } + grib_section* accessorSubSection() final { return subSection(accessor_); } + int accessorPackMissing() final { return packMissing(accessor_); } + int accessorIsMissing() final { return isMissing(accessor_); } + + int accessorPackLong(const long* val, size_t* len) final { return packLong(accessor_, val, len); } + int accessorPackDouble(const double* val, size_t* len) final { return packDouble(accessor_, val, len); } + int accessorPackFloat(const float* val, size_t* len) final { return packFloat(accessor_, val, len); } + int accessorPackString(const char* v, size_t* len) final { return packString(accessor_, v, len); } + int accessorPackStringArray(const char** v, size_t* len) final { return packStringArray(accessor_, v, len); } + int accessorPackBytes(const unsigned char* val, size_t* len) final { return packBytes(accessor_, val, len); } + int accessorPackExpression(grib_expression* e) final { return packExpression(accessor_, e); } + + int accessorUnpackLong(long* val, size_t* len) final { return unpackLong(accessor_, val, len); } + int accessorUnpackDouble(double* val, size_t* len) final { return unpackDouble(accessor_, val, len); } + int accessorUnpackFloat(float* val, size_t* len) final { return unpackFloat(accessor_, val, len); } + int accessorUnpackString(char* v, size_t* len) final { return unpackString(accessor_, v, len); } + int accessorUnpackStringArray(char** v, size_t* len) final { return unpackStringArray(accessor_, v, len); } + int accessorUnpackBytes(unsigned char* val, size_t* len) final { return unpackBytes(accessor_, val, len); } + int accessorUnpackDoubleElement(size_t i, double* val) final { return unpackDoubleElement(accessor_, i, val); } + int accessorUnpackFloatElement(size_t i, float* val) final { return unpackFloatElement(accessor_, i, val); } + int accessorUnpackDoubleElementSet(const size_t* index_array, size_t len, double* val_array) final { return unpackDoubleElementSet(accessor_, index_array, len, val_array); } + int accessorUnpackFloatElementSet(const size_t* index_array, size_t len, float* val_array) final { return unpackFloatElementSet(accessor_, index_array, len, val_array); } + int accessorUnpackDoubleSubarray(double* val, size_t start, size_t len) final { return unpackDoubleSubarray(accessor_, val, start, len); } + + int accessorNotifyChange(grib_accessor* observed) final { return notifyChange(accessor_, observed); } + void accessorUpdateSize(size_t s) final { return updateSize(accessor_, s); } + size_t accessorPreferredSize(int from_handle) final { return preferredSize(accessor_, from_handle); } + void accessorResize(size_t new_size) final { return resize(accessor_, new_size); } + int accessorNearestSmallerValue(double val, double* nearest) final { return nearestSmallerValue(accessor_, val, nearest); } + grib_accessor* accessorNext(int mod) final { return next(accessor_, mod); } + int accessorCompare(grib_accessor* b) final { return compare(accessor_, b); } + int accessorClear() final { return clear(accessor_); } + grib_accessor* accessorMakeClone(grib_section* s, int* err) final { return makeClone(accessor_, s, err); } + + ACCESSOR_TYPE accessor_; + }; + + friend grib_accessor* asGribAccessor(Accessor const& accessor); + friend void accessorDump(Accessor const& accessor, grib_dumper* dumper); + friend long accessorNextOffset(Accessor const& accessor); + friend size_t accessorStringLength(Accessor const& accessor); + friend int accessorValueCount(Accessor const& accessor, long* count); + friend long accessorByteCount(Accessor const& accessor); + friend long accessorByteOffset(Accessor const& accessor); + friend int accessorNativeType(Accessor const& accessor); + friend grib_section* accessorSubSection(Accessor const& accessor); + friend int accessorPackMissing(Accessor const& accessor); + friend int accessorIsMissing(Accessor const& accessor); + + friend int accessorPackLong(Accessor const& accessor, const long* val, size_t* len); + friend int accessorPackDouble(Accessor const& accessor, const double* val, size_t* len); + friend int accessorPackFloat(Accessor const& accessor, const float* val, size_t* len); + friend int accessorPackString(Accessor const& accessor, const char* v, size_t* len); + friend int accessorPackStringArray(Accessor const& accessor, const char** v, size_t* len); + friend int accessorPackBytes(Accessor const& accessor, const unsigned char* val, size_t* len); + friend int accessorPackExpression(Accessor const& accessor, grib_expression* e); + + friend int accessorUnpackLong(Accessor const& accessor, long* val, size_t* len); + friend int accessorUnpackDouble(Accessor const& accessor, double* val, size_t* len); + friend int accessorUnpackFloat(Accessor const& accessor, float* val, size_t* len); + friend int accessorUnpackString(Accessor const& accessor, char* v, size_t* len); + friend int accessorUnpackStringArray(Accessor const& accessor, char** v, size_t* len); + friend int accessorUnpackBytes(Accessor const& accessor, unsigned char* val, size_t* len); + friend int accessorUnpackDoubleElement(Accessor const& accessor, size_t i, double* val); + friend int accessorUnpackFloatElement(Accessor const& accessor, size_t i, float* val); + friend int accessorUnpackDoubleElementSet(Accessor const& accessor, const size_t* index_array, size_t len, double* val_array); + friend int accessorUnpackFloatElementSet(Accessor const& accessor, const size_t* index_array, size_t len, float* val_array); + friend int accessorUnpackDoubleSubarray(Accessor const& accessor, double* val, size_t start, size_t len); + + friend int accessorNotifyChange(Accessor const& accessor, grib_accessor* observed); + friend void accessorUpdateSize(Accessor const& accessor, size_t s); + friend size_t accessorPreferredSize(Accessor const& accessor, int from_handle); + friend void accessorResize(Accessor const& accessor, size_t new_size); + friend int accessorNearestSmallerValue(Accessor const& accessor, double val, double* nearest); + friend grib_accessor* accessorNext(Accessor const& accessor, int mod); + friend int accessorCompare(Accessor const& accessor, grib_accessor* b); + friend int accessorClear(Accessor const& accessor); + friend grib_accessor* accessorMakeClone(Accessor const& accessor, grib_section* s, int* err); + + std::unique_ptr pimpl; + +public: + template + Accessor(ACCESSOR_TYPE const& accessor) : pimpl{ std::make_unique>(accessor)} {} + + template + Accessor(ACCESSOR_TYPE&& accessor) : pimpl{ std::make_unique>(std::move(accessor))} {} + + // AccessorType is required to allow us to deduce the template type, as constructors only support + // the format when it is part of the class definition, i.e. Accessor(...) is invalid here... + template + Accessor(AccessorType, grib_section* p, grib_action* creator, const long len, grib_arguments* arg) : + pimpl{ std::make_unique>(p, creator, len, arg)} {} + + Accessor(Accessor const&) = delete; + Accessor& operator=(Accessor const&) = delete; + Accessor(Accessor&&) = default; + Accessor& operator=(Accessor&&) = default; +}; + +} + +#endif // _ACCESSOR_H_20230630_ diff --git a/src/grib_accessor_impl/AccessorConcept.h b/src/grib_accessor_impl/AccessorConcept.h new file mode 100644 index 000000000..ec5b4d683 --- /dev/null +++ b/src/grib_accessor_impl/AccessorConcept.h @@ -0,0 +1,64 @@ +#ifndef _ACCESSOR_CONCEPT_H_20230711_ +#define _ACCESSOR_CONCEPT_H_20230711_ + +#include // size_t + +struct grib_accessor; +struct grib_dumper; +struct grib_section; +struct grib_expression; + +namespace eccodes { + +// Define all APIs available to an accessor + +struct AccessorConcept +{ + virtual ~AccessorConcept() = default; + + virtual operator grib_accessor*() = 0; + virtual void accessorDump(grib_dumper* dumper) = 0; + virtual long accessorNextOffset() = 0; + virtual size_t accessorStringLength() = 0; + virtual int accessorValueCount(long* count) = 0; + virtual long accessorByteCount() = 0; + virtual long accessorByteOffset() = 0; + virtual int accessorNativeType() = 0; + virtual grib_section* accessorSubSection() = 0; + virtual int accessorPackMissing() = 0; + virtual int accessorIsMissing() = 0; + + virtual int accessorPackLong(const long* val, size_t* len) = 0; + virtual int accessorPackDouble(const double* val, size_t* len) = 0; + virtual int accessorPackFloat(const float* val, size_t* len) = 0; + virtual int accessorPackString(const char* v, size_t* len) = 0; + virtual int accessorPackStringArray(const char** v, size_t* len) = 0; + virtual int accessorPackBytes(const unsigned char* val, size_t* len) = 0; + virtual int accessorPackExpression(grib_expression* e) = 0; + + virtual int accessorUnpackLong(long* val, size_t* len) = 0; + virtual int accessorUnpackDouble(double* val, size_t* len) = 0; + virtual int accessorUnpackFloat(float* val, size_t* len) = 0; + virtual int accessorUnpackString(char* v, size_t* len) = 0; + virtual int accessorUnpackStringArray(char** v, size_t* len) = 0; + virtual int accessorUnpackBytes(unsigned char* val, size_t* len) = 0; + virtual int accessorUnpackDoubleElement(size_t i, double* val) = 0; + virtual int accessorUnpackFloatElement(size_t i, float* val) = 0; + virtual int accessorUnpackDoubleElementSet(const size_t* index_array, size_t len, double* val_array) = 0; + virtual int accessorUnpackFloatElementSet(const size_t* index_array, size_t len, float* val_array) = 0; + virtual int accessorUnpackDoubleSubarray(double* val, size_t start, size_t len) = 0; + + virtual int accessorNotifyChange(grib_accessor* observed) = 0; + virtual void accessorUpdateSize(size_t s) = 0; + virtual size_t accessorPreferredSize(int from_handle) = 0; + virtual void accessorResize(size_t new_size) = 0; + virtual int accessorNearestSmallerValue(double val, double* nearest) = 0; + virtual grib_accessor* accessorNext(int mod) = 0; + virtual int accessorCompare(grib_accessor* b) = 0; + virtual int accessorClear() = 0; + virtual grib_accessor* accessorMakeClone(grib_section* s, int* err) = 0; +}; + +} + +#endif // _ACCESSOR_CONCEPT_H_20230711_ diff --git a/src/grib_accessor_impl/AccessorFactory.cpp b/src/grib_accessor_impl/AccessorFactory.cpp new file mode 100644 index 000000000..c203be131 --- /dev/null +++ b/src/grib_accessor_impl/AccessorFactory.cpp @@ -0,0 +1,105 @@ +#include "AccessorFactory.h" +#include "Accessor.h" +#include "Accessor_Utils.h" +#include "AccessorMaker.h" +#include "grib_api_internal.h" + +#include "ProjString.h" + +#include +#include + +namespace eccodes { + + static std::vector accessorStore{}; + + AccessorPtr makeAccessor(grib_section* p, grib_action* creator, const long len, grib_arguments* arg) + { + if(cppMode() != CppMode::enabled) { return {}; } + if(!creator->op) { return {}; } + + if(auto maker = getMaker(creator->op)) + { + accessorStore.emplace_back(maker->pimpl->makeAccessor(p, creator, len, arg)); + return AccessorPtr(&accessorStore.back()); + } + + return {}; + } + + // Check if the grib_accessor* actually points to a valid class, and return + // a pointer to the class if so, or nullptr + AccessorPtr getAccessor(grib_accessor* a) + { + if(!a || a->cclass) { return {}; } + + if(auto it = std::find_if(std::begin(accessorStore), std::end(accessorStore), + [&a](Accessor const& accessor){ return a==asGribAccessor(accessor);}); + it != accessorStore.end()) + { + return AccessorPtr(&*it); + } + + return {}; + } + + int destroyAccessor(grib_accessor* a) + { + if(auto it = std::find_if(std::begin(accessorStore), std::end(accessorStore), + [&a](Accessor const& accessor){ return a==asGribAccessor(accessor);}); + it != accessorStore.end()) + { + accessorStore.erase(it); + return GRIB_SUCCESS; + } + + return GRIB_NOT_FOUND; + } + +#if 0 + std::unordered_set ga_store{}; + + grib_accessor_impl_gen* create_grib_accessor_impl(grib_section* p, grib_action* creator) + { + if(get_cpp_mode() != cpp_mode::enabled) { return nullptr; } + if(!creator->op) { return nullptr; } + + grib_accessor_impl_gen* ga_impl{}; + + if(auto impl_creator = get_ga_impl_creator(creator->op)) + { + ga_impl = impl_creator(p, creator); + if(ga_impl) { ga_store.insert(ga_impl); } + } + + return ga_impl; + } + + int destroy_grib_accessor_impl(grib_accessor* a) + { + grib_accessor_impl_gen* ga_impl = (grib_accessor_impl_gen*)a; + + if(ga_store.count(ga_impl) > 0) { + ga_store.erase(ga_impl); + delete ga_impl; + return GRIB_SUCCESS; + } + + return GRIB_NOT_FOUND; + } + + // Check if the grib_accessor* actually points to a valid class, and returns + // a pointer to the class if so, or nullptr + grib_accessor_impl_gen* get_grib_accessor_impl(grib_accessor* a) + { + if(!a || a->cclass) { return nullptr; } + + if(ga_store.count((grib_accessor_impl_gen*)a) > 0) { + return (grib_accessor_impl_gen*)a; + } + + return nullptr; + } + +#endif +} diff --git a/src/grib_accessor_impl/AccessorFactory.h b/src/grib_accessor_impl/AccessorFactory.h new file mode 100644 index 000000000..b1b166657 --- /dev/null +++ b/src/grib_accessor_impl/AccessorFactory.h @@ -0,0 +1,21 @@ +#ifndef _ACCESSOR_FACTORY_H_20230706_ +#define _ACCESSOR_FACTORY_H_20230706_ + +#include "AccessorPtr.h" + +#include +#include + +struct grib_section; +struct grib_action; +struct grib_arguments; +struct grib_accessor; + +namespace eccodes { +AccessorPtr makeAccessor(grib_section* p, grib_action* creator, const long len, grib_arguments* arg); +AccessorPtr getAccessor(grib_accessor* a); +int destroyAccessor(grib_accessor* a); + +} + +#endif // _ACCESSOR_FACTORY_H_20230706_ diff --git a/src/grib_accessor_impl/AccessorMaker.cpp b/src/grib_accessor_impl/AccessorMaker.cpp new file mode 100644 index 000000000..51bf7b234 --- /dev/null +++ b/src/grib_accessor_impl/AccessorMaker.cpp @@ -0,0 +1,37 @@ +#include "AccessorMaker.h" + +#include +#include + +#include "grib_api_internal.h" + +namespace eccodes { + +std::mutex makers_mutex; +static std::unordered_map makers; + +void registerMaker(std::string const& name, AccessorMaker const* maker) +{ + std::lock_guard guard(makers_mutex); + + if(auto it = makers.find(name); it != makers.end()) + { + Assert(false); + } + + makers[name] = maker; +} + +AccessorMaker const* getMaker(std::string const& name) +{ + std::lock_guard guard(makers_mutex); + + if(auto it = makers.find(name); it != makers.end()) + { + return it->second; + } + + return nullptr; +} + +} diff --git a/src/grib_accessor_impl/AccessorMaker.h b/src/grib_accessor_impl/AccessorMaker.h new file mode 100644 index 000000000..3d5dd7ec9 --- /dev/null +++ b/src/grib_accessor_impl/AccessorMaker.h @@ -0,0 +1,48 @@ +#ifndef _ACCESSOR_MAKER_H_20230714_ +#define _ACCESSOR_MAKER_H_20230714_ + +#include "Accessor.h" +#include "AccessorPtr.h" + +#include +#include +#include + +struct grib_section; +struct grib_action; +struct grib_arguments; +struct grib_accessor; + +namespace eccodes { +class AccessorMaker; +void registerMaker(std::string const& name, AccessorMaker const* maker); +AccessorMaker const* getMaker(std::string const& name); + +class AccessorMaker { + struct MakerConcept { + virtual ~MakerConcept() = default; + virtual Accessor makeAccessor(grib_section* p, grib_action* creator, const long len, grib_arguments* arg) const = 0; + }; + + template + struct MakerModel : public MakerConcept { + Accessor makeAccessor(grib_section* p, grib_action* creator, const long len, grib_arguments* arg) const final { + return Accessor(AccessorType{}, p, creator, len, arg); + } + }; + + friend AccessorPtr makeAccessor(grib_section* p, grib_action* creator, const long len, grib_arguments* arg); + + std::unique_ptr pimpl; + +public: + template + AccessorMaker(std::string const& name, AccessorType) : + pimpl{ std::make_unique>()} { + registerMaker(name, this); + } +}; + +} + +#endif // _ACCESSOR_MAKER_H_20230714_ diff --git a/src/grib_accessor_impl/AccessorPtr.cpp b/src/grib_accessor_impl/AccessorPtr.cpp new file mode 100644 index 000000000..5cfb33c7e --- /dev/null +++ b/src/grib_accessor_impl/AccessorPtr.cpp @@ -0,0 +1,21 @@ +#include "AccessorPtr.h" +#include "Accessor.h" +#include + +namespace eccodes { + +constexpr Accessor* AccessorPtr::release() noexcept { + Accessor* tmp = get(); + reset(); + return tmp; +} + +constexpr void AccessorPtr::reset(Accessor* accessor /* = nullptr */) noexcept { + ptr_ = accessor; +} + +void AccessorPtr::swap(AccessorPtr& other) noexcept { + std::swap(ptr_, other.ptr_); +} + +} diff --git a/src/grib_accessor_impl/AccessorPtr.h b/src/grib_accessor_impl/AccessorPtr.h new file mode 100644 index 000000000..5f30d6434 --- /dev/null +++ b/src/grib_accessor_impl/AccessorPtr.h @@ -0,0 +1,31 @@ +#ifndef _ACCESSOR_PTR_H_20230712_ +#define _ACCESSOR_PTR_H_20230712_ + +namespace eccodes { + +// A non-owning pointer to an accessor +// Based on https://en.cppreference.com/w/cpp/experimental/observer_ptr + +class Accessor; + +class AccessorPtr{ + Accessor* ptr_{}; + +public: + constexpr AccessorPtr() noexcept : ptr_{nullptr} {}; + constexpr explicit AccessorPtr(Accessor* accessor) noexcept : ptr_{accessor} {}; + + constexpr Accessor* get() const noexcept { return ptr_; } + constexpr Accessor& operator*() const { return *get(); } + constexpr Accessor* operator->() const noexcept { return get(); } + constexpr explicit operator bool() const noexcept { return get() != nullptr; } + constexpr explicit operator Accessor*() const noexcept { return get(); } + + constexpr Accessor* release() noexcept; + constexpr void reset(Accessor* accessor = nullptr) noexcept; + void swap(AccessorPtr& other) noexcept; +}; + +} + +#endif // _ACCESSOR_PTR_H_20230712_ diff --git a/src/grib_accessor_impl/Accessor_TEMPLATE.h b/src/grib_accessor_impl/Accessor_TEMPLATE.h new file mode 100644 index 000000000..a24ffdd6a --- /dev/null +++ b/src/grib_accessor_impl/Accessor_TEMPLATE.h @@ -0,0 +1,62 @@ +#ifndef _ACCESSOR_H_20230630_ +#define _ACCESSOR_H_20230630_ + +#include "AccessorImpl.h" + +namespace eccodes { + +template +class Accessor : public AccessorImpl { + + ACCESSOR_TYPE accessor_; + +public: + operator grib_accessor*(); + operator ACCESSOR_TYPE*(); + +private: + void dump(grib_dumper* dumper) override; + long next_offset() override; + size_t string_length() override; + int value_count(long* count) override; + long byte_count() override; + long byte_offset() override; + int get_native_type() override; + grib_section* sub_section() override; + int pack_missing() override; + int is_missing() override; + int pack_long(const long* val, size_t* len) override; + int unpack_long(long* val, size_t* len) override; + int pack_double(const double* val, size_t* len) override; + int pack_float(const float* val, size_t* len) override; + int unpack_double(double* val, size_t* len) override; + int unpack_float(float* val, size_t* len) override; + int pack_string(const char* v, size_t* len) override; + int unpack_string(char* v, size_t* len) override; + int pack_string_array(const char** v, size_t* len) override; + int unpack_string_array(char** v, size_t* len) override; + int pack_bytes(const unsigned char* val, size_t* len) override; + int unpack_bytes(unsigned char* val, size_t* len) override; + int pack_expression(grib_expression* e) override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value(double val, double* nearest) override; + grib_accessor* next(int mod) override; + int compare(grib_accessor* b) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor* make_clone(grib_section* s, int* err) override; + +public: + virtual ~AccessorImpl(); +}; + +} + +#endif // _ACCESSOR_H_20230630_ diff --git a/src/grib_accessor_impl/Accessor_Utils.cpp b/src/grib_accessor_impl/Accessor_Utils.cpp new file mode 100644 index 000000000..c6a184ef5 --- /dev/null +++ b/src/grib_accessor_impl/Accessor_Utils.cpp @@ -0,0 +1,26 @@ +#include "Accessor_Utils.h" + +#include +#include + +namespace eccodes { + + using namespace std::string_view_literals; + + constexpr std::string_view cpp_mode_env = "cpp_mode"sv; + constexpr std::string_view cpp_mode_env_enabled = "1"sv; + + CppMode cppMode() + { + static CppMode cppMode_ = [](){ + if(const char* envStr = std::getenv(cpp_mode_env.data()); + envStr && envStr == cpp_mode_env_enabled) { + return CppMode::enabled; + } + return CppMode::disabled; + }(); + + return cppMode_; + } +} + diff --git a/src/grib_accessor_impl/Accessor_Utils.h b/src/grib_accessor_impl/Accessor_Utils.h new file mode 100644 index 000000000..932f4454e --- /dev/null +++ b/src/grib_accessor_impl/Accessor_Utils.h @@ -0,0 +1,13 @@ +#ifndef _GRIB_CPP_UTILS_H_20230624_ +#define _GRIB_CPP_UTILS_H_20230624_ + +namespace eccodes { + + // Set env var grib_cpp to 1 to enable C++ mode: + // $ export cpp_mode=1 + enum class CppMode { notSet, enabled, disabled}; + CppMode cppMode(); + +} + +#endif // _GRIB_CPP_UTILS_H_20230624_ diff --git a/src/grib_accessor_impl/CMakeLists.txt b/src/grib_accessor_impl/CMakeLists.txt index 29e233211..f50305bac 100644 --- a/src/grib_accessor_impl/CMakeLists.txt +++ b/src/grib_accessor_impl/CMakeLists.txt @@ -13,15 +13,21 @@ # Note the PARENT_SCOPE option sets the variable in the calling CMakeLists.txt # file - it remains undefined in this file: https://cmake.org/cmake/help/latest/command/set.html set(eccodes_grib_accessor_impl_src_files - ${CMAKE_CURRENT_LIST_DIR}/ga_impl_creators.cpp - ${CMAKE_CURRENT_LIST_DIR}/grib_accessor_impl.h - ${CMAKE_CURRENT_LIST_DIR}/grib_accessor_impl_abstract_long_vector.cpp - ${CMAKE_CURRENT_LIST_DIR}/grib_accessor_impl_factory.cpp - ${CMAKE_CURRENT_LIST_DIR}/grib_accessor_impl_g1step_range.cpp - ${CMAKE_CURRENT_LIST_DIR}/grib_accessor_impl_gen.cpp - ${CMAKE_CURRENT_LIST_DIR}/grib_accessor_impl_helper.cpp - ${CMAKE_CURRENT_LIST_DIR}/grib_accessor_impl_proj_string.cpp - ${CMAKE_CURRENT_LIST_DIR}/grib_cpp_utils.cpp + ${CMAKE_CURRENT_LIST_DIR}/Accessor_Utils.h + ${CMAKE_CURRENT_LIST_DIR}/Accessor.h + ${CMAKE_CURRENT_LIST_DIR}/AccessorConcept.h + ${CMAKE_CURRENT_LIST_DIR}/AccessorFactory.h + ${CMAKE_CURRENT_LIST_DIR}/AccessorMaker.h + ${CMAKE_CURRENT_LIST_DIR}/AccessorPtr.h + ${CMAKE_CURRENT_LIST_DIR}/Generic.h + ${CMAKE_CURRENT_LIST_DIR}/ProjString.h + ${CMAKE_CURRENT_LIST_DIR}/Accessor_Utils.cpp + ${CMAKE_CURRENT_LIST_DIR}/Accessor.cpp + ${CMAKE_CURRENT_LIST_DIR}/AccessorFactory.cpp + ${CMAKE_CURRENT_LIST_DIR}/AccessorMaker.cpp + ${CMAKE_CURRENT_LIST_DIR}/AccessorPtr.cpp + ${CMAKE_CURRENT_LIST_DIR}/Generic.cpp + ${CMAKE_CURRENT_LIST_DIR}/ProjString.cpp ${CMAKE_CURRENT_LIST_DIR}/pack_buffer.cpp ${CMAKE_CURRENT_LIST_DIR}/proj_string_helper.cpp PARENT_SCOPE diff --git a/src/grib_accessor_impl/Generic.cpp b/src/grib_accessor_impl/Generic.cpp new file mode 100644 index 000000000..5a8ca2a5d --- /dev/null +++ b/src/grib_accessor_impl/Generic.cpp @@ -0,0 +1,87 @@ +#include "Generic.h" +//#include + +namespace eccodes { + +Generic::Generic(grib_section* p, grib_action* creator, const long len, grib_arguments* arg) +{ +// std::cout << "Generic() addr=0x" << std::hex << this << '\n'; + + // att is default initialised at this point... + att.name = creator->name; + att.name_space = creator->name_space; + att.context = p->h->context; + att.creator = creator; + + if (p->block->last) { att.offset = grib_get_next_position_offset(p->block->last); } + else { + if (p->owner) { att.offset = p->owner->offset; } + else { att.offset = 0; } + } + + att.parent = p; + att.flags = creator->flags; + + att.all_names[0] = creator->name; + att.all_name_spaces[0] = creator->name_space; + att.set = creator->set; + + // init() functionality + grib_action* act = (grib_action*)(att.creator); + if (att.flags & GRIB_ACCESSOR_FLAG_TRANSIENT) { + att.length = 0; + if (!att.vvalue) + att.vvalue = (grib_virtual_value*)grib_context_malloc_clear(att.context, sizeof(grib_virtual_value)); + att.vvalue->type = grib_accessor_get_native_type(*this); + att.vvalue->length = len; + if (act->default_value != NULL) { + const char* p = 0; + size_t s_len = 1; + long l; + int ret = 0; + double d; + char tmp[1024]; + grib_expression* expression = grib_arguments_get_expression(grib_handle_of_accessor(*this), act->default_value, 0); + int type = grib_expression_native_type(grib_handle_of_accessor(*this), expression); + switch (type) { + case GRIB_TYPE_DOUBLE: + grib_expression_evaluate_double(grib_handle_of_accessor(*this), expression, &d); + grib_pack_double(*this, &d, &s_len); + break; + + case GRIB_TYPE_LONG: + grib_expression_evaluate_long(grib_handle_of_accessor(*this), expression, &l); + grib_pack_long(*this, &l, &s_len); + break; + + default: + s_len = sizeof(tmp); + p = grib_expression_evaluate_string(grib_handle_of_accessor(*this), expression, tmp, &s_len, &ret); + if (ret != GRIB_SUCCESS) { + grib_context_log(att.context, GRIB_LOG_ERROR, "Unable to evaluate %s as string", att.name); + Assert(0); + } + s_len = strlen(p) + 1; + grib_pack_string(*this, p, &s_len); + break; + } + } + } + else { + att.length = len; + } + +} + +Generic::~Generic() +{ +// std::cout << "~Generic() addr=0x" << std::hex << this << '\n'; + grib_dependency_remove_observed(*this); + grib_dependency_remove_observer(*this); + if (att.vvalue != NULL) { + free(att.vvalue); + att.vvalue = NULL; + } +} + +} diff --git a/src/grib_accessor_impl/Generic.h b/src/grib_accessor_impl/Generic.h new file mode 100644 index 000000000..58de59733 --- /dev/null +++ b/src/grib_accessor_impl/Generic.h @@ -0,0 +1,311 @@ +#ifndef _GENERIC_H_20230705_ +#define _GENERIC_H_20230705_ + +#include "grib_api_internal.h" + +namespace eccodes { + +struct Generic +{ + grib_accessor att{}; + + Generic(grib_section* p, grib_action* creator, const long len, grib_arguments* arg); + virtual ~Generic(); + + operator grib_accessor*() { return &att; } + + // Prevent copies and moves + Generic(Generic const&) = delete; + Generic& operator=(Generic const&) = delete; + Generic(Generic&&) = delete; + Generic& operator=(Generic&&) = delete; +}; + +// Templated versions of the Accessor functions that provide a "fallback" version if not specialised + +template +void dump(ACCESSOR_TYPE& accessor, grib_dumper* dumper) +{ + int type = grib_accessor_get_native_type(accessor); + + switch (type) { + case GRIB_TYPE_STRING: + grib_dump_string(dumper, accessor, NULL); + break; + case GRIB_TYPE_DOUBLE: + grib_dump_double(dumper, accessor, NULL); + break; + case GRIB_TYPE_LONG: + grib_dump_long(dumper, accessor, NULL); + break; + default: + grib_dump_bytes(dumper, accessor, NULL); + } +} + +template +long nextOffset(ACCESSOR_TYPE& accessor) +{ + return accessor.att.offset + accessor.att.length; +} + +template +size_t stringLength(ACCESSOR_TYPE& accessor) +{ + return 1024; +} + +template +int valueCount(ACCESSOR_TYPE& accessor, long* count) +{ + *count = 1; + return 0; +} + +template +long byteCount(ACCESSOR_TYPE& accessor) +{ + return accessor.att.length; +} + +template +long byteOffset(ACCESSOR_TYPE& accessor) +{ + return accessor.att.offset; +} + +template +int nativeType(ACCESSOR_TYPE& accessor) +{ + grib_context_log(accessor.att.context, GRIB_LOG_ERROR, + "Accessor %s must implement 'get_native_type'", accessor.att.name); + return GRIB_TYPE_UNDEFINED; +} + +template +grib_section* subSection(ACCESSOR_TYPE& accessor) +{ + return NULL; +} + +template +int packMissing(ACCESSOR_TYPE& accessor) +{ + return GRIB_NOT_IMPLEMENTED; +} + +template +int isMissing(ACCESSOR_TYPE& accessor) +{ + int i = 0; + int is_missing = 1; + unsigned char ones = 0xff; + unsigned char* v = NULL; + + if (accessor.att.flags & GRIB_ACCESSOR_FLAG_TRANSIENT) { + if (accessor.att.vvalue == NULL) { + grib_context_log(accessor.att.context, GRIB_LOG_ERROR, "%s internal error (flags=0x%lX)", accessor.att.name, accessor.att.flags); + Assert(!"grib_accessor_class_gen::is_missing(): accessor.att.vvalue == NULL"); + return 0; + } + return accessor.att.vvalue->missing; + } + Assert(accessor.att.length >= 0); + + v = grib_handle_of_accessor(accessor)->buffer->data + accessor.att.offset; + + for (i = 0; i < accessor.att.length; i++) { + if (*v != ones) { + is_missing = 0; + break; + } + v++; + } + + return is_missing; +} + +template +int packLong(ACCESSOR_TYPE& accessor, const long* val, size_t* len) +{ + return GRIB_NOT_IMPLEMENTED; +} + +template +int unpackLong(ACCESSOR_TYPE& accessor, long* val, size_t* len) +{ + return GRIB_NOT_IMPLEMENTED; +} + +template +int packDouble(ACCESSOR_TYPE& accessor, const double* val, size_t* len) +{ + return GRIB_NOT_IMPLEMENTED; +} + +template +int packFloat(ACCESSOR_TYPE& accessor, const float* val, size_t* len) +{ + return GRIB_NOT_IMPLEMENTED; +} + +template +int unpackDouble(ACCESSOR_TYPE& accessor, double* val, size_t* len) +{ + return GRIB_NOT_IMPLEMENTED; +} + +template +int unpackFloat(ACCESSOR_TYPE& accessor, float* val, size_t* len) +{ + return GRIB_NOT_IMPLEMENTED; +} + +template +int packString(ACCESSOR_TYPE& accessor, const char* v, size_t* len) +{ + return GRIB_NOT_IMPLEMENTED; +} + +template +int unpackString(ACCESSOR_TYPE& accessor, char* v, size_t* len) +{ + return GRIB_NOT_IMPLEMENTED; +} + +template +int packStringArray(ACCESSOR_TYPE& accessor, const char** v, size_t* len) +{ + return GRIB_NOT_IMPLEMENTED; +} + +template +int unpackStringArray(ACCESSOR_TYPE& accessor, char** v, size_t* len) +{ + return GRIB_NOT_IMPLEMENTED; +} + +template +int packBytes(ACCESSOR_TYPE& accessor, const unsigned char* val, size_t* len) +{ + return GRIB_NOT_IMPLEMENTED; +} + +template +int unpackBytes(ACCESSOR_TYPE& accessor, unsigned char* val, size_t* len) +{ + return GRIB_NOT_IMPLEMENTED; +} + +template +int packExpression(ACCESSOR_TYPE& accessor, grib_expression* e) +{ + return GRIB_NOT_IMPLEMENTED; +} + +template +int notifyChange(ACCESSOR_TYPE& accessor, grib_accessor* observed) +{ + /* Default behaviour is to notify creator */ + return grib_action_notify_change(accessor.att.creator, accessor, observed); +} + +template +void updateSize(ACCESSOR_TYPE& accessor, size_t s) +{ + grib_context_log(accessor.att.context, GRIB_LOG_ERROR, + "Accessor %s must implement 'update_size'", accessor.att.name); + Assert(0 == 1); +} + +template +size_t preferredSize(ACCESSOR_TYPE& accessor, int from_handle) +{ + return accessor.att.length; +} + +template +void resize(ACCESSOR_TYPE& accessor, size_t new_size) +{ + return; +} + +template +int nearestSmallerValue(ACCESSOR_TYPE& accessor, double val, double* nearest) +{ + return GRIB_NOT_IMPLEMENTED; +} + +template +grib_accessor* next(ACCESSOR_TYPE& accessor, int mod) +{ + grib_accessor* next = NULL; + if (accessor.att.next) { + next = accessor.att.next; + } + else { + // TODO - Need to convert parent->owner to Accessor) + if (accessor.att.parent->owner) + next = accessor.att.parent->owner->cclass->next(accessor.att.parent->owner, 0); + } + return next; +} + +template +int compare(ACCESSOR_TYPE& accessor, grib_accessor* b) +{ + return GRIB_NOT_IMPLEMENTED; +} + +template +int unpackDoubleElement(ACCESSOR_TYPE& accessor, size_t i, double* val) +{ + return GRIB_NOT_IMPLEMENTED; +} + +template +int unpackFloatElement(ACCESSOR_TYPE& accessor, size_t i, float* val) +{ + return GRIB_NOT_IMPLEMENTED; +} + +template +int unpackDoubleElementSet(ACCESSOR_TYPE& accessor, const size_t* index_array, size_t len, double* val_array) +{ + return GRIB_NOT_IMPLEMENTED; +} + +template +int unpackFloatElementSet(ACCESSOR_TYPE& accessor, const size_t* index_array, size_t len, float* val_array) +{ + return GRIB_NOT_IMPLEMENTED; +} + +template +int unpackDoubleSubarray(ACCESSOR_TYPE& accessor, double* val, size_t start, size_t len) +{ + return GRIB_NOT_IMPLEMENTED; +} + +template +int clear(ACCESSOR_TYPE& accessor) +{ + unsigned char* buf = grib_handle_of_accessor(accessor)->buffer->data; + long length = grib_byte_count(accessor); + long offset = grib_byte_offset(accessor); + + memset(buf + offset, 0, length); + + return GRIB_SUCCESS; +} + +template +grib_accessor* makeClone(ACCESSOR_TYPE& accessor, grib_section* s, int* err) +{ + *err = GRIB_NOT_IMPLEMENTED; + return NULL; +} + + +} +#endif // _GENERIC_H_20230705_ diff --git a/src/grib_accessor_impl/ProjString.cpp b/src/grib_accessor_impl/ProjString.cpp new file mode 100644 index 000000000..16a8b6995 --- /dev/null +++ b/src/grib_accessor_impl/ProjString.cpp @@ -0,0 +1,75 @@ +#include "ProjString.h" +#include "proj_string_helper.h" +#include "AccessorMaker.h" + +//#include + +namespace eccodes { + +ProjString::ProjString(grib_section* p, grib_action* creator, const long len, grib_arguments* arg) : + Generic(p, creator, len, arg) +{ +// std::cout << "ProjString() addr=0x" << std::hex << this << '\n'; + grib_handle* h = grib_handle_of_accessor(*this); + + this->grid_type = grib_arguments_get_name(h, arg, 0); + this->endpoint = grib_arguments_get_long(h, arg, 1); + att.length = 0; + att.flags |= GRIB_ACCESSOR_FLAG_READ_ONLY; + att.flags |= GRIB_ACCESSOR_FLAG_EDITION_SPECIFIC; +} + +ProjString::~ProjString() +{ +// std::cout << "~ProjString() addr=0x" << std::hex << this << '\n'; +} + +int nativeType(ProjString& projString) +{ + return GRIB_TYPE_STRING; +} + +#define ENDPOINT_SOURCE 0 +#define ENDPOINT_TARGET 1 + +int unpackString(ProjString& projString, char* v, size_t* len) +{ + int err = 0, found = 0; + size_t i = 0; + char grid_type[64] = {0,}; + grib_handle* h = grib_handle_of_accessor(projString); + size_t size = sizeof(grid_type) / sizeof(*grid_type); + + Assert(projString.endpoint == ENDPOINT_SOURCE || projString.endpoint == ENDPOINT_TARGET); + + err = grib_get_string(h, projString.grid_type, grid_type, &size); + if (err) return err; + + proj_func func{}; + err = get_proj_func(grid_type, func); + if(err == GRIB_SUCCESS) + { + if (projString.endpoint == ENDPOINT_SOURCE) { + snprintf(v, 64, "EPSG:4326"); + } + else { + // Invoke the appropriate function to get the target proj string + if ((err = func(h, v)) != GRIB_SUCCESS) return err; + } + } + else if(err == GRIB_NOT_FOUND) + { + *len = 0; + return GRIB_NOT_FOUND; + } + else return err; + + size = strlen(v); + Assert(size > 0); + *len = size + 1; + return err; +} + +static AccessorMaker projStringMaker("proj_string", AccessorType{}); + +} diff --git a/src/grib_accessor_impl/ProjString.h b/src/grib_accessor_impl/ProjString.h new file mode 100644 index 000000000..bc52f51e2 --- /dev/null +++ b/src/grib_accessor_impl/ProjString.h @@ -0,0 +1,21 @@ +#ifndef _PROJ_STRING_H_20230705_ +#define _PROJ_STRING_H_20230705_ + +#include "Generic.h" + +namespace eccodes { + +struct ProjString : public Generic +{ + const char* grid_type{}; + int endpoint{}; + + ProjString(grib_section* p, grib_action* creator, const long len, grib_arguments* arg); + virtual ~ProjString(); +}; + +int nativeType(ProjString& projString); +int unpackString(ProjString& projString, char* v, size_t* len); + +} +#endif // _PROJ_STRING_H_20230705_ diff --git a/src/grib_accessor_impl_v1/CMakeLists.txt b/src/grib_accessor_impl_v1/CMakeLists.txt new file mode 100644 index 000000000..29e233211 --- /dev/null +++ b/src/grib_accessor_impl_v1/CMakeLists.txt @@ -0,0 +1,28 @@ +# +# (C) Copyright 2005- ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# In applying this licence, ECMWF does not waive the privileges and immunities +# granted to it by virtue of its status as an intergovernmental organisation +# nor does it submit to any jurisdiction. +# + +# Define all the source files to build for the C++ accessors +# Note the PARENT_SCOPE option sets the variable in the calling CMakeLists.txt +# file - it remains undefined in this file: https://cmake.org/cmake/help/latest/command/set.html +set(eccodes_grib_accessor_impl_src_files + ${CMAKE_CURRENT_LIST_DIR}/ga_impl_creators.cpp + ${CMAKE_CURRENT_LIST_DIR}/grib_accessor_impl.h + ${CMAKE_CURRENT_LIST_DIR}/grib_accessor_impl_abstract_long_vector.cpp + ${CMAKE_CURRENT_LIST_DIR}/grib_accessor_impl_factory.cpp + ${CMAKE_CURRENT_LIST_DIR}/grib_accessor_impl_g1step_range.cpp + ${CMAKE_CURRENT_LIST_DIR}/grib_accessor_impl_gen.cpp + ${CMAKE_CURRENT_LIST_DIR}/grib_accessor_impl_helper.cpp + ${CMAKE_CURRENT_LIST_DIR}/grib_accessor_impl_proj_string.cpp + ${CMAKE_CURRENT_LIST_DIR}/grib_cpp_utils.cpp + ${CMAKE_CURRENT_LIST_DIR}/pack_buffer.cpp + ${CMAKE_CURRENT_LIST_DIR}/proj_string_helper.cpp + PARENT_SCOPE +) diff --git a/src/grib_accessor_impl/ga_impl_creator_targets.h b/src/grib_accessor_impl_v1/ga_impl_creator_targets.h similarity index 100% rename from src/grib_accessor_impl/ga_impl_creator_targets.h rename to src/grib_accessor_impl_v1/ga_impl_creator_targets.h diff --git a/src/grib_accessor_impl/ga_impl_creators.cpp b/src/grib_accessor_impl_v1/ga_impl_creators.cpp similarity index 100% rename from src/grib_accessor_impl/ga_impl_creators.cpp rename to src/grib_accessor_impl_v1/ga_impl_creators.cpp diff --git a/src/grib_accessor_impl/ga_impl_creators.h b/src/grib_accessor_impl_v1/ga_impl_creators.h similarity index 100% rename from src/grib_accessor_impl/ga_impl_creators.h rename to src/grib_accessor_impl_v1/ga_impl_creators.h diff --git a/src/grib_accessor_impl/grib_accessor_impl.h b/src/grib_accessor_impl_v1/grib_accessor_impl.h similarity index 100% rename from src/grib_accessor_impl/grib_accessor_impl.h rename to src/grib_accessor_impl_v1/grib_accessor_impl.h diff --git a/src/grib_accessor_impl/grib_accessor_impl_abstract_long_vector.cpp b/src/grib_accessor_impl_v1/grib_accessor_impl_abstract_long_vector.cpp similarity index 100% rename from src/grib_accessor_impl/grib_accessor_impl_abstract_long_vector.cpp rename to src/grib_accessor_impl_v1/grib_accessor_impl_abstract_long_vector.cpp diff --git a/src/grib_accessor_impl/grib_accessor_impl_abstract_long_vector.h b/src/grib_accessor_impl_v1/grib_accessor_impl_abstract_long_vector.h similarity index 100% rename from src/grib_accessor_impl/grib_accessor_impl_abstract_long_vector.h rename to src/grib_accessor_impl_v1/grib_accessor_impl_abstract_long_vector.h diff --git a/src/grib_accessor_impl/grib_accessor_impl_factory.cpp b/src/grib_accessor_impl_v1/grib_accessor_impl_factory.cpp similarity index 100% rename from src/grib_accessor_impl/grib_accessor_impl_factory.cpp rename to src/grib_accessor_impl_v1/grib_accessor_impl_factory.cpp diff --git a/src/grib_accessor_impl/grib_accessor_impl_factory.h b/src/grib_accessor_impl_v1/grib_accessor_impl_factory.h similarity index 100% rename from src/grib_accessor_impl/grib_accessor_impl_factory.h rename to src/grib_accessor_impl_v1/grib_accessor_impl_factory.h diff --git a/src/grib_accessor_impl/grib_accessor_impl_g1step_range.cpp b/src/grib_accessor_impl_v1/grib_accessor_impl_g1step_range.cpp similarity index 100% rename from src/grib_accessor_impl/grib_accessor_impl_g1step_range.cpp rename to src/grib_accessor_impl_v1/grib_accessor_impl_g1step_range.cpp diff --git a/src/grib_accessor_impl/grib_accessor_impl_g1step_range.h b/src/grib_accessor_impl_v1/grib_accessor_impl_g1step_range.h similarity index 100% rename from src/grib_accessor_impl/grib_accessor_impl_g1step_range.h rename to src/grib_accessor_impl_v1/grib_accessor_impl_g1step_range.h diff --git a/src/grib_accessor_impl/grib_accessor_impl_gen.cpp b/src/grib_accessor_impl_v1/grib_accessor_impl_gen.cpp similarity index 100% rename from src/grib_accessor_impl/grib_accessor_impl_gen.cpp rename to src/grib_accessor_impl_v1/grib_accessor_impl_gen.cpp diff --git a/src/grib_accessor_impl/grib_accessor_impl_gen.h b/src/grib_accessor_impl_v1/grib_accessor_impl_gen.h similarity index 100% rename from src/grib_accessor_impl/grib_accessor_impl_gen.h rename to src/grib_accessor_impl_v1/grib_accessor_impl_gen.h diff --git a/src/grib_accessor_impl/grib_accessor_impl_helper.cpp b/src/grib_accessor_impl_v1/grib_accessor_impl_helper.cpp similarity index 100% rename from src/grib_accessor_impl/grib_accessor_impl_helper.cpp rename to src/grib_accessor_impl_v1/grib_accessor_impl_helper.cpp diff --git a/src/grib_accessor_impl/grib_accessor_impl_helper.h b/src/grib_accessor_impl_v1/grib_accessor_impl_helper.h similarity index 100% rename from src/grib_accessor_impl/grib_accessor_impl_helper.h rename to src/grib_accessor_impl_v1/grib_accessor_impl_helper.h diff --git a/src/grib_accessor_impl/grib_accessor_impl_proj_string.cpp b/src/grib_accessor_impl_v1/grib_accessor_impl_proj_string.cpp similarity index 100% rename from src/grib_accessor_impl/grib_accessor_impl_proj_string.cpp rename to src/grib_accessor_impl_v1/grib_accessor_impl_proj_string.cpp diff --git a/src/grib_accessor_impl/grib_accessor_impl_proj_string.h b/src/grib_accessor_impl_v1/grib_accessor_impl_proj_string.h similarity index 100% rename from src/grib_accessor_impl/grib_accessor_impl_proj_string.h rename to src/grib_accessor_impl_v1/grib_accessor_impl_proj_string.h diff --git a/src/grib_accessor_impl/grib_cpp_utils.cpp b/src/grib_accessor_impl_v1/grib_cpp_utils.cpp similarity index 100% rename from src/grib_accessor_impl/grib_cpp_utils.cpp rename to src/grib_accessor_impl_v1/grib_cpp_utils.cpp diff --git a/src/grib_accessor_impl/grib_cpp_utils.h b/src/grib_accessor_impl_v1/grib_cpp_utils.h similarity index 100% rename from src/grib_accessor_impl/grib_cpp_utils.h rename to src/grib_accessor_impl_v1/grib_cpp_utils.h diff --git a/src/grib_accessor_impl_v1/pack_buffer.cpp b/src/grib_accessor_impl_v1/pack_buffer.cpp new file mode 100644 index 000000000..5d764b6d3 --- /dev/null +++ b/src/grib_accessor_impl_v1/pack_buffer.cpp @@ -0,0 +1,264 @@ +#include "pack_buffer.h" +#include + +#include "grib_api_internal.h" + +namespace eccodes { + + // is_variant_member + // + // This template allows us to check if the type of IN_PTR and OUT_PTR + // used below are valid. This is done by checking if the type has been + // defined as part of the appropriate std::variant + template + struct is_one_of : std::false_type {}; + + template + struct is_one_of : std::is_same {}; + + template + struct is_one_of : std::bool_constant::value || is_one_of::value> {}; + + template + struct is_variant_member; + + template + struct is_variant_member> : is_one_of {}; + + template + int init_view(OUT_VIEW& out_view, std::size_t out_buffer_size_bytes, grib_context *c) + { + static_assert(is_variant_member::value, + "OUT_VIEW must be one of the types defined in const_view_type"); + + Assert(!out_view.ptr); + + using out_type = typename OUT_VIEW::type; + + if(out_view.ptr = (out_type*)grib_context_malloc(c, out_buffer_size_bytes); !out_view.ptr) + { + grib_context_log(c, GRIB_LOG_ERROR, "Unable to allocate %ld bytes\n", out_buffer_size_bytes); + return GRIB_OUT_OF_MEMORY; + } + + std::size_t len_buffer_size_bytes = sizeof(std::size_t); + if(out_view.len = (std::size_t*)grib_context_malloc(c, len_buffer_size_bytes); !out_view.len) + { + grib_context_log(c, GRIB_LOG_ERROR, "Unable to allocate %ld bytes\n", len_buffer_size_bytes); + grib_context_free(c, out_view.ptr); + return GRIB_OUT_OF_MEMORY; + } + + return GRIB_SUCCESS; + } + + // Helper function to take the input pointer and transform it to a buffer of the desired type + // + // IN_VIEW is the active type_view held by pack_buffer::in_view, as passed into std::visit() + // OUT_VIEW is the type_view to write the results to, e.g. double_buffer_view for the doubles member + // + // Returns a GRIB status code + template + int transform(IN_VIEW const& in_view, OUT_VIEW& out_view, grib_context *c) + { + static_assert(is_variant_member::value, + "IN_VIEW must be one of the types defined in const_view_type"); + + static_assert(is_variant_member::value, + "OUT_VIEW must be one of the types defined in const_view_type"); + + Assert(in_view.ptr && !out_view.ptr); + using out_type = typename OUT_VIEW::type; + std::size_t out_buffer_size_bytes = *in_view.len * sizeof(out_type); + + if(int ret = init_view(out_view, out_buffer_size_bytes, c); ret != GRIB_SUCCESS) { return ret;} + + for(std::size_t index = 0; index < *in_view.len; ++index) + { + out_view.ptr[index] = static_cast(in_view.ptr[index]); + } + + *out_view.len = *in_view.len; + + return GRIB_SUCCESS; + } + + // transform() overload for string to double + // Note: we don't specialise the template: https://www.modernescpp.com/index.php/full-specialization-of-function-templates + int transform(const_char_view const& in_view, double_view& out_view, grib_context *c) + { + Assert(in_view.ptr && !out_view.ptr); + + std::size_t dlen = 1; + std::size_t out_buffer_size_bytes = dlen*sizeof(double); + + if(int ret = init_view(out_view, out_buffer_size_bytes, c); ret != GRIB_SUCCESS) { return ret;} + + char* endPtr = NULL; /* for error handling */ + *out_view.ptr = strtod(in_view.ptr, &endPtr); + if (*endPtr) { +// TODO - We don't have the accessor's name here +// grib_context_log(c, GRIB_LOG_ERROR, +// "pack_string: Invalid value (%s) for %s. String cannot be converted to a double", +// v, a->name); + grib_context_log(c, GRIB_LOG_ERROR, + "pack_string: Invalid value (%s). String cannot be converted to a double", + *in_view.ptr); + return GRIB_WRONG_TYPE; + } + *out_view.len = dlen; + + return GRIB_SUCCESS; + } + + // transform() overload for string to long + // Note: we don't specialise the template: https://www.modernescpp.com/index.php/full-specialization-of-function-templates + int transform(const_char_view const& in_view, long_view& out_view, grib_context *c) + { + Assert(in_view.ptr && !out_view.ptr); + + std::size_t llen = 1; + std::size_t out_buffer_size_bytes = llen*sizeof(long); + + if(int ret = init_view(out_view, out_buffer_size_bytes, c); ret != GRIB_SUCCESS) { return ret;} + + *out_view.ptr = atol(in_view.ptr); + *out_view.len = llen; + + return GRIB_SUCCESS; + } + + // std::visit helper (with deduction guide as we're compiling as C++17) + template struct overload : Ts... { using Ts::operator()...; }; + template overload(Ts...) -> overload; + + pack_buffer::pack_buffer(grib_context *context_ptr, const_view_type input_view) : + context{context_ptr}, in_view{input_view} + { + // Check that in_value_type is not a nullptr + bool valid_input_values_ptr = std::visit( + overload{ + [](const_byte_view cbv) { return cbv.ptr!=nullptr; }, + [](const_double_view cdv) { return cdv.ptr!=nullptr; }, + [](const_float_view cfv) { return cfv.ptr!=nullptr; }, + [](const_long_view clv) { return clv.ptr!=nullptr; }, + [](const_char_view ccv) { return ccv.ptr!=nullptr; }, + }, + in_view + ); + Assert(valid_input_values_ptr); + } + + pack_buffer::~pack_buffer() + { + if(bytes.ptr) { grib_context_free(context, bytes.ptr); } + if(bytes.len) { grib_context_free(context, bytes.len); } + if(doubles.ptr) { grib_context_free(context, doubles.ptr); } + if(doubles.len) { grib_context_free(context, doubles.len); } + if(floats.ptr) { grib_context_free(context, floats.ptr); } + if(floats.len) { grib_context_free(context, floats.len); } + if(longs.ptr) { grib_context_free(context, longs.ptr); } + if(longs.len) { grib_context_free(context, longs.len); } + if(chars.ptr) { grib_context_free(context, chars.ptr); } + if(chars.len) { grib_context_free(context, chars.len); } + } + + const_byte_view pack_buffer::to_bytes() + { + if(!bytes.ptr) { + status = std::visit( + overload{ + [](const_byte_view cbv) { return GRIB_NOT_IMPLEMENTED; }, + [](const_double_view cdv) { return GRIB_NOT_IMPLEMENTED; }, + [](const_float_view cfv) { return GRIB_NOT_IMPLEMENTED; }, + [](const_long_view clv) { return GRIB_NOT_IMPLEMENTED; }, + [](const_char_view ccv) { return GRIB_NOT_IMPLEMENTED; }, + }, + in_view + ); + } + + return const_byte_view{bytes.ptr, bytes.len}; + } + + const_double_view pack_buffer::to_doubles() + { + if(std::holds_alternative(in_view)) { return std::get(in_view); } + + if(!doubles.ptr) { + status = std::visit( + overload{ + [](const_byte_view cbv) { return GRIB_NOT_IMPLEMENTED; }, + [](const_double_view cdv) { Assert(false); return GRIB_INTERNAL_ERROR; }, + [](const_float_view cfv) { return GRIB_NOT_IMPLEMENTED; }, + [this](const_long_view clv) { return transform(clv, doubles, context); }, + [this](const_char_view ccv) { return transform(ccv, doubles, context); }, + }, + in_view + ); + } + + return const_double_view{doubles.ptr, doubles.len}; + } + + const_float_view pack_buffer::to_floats() + { + if(std::holds_alternative(in_view)) { return std::get(in_view); } + + if(!floats.ptr) { + status = std::visit( + overload{ + [](const_byte_view cbv) { return GRIB_NOT_IMPLEMENTED; }, + [](const_double_view cdv) { return GRIB_NOT_IMPLEMENTED; }, + [](const_float_view cfv) { Assert(false); return GRIB_INTERNAL_ERROR; }, + [this](const_long_view clv) { return transform(clv, floats, context); }, + [](const_char_view ccv) { return GRIB_NOT_IMPLEMENTED; }, + }, + in_view + ); + } + + return const_float_view{floats.ptr, floats.len}; + } + + const_long_view pack_buffer::to_longs() + { + if(std::holds_alternative(in_view)) { return std::get(in_view); } + + if(!longs.ptr) { + status = std::visit( + overload{ + [](const_byte_view cbv) { return GRIB_NOT_IMPLEMENTED; }, + [this](const_double_view cdv) { return transform(cdv, longs, context); }, + [](const_float_view cfv) { return GRIB_NOT_IMPLEMENTED; }, + [](const_long_view clv) { Assert(false); return GRIB_INTERNAL_ERROR; }, + [this](const_char_view ccv) { return transform(ccv, longs, context); }, + }, + in_view + ); + } + + return const_long_view{longs.ptr, longs.len}; + } + + const_char_view pack_buffer::to_string() + { + if(std::holds_alternative(in_view)) { return std::get(in_view); } + + if(!chars.ptr) { + status = std::visit( + overload{ + [](const_byte_view cbv) { return GRIB_NOT_IMPLEMENTED; }, + [this](const_double_view cdv) { return GRIB_NOT_IMPLEMENTED; }, + [](const_float_view cfv) { return GRIB_NOT_IMPLEMENTED; }, + [this](const_long_view clv) { return GRIB_NOT_IMPLEMENTED; }, + [](const_char_view ccv) { Assert(false); return GRIB_INTERNAL_ERROR; }, + }, + in_view + ); + } + + return const_char_view{chars.ptr, chars.len}; + } + +} diff --git a/src/grib_accessor_impl_v1/pack_buffer.h b/src/grib_accessor_impl_v1/pack_buffer.h new file mode 100644 index 000000000..ab4f6b12d --- /dev/null +++ b/src/grib_accessor_impl_v1/pack_buffer.h @@ -0,0 +1,41 @@ +#ifndef _PACK_BUFFER_H_20230613_ +#define _PACK_BUFFER_H_20230613_ + +#include "type_view.h" +#include +#include + +struct grib_context; + +namespace eccodes { + + using const_view_type = std::variant; + using view_type = std::variant; + + class pack_buffer{ + grib_context *context; // To give us access to the Grib memory functions + const_view_type in_view; + int status{}; // Default value 0 = GRIB_SUCCESS; + + byte_view bytes{}; + double_view doubles{}; + float_view floats{}; + long_view longs{}; + char_view chars{}; + + public: + pack_buffer(grib_context *context_ptr, const_view_type input_view); + ~pack_buffer(); + + const_view_type input_view() const { return in_view; } + int current_status() const { return status; } + + const_byte_view to_bytes(); + const_double_view to_doubles(); + const_float_view to_floats(); + const_long_view to_longs(); + const_char_view to_string(); + }; + } + +#endif // _PACK_BUFFER_H_20230613_ diff --git a/src/grib_accessor_impl_v1/proj_string_helper.cpp b/src/grib_accessor_impl_v1/proj_string_helper.cpp new file mode 100644 index 000000000..698fc83bf --- /dev/null +++ b/src/grib_accessor_impl_v1/proj_string_helper.cpp @@ -0,0 +1,198 @@ +#include "proj_string_helper.h" +#include "grib_api_internal.h" + +#include +#include +#include + +namespace eccodes { + + // This should only be called for GRID POINT data (not spherical harmonics etc) + static int get_major_minor_axes(grib_handle* h, double* pMajor, double* pMinor) + { + int err = 0; + if (grib_is_earth_oblate(h)) { + if ((err = grib_get_double_internal(h, "earthMinorAxisInMetres", pMinor)) != GRIB_SUCCESS) return err; + if ((err = grib_get_double_internal(h, "earthMajorAxisInMetres", pMajor)) != GRIB_SUCCESS) return err; + } + else { + double radius = 0; + if ((err = grib_get_double_internal(h, "radius", &radius)) != GRIB_SUCCESS) return err; + *pMajor = *pMinor = radius; + } + return err; + } + + // Caller must have allocated enough space in the 'result' argument + static int get_earth_shape(grib_handle* h, char* result) + { + int err = 0; + double major = 0, minor = 0; + if ((err = get_major_minor_axes(h, &major, &minor)) != GRIB_SUCCESS) + return err; + if (major == minor) + snprintf(result, 128, "+R=%lf", major); // spherical + else + snprintf(result, 128, "+a=%lf +b=%lf", major, minor); // oblate + return err; + } + + static int proj_space_view(grib_handle* h, char* result) + { + return GRIB_NOT_IMPLEMENTED; + #if 0 + int err = 0; + char shape[64] = {0,}; + double latOfSubSatellitePointInDegrees, lonOfSubSatellitePointInDegrees; + + if ((err = get_earth_shape(h, shape)) != GRIB_SUCCESS) + return err; + + if ((err = grib_get_double_internal(h, "longitudeOfSubSatellitePointInDegrees", &lonOfSubSatellitePointInDegrees)) != GRIB_SUCCESS) + return err; + + snprintf(result, 526, "+proj=geos +lon_0=%lf +h=35785831 +x_0=0 +y_0=0 %s", lonOfSubSatellitePointInDegrees, shape); + return err; + + /* Experimental: For now do the same as gdalsrsinfo - hard coded values! */ + snprintf(result, 526, "+proj=geos +lon_0=0 +h=35785831 +x_0=0 +y_0=0 %s", shape); + return err; + #endif + } + + static int proj_albers(grib_handle* h, char* result) + { + return GRIB_NOT_IMPLEMENTED; + } + static int proj_transverse_mercator(grib_handle* h, char* result) + { + return GRIB_NOT_IMPLEMENTED; + } + static int proj_equatorial_azimuthal_equidistant(grib_handle* h, char* result) + { + return GRIB_NOT_IMPLEMENTED; + } + + static int proj_lambert_conformal(grib_handle* h, char* result) + { + int err = 0; + char shape[64] = {0,}; + double LoVInDegrees = 0, LaDInDegrees = 0, Latin1InDegrees = 0, Latin2InDegrees = 0; + + if ((err = get_earth_shape(h, shape)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_double_internal(h, "Latin1InDegrees", &Latin1InDegrees)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_double_internal(h, "Latin2InDegrees", &Latin2InDegrees)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_double_internal(h, "LoVInDegrees", &LoVInDegrees)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_double_internal(h, "LaDInDegrees", &LaDInDegrees)) != GRIB_SUCCESS) + return err; + snprintf(result, 1024, "+proj=lcc +lon_0=%lf +lat_0=%lf +lat_1=%lf +lat_2=%lf %s", + LoVInDegrees, LaDInDegrees, Latin1InDegrees, Latin2InDegrees, shape); + return err; + } + + static int proj_lambert_azimuthal_equal_area(grib_handle* h, char* result) + { + int err = 0; + char shape[64] = {0,}; + double standardParallel = 0, centralLongitude = 0; + + if ((err = get_earth_shape(h, shape)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_double_internal(h, "standardParallelInDegrees", &standardParallel)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_double_internal(h, "centralLongitudeInDegrees", ¢ralLongitude)) != GRIB_SUCCESS) + return err; + snprintf(result, 1024, "+proj=laea +lon_0=%lf +lat_0=%lf %s", + centralLongitude, standardParallel, shape); + return err; + } + + static int proj_polar_stereographic(grib_handle* h, char* result) + { + int err = 0; + double centralLongitude = 0, centralLatitude = 0; + int has_northPole = 0; + long projectionCentreFlag = 0; + char shape[64] = {0,}; + + if ((err = get_earth_shape(h, shape)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_double_internal(h, "orientationOfTheGridInDegrees", ¢ralLongitude)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_double_internal(h, "LaDInDegrees", ¢ralLatitude)) != GRIB_SUCCESS) + return err; + if ((err = grib_get_long_internal(h, "projectionCentreFlag", &projectionCentreFlag)) != GRIB_SUCCESS) + return err; + has_northPole = ((projectionCentreFlag & 128) == 0); + snprintf(result, 1024, "+proj=stere +lat_ts=%lf +lat_0=%s +lon_0=%lf +k_0=1 +x_0=0 +y_0=0 %s", + centralLatitude, has_northPole ? "90" : "-90", centralLongitude, shape); + return err; + } + + // ECC-1552: This is for regular_ll, regular_gg, reduced_ll, reduced_gg + // These are not 'projected' grids! + static int proj_unprojected(grib_handle* h, char* result) + { + int err = 0; + //char shape[64] = {0,}; + //if ((err = get_earth_shape(h, shape)) != GRIB_SUCCESS) return err; + //snprintf(result, 1024, "+proj=longlat %s", shape); + snprintf(result, 1024, "+proj=longlat +datum=WGS84 +no_defs +type=crs"); + + return err; + } + + static int proj_mercator(grib_handle* h, char* result) + { + int err = 0; + double LaDInDegrees = 0; + char shape[64] = {0,}; + + if ((err = grib_get_double_internal(h, "LaDInDegrees", &LaDInDegrees)) != GRIB_SUCCESS) + return err; + if ((err = get_earth_shape(h, shape)) != GRIB_SUCCESS) + return err; + snprintf(result, 1024, "+proj=merc +lat_ts=%lf +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 %s", + LaDInDegrees, shape); + return err; + } + + struct proj_mapping + { + const char* gridType; // key gridType + proj_func func; // function to compute proj string + }; + typedef struct proj_mapping proj_mapping; + + static std::array proj_mappings = { + proj_mapping{ "regular_ll", &proj_unprojected }, + proj_mapping{ "regular_gg", &proj_unprojected }, + proj_mapping{ "reduced_ll", &proj_unprojected }, + proj_mapping{ "reduced_gg", &proj_unprojected }, + proj_mapping{ "mercator", &proj_mercator }, + proj_mapping{ "lambert", &proj_lambert_conformal }, + proj_mapping{ "polar_stereographic", &proj_polar_stereographic }, + proj_mapping{ "lambert_azimuthal_equal_area", &proj_lambert_azimuthal_equal_area }, + proj_mapping{ "space_view", &proj_space_view }, + proj_mapping{ "albers", &proj_albers }, + proj_mapping{ "transverse_mercator", &proj_transverse_mercator }, + proj_mapping{ "equatorial_azimuthal_equidistant", &proj_equatorial_azimuthal_equidistant }, + }; + + int get_proj_func(const char* grid_type, proj_func &func) + { + if(auto it = std::find_if(std::begin(proj_mappings), std::end(proj_mappings), + [grid_type](const proj_mapping& pm){ return strcmp(grid_type, pm.gridType) == 0; }); + it != proj_mappings.end()) { + func = it->func; + return GRIB_SUCCESS; + } + + return GRIB_NOT_FOUND; + } + +} diff --git a/src/grib_accessor_impl_v1/proj_string_helper.h b/src/grib_accessor_impl_v1/proj_string_helper.h new file mode 100644 index 000000000..2119c9c8a --- /dev/null +++ b/src/grib_accessor_impl_v1/proj_string_helper.h @@ -0,0 +1,14 @@ +#ifndef _PROJ_STRING_HELPER_H_20230620_ +#define _PROJ_STRING_HELPER_H_20230620_ + +struct grib_handle; + +namespace eccodes { + + // Function pointer than takes a handle and returns the proj string + typedef int (*proj_func)(grib_handle*, char*); + + int get_proj_func(const char* grid_type, proj_func &func); +} + +#endif // _PROJ_STRING_HELPER_H_20230620_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_class_list.sh b/src/grib_accessor_impl_v1/templates/grib_accessor_class_list.sh new file mode 100755 index 000000000..469ccbfb5 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_class_list.sh @@ -0,0 +1,434 @@ +#!/bin/sh +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_abstract_vector.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_apply_operators.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_array.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_ascii.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_assert.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_bit.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_bitmap.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_bits.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_bits_per_value.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_blob.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_box.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_budgdate.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_bufr_data_array.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_bufr_data_element.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_bufr_elements_table.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_bufr_extract_area_subsets.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_bufr_extract_datetime_subsets.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_bufr_extract_subsets.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_bufr_group.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_bufr_simple_thinning.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_bufr_string_values.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_bufrdc_expanded_descriptors.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_bytes.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_change_alternative_row_scanning.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_change_scanning_direction.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_check_internal_version.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_closest_date.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_codeflag.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_codetable.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_codetable_title.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_codetable_units.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_concept.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_constant.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_count_file.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_count_missing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_count_total.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_2order_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_apply_bitmap.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_apply_boustrophedonic.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_apply_boustrophedonic_bitmap.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_apply_gdsnotpresent.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_ccsds_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_complex_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_dummy_field.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_g1complex_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_g1second_order_constant_width_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_g1second_order_general_extended_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_g1second_order_general_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_g1second_order_row_by_row_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_g1secondary_bitmap.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_g1shsimple_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_g1simple_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_g22order_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_g2bifourier_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_g2complex_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_g2secondary_bitmap.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_g2shsimple_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_g2simple_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_g2simple_packing_with_preprocessing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_jpeg2000_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_png_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_raw_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_run_length_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_secondary_bitmap.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_sh_packed.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_sh_unpacked.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_shsimple_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_simple_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_decimal_precision.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_dictionary.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_dirty.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_divdouble.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_double.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_element.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_evaluate.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_expanded_descriptors.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_forward.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_from_scale_factor_scaled_value.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g1_half_byte_codeflag.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g1_message_length.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g1_section4_length.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g1area.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g1bitmap.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g1date.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g1day_of_the_year_date.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g1end_of_interval_monthly.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g1fcperiod.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g1forecastmonth.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g1monthlydate.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g1number_of_coded_values_sh_complex.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g1number_of_coded_values_sh_simple.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g1verificationdate.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g2_aerosol.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g2_chemical.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g2_eps.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g2_mars_labeling.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g2bitmap.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g2bitmap_present.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g2date.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g2end_step.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g2grid.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g2latlon.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g2level.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g2lon.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g2step_range.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_gaussian_grid_name.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_gds_is_present.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_gds_not_present_bitmap.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_getenv.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_global_gaussian.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_group.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_gts_header.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_hash_array.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_headers_only.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_ibmfloat.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_ieeefloat.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_ifs_param.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_int16.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_int16_little_endian.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_int32.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_int32_little_endian.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_int64.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_int64_little_endian.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_int8.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_iterator.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_julian_date.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_julian_day.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_ksec1expver.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_label.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_laplacian.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_latitudes.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_latlon_increment.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_latlonvalues.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_library_version.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_local_definition.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_long.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_long_vector.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_longitudes.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_lookup.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_mars_param.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_mars_step.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_md5.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_message.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_message_copy.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_missing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_nearest.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_non_alpha.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_number_of_coded_values.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_number_of_points.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_number_of_points_gaussian.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_number_of_values.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_number_of_values_data_raw_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_octahedral_gaussian.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_octet_number.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_offset_file.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_offset_values.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_pack_bufr_values.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_pad.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_padding.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_padto.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_padtoeven.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_padtomultiple.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_position.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_raw.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_rdbtime_guess_date.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_reference_value_error.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_round.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_scale.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_scale_values.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_second_order_bits_per_value.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_section.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_section_length.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_section_padding.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_section_pointer.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_select_step_template.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_sexagesimal2decimal.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_signed.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_signed_bits.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_simple_packing_error.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_size.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_smart_table.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_smart_table_column.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_spd.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_spectral_truncation.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_sprintf.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_statistics.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_statistics_spectral.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_step_human_readable.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_step_in_units.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_sum.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_suppressed.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_time.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_times.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_to_double.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_to_integer.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_to_string.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_transient.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_transient_darray.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_trim.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_uint16.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_uint16_little_endian.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_uint32.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_uint32_little_endian.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_uint64.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_uint64_little_endian.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_uint8.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_unexpanded_descriptors.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_unpack_bufr_values.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_unsigned.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_unsigned_bits.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_validity_date.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_validity_time.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_values.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_variable.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_vector.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_when.h + +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_abstract_vector.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_apply_operators.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_array.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_ascii.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_assert.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_bit.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_bitmap.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_bits.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_bits_per_value.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_blob.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_box.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_budgdate.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_bufr_data_array.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_bufr_data_element.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_bufr_elements_table.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_bufr_extract_area_subsets.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_bufr_extract_datetime_subsets.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_bufr_extract_subsets.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_bufr_group.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_bufr_simple_thinning.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_bufr_string_values.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_bufrdc_expanded_descriptors.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_bytes.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_change_alternative_row_scanning.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_change_scanning_direction.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_check_internal_version.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_closest_date.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_codeflag.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_codetable.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_codetable_title.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_codetable_units.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_concept.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_constant.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_count_file.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_count_missing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_count_total.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_2order_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_apply_bitmap.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_apply_boustrophedonic.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_apply_boustrophedonic_bitmap.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_apply_gdsnotpresent.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_ccsds_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_complex_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_dummy_field.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_g1complex_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_g1second_order_constant_width_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_g1second_order_general_extended_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_g1second_order_general_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_g1second_order_row_by_row_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_g1secondary_bitmap.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_g1shsimple_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_g1simple_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_g22order_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_g2bifourier_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_g2complex_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_g2secondary_bitmap.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_g2shsimple_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_g2simple_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_g2simple_packing_with_preprocessing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_jpeg2000_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_png_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_raw_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_run_length_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_secondary_bitmap.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_sh_packed.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_sh_unpacked.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_shsimple_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_simple_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_decimal_precision.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_dictionary.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_dirty.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_divdouble.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_double.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_element.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_evaluate.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_expanded_descriptors.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_forward.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_from_scale_factor_scaled_value.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g1_half_byte_codeflag.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g1_message_length.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g1_section4_length.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g1area.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g1bitmap.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g1date.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g1day_of_the_year_date.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g1end_of_interval_monthly.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g1fcperiod.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g1forecastmonth.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g1monthlydate.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g1number_of_coded_values_sh_complex.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g1number_of_coded_values_sh_simple.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g1verificationdate.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g2_aerosol.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g2_chemical.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g2_eps.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g2_mars_labeling.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g2bitmap.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g2bitmap_present.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g2date.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g2end_step.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g2grid.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g2latlon.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g2level.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g2lon.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g2step_range.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_gaussian_grid_name.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_gds_is_present.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_gds_not_present_bitmap.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_getenv.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_global_gaussian.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_group.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_gts_header.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_hash_array.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_headers_only.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_ibmfloat.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_ieeefloat.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_ifs_param.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_int16.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_int16_little_endian.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_int32.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_int32_little_endian.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_int64.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_int64_little_endian.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_int8.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_iterator.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_julian_date.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_julian_day.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_ksec1expver.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_label.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_laplacian.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_latitudes.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_latlon_increment.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_latlonvalues.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_library_version.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_local_definition.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_long.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_long_vector.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_longitudes.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_lookup.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_mars_param.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_mars_step.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_md5.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_message.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_message_copy.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_missing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_nearest.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_non_alpha.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_number_of_coded_values.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_number_of_points.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_number_of_points_gaussian.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_number_of_values.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_number_of_values_data_raw_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_octahedral_gaussian.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_octet_number.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_offset_file.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_offset_values.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_pack_bufr_values.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_pad.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_padding.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_padto.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_padtoeven.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_padtomultiple.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_position.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_raw.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_rdbtime_guess_date.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_reference_value_error.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_round.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_scale.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_scale_values.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_second_order_bits_per_value.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_section.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_section_length.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_section_padding.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_section_pointer.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_select_step_template.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_sexagesimal2decimal.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_signed.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_signed_bits.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_simple_packing_error.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_size.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_smart_table.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_smart_table_column.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_spd.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_spectral_truncation.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_sprintf.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_statistics.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_statistics_spectral.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_step_human_readable.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_step_in_units.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_sum.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_suppressed.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_time.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_times.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_to_double.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_to_integer.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_to_string.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_transient.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_transient_darray.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_trim.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_uint16.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_uint16_little_endian.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_uint32.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_uint32_little_endian.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_uint64.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_uint64_little_endian.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_uint8.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_unexpanded_descriptors.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_unpack_bufr_values.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_unsigned.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_unsigned_bits.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_validity_date.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_validity_time.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_values.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_variable.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_vector.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_when.cpp diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_class_list_FULL.sh b/src/grib_accessor_impl_v1/templates/grib_accessor_class_list_FULL.sh new file mode 100644 index 000000000..2b74942e1 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_class_list_FULL.sh @@ -0,0 +1,438 @@ +#!/bin/sh +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_abstract_long_vector.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_abstract_vector.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_apply_operators.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_array.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_ascii.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_assert.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_bit.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_bitmap.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_bits.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_bits_per_value.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_blob.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_box.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_budgdate.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_bufr_data_array.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_bufr_data_element.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_bufr_elements_table.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_bufr_extract_area_subsets.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_bufr_extract_datetime_subsets.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_bufr_extract_subsets.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_bufr_group.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_bufr_simple_thinning.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_bufr_string_values.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_bufrdc_expanded_descriptors.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_bytes.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_change_alternative_row_scanning.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_change_scanning_direction.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_check_internal_version.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_closest_date.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_codeflag.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_codetable.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_codetable_title.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_codetable_units.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_concept.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_constant.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_count_file.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_count_missing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_count_total.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_2order_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_apply_bitmap.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_apply_boustrophedonic.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_apply_boustrophedonic_bitmap.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_apply_gdsnotpresent.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_ccsds_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_complex_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_dummy_field.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_g1complex_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_g1second_order_constant_width_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_g1second_order_general_extended_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_g1second_order_general_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_g1second_order_row_by_row_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_g1secondary_bitmap.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_g1shsimple_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_g1simple_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_g22order_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_g2bifourier_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_g2complex_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_g2secondary_bitmap.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_g2shsimple_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_g2simple_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_g2simple_packing_with_preprocessing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_jpeg2000_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_png_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_raw_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_run_length_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_secondary_bitmap.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_sh_packed.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_sh_unpacked.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_shsimple_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_data_simple_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_decimal_precision.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_dictionary.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_dirty.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_divdouble.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_double.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_element.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_evaluate.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_expanded_descriptors.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_forward.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_from_scale_factor_scaled_value.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g1_half_byte_codeflag.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g1_message_length.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g1_section4_length.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g1area.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g1bitmap.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g1date.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g1day_of_the_year_date.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g1end_of_interval_monthly.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g1fcperiod.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g1forecastmonth.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g1monthlydate.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g1number_of_coded_values_sh_complex.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g1number_of_coded_values_sh_simple.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g1step_range.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g1verificationdate.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g2_aerosol.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g2_chemical.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g2_eps.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g2_mars_labeling.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g2bitmap.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g2bitmap_present.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g2date.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g2end_step.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g2grid.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g2latlon.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g2level.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g2lon.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_g2step_range.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_gaussian_grid_name.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_gds_is_present.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_gds_not_present_bitmap.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_getenv.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_global_gaussian.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_group.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_gts_header.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_hash_array.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_headers_only.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_ibmfloat.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_ieeefloat.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_ifs_param.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_int16.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_int16_little_endian.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_int32.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_int32_little_endian.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_int64.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_int64_little_endian.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_int8.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_iterator.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_julian_date.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_julian_day.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_ksec1expver.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_label.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_laplacian.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_latitudes.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_latlon_increment.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_latlonvalues.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_library_version.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_local_definition.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_long.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_long_vector.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_longitudes.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_lookup.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_mars_param.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_mars_step.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_md5.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_message.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_message_copy.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_missing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_nearest.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_non_alpha.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_number_of_coded_values.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_number_of_points.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_number_of_points_gaussian.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_number_of_values.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_number_of_values_data_raw_packing.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_octahedral_gaussian.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_octet_number.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_offset_file.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_offset_values.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_pack_bufr_values.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_pad.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_padding.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_padto.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_padtoeven.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_padtomultiple.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_position.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_raw.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_rdbtime_guess_date.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_reference_value_error.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_round.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_scale.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_scale_values.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_second_order_bits_per_value.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_section.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_section_length.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_section_padding.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_section_pointer.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_select_step_template.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_sexagesimal2decimal.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_signed.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_signed_bits.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_simple_packing_error.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_size.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_smart_table.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_smart_table_column.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_spd.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_spectral_truncation.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_sprintf.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_statistics.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_statistics_spectral.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_step_human_readable.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_step_in_units.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_sum.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_suppressed.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_time.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_times.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_to_double.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_to_integer.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_to_string.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_transient.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_transient_darray.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_trim.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_uint16.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_uint16_little_endian.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_uint32.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_uint32_little_endian.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_uint64.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_uint64_little_endian.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_uint8.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_unexpanded_descriptors.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_unpack_bufr_values.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_unsigned.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_unsigned_bits.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_validity_date.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_validity_time.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_values.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_variable.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_vector.h +cp grib_accessor_impl_TEMPLATE.h grib_accessor_impl_when.h + +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_abstract_long_vector.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_abstract_vector.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_apply_operators.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_array.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_ascii.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_assert.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_bit.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_bitmap.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_bits.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_bits_per_value.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_blob.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_box.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_budgdate.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_bufr_data_array.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_bufr_data_element.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_bufr_elements_table.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_bufr_extract_area_subsets.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_bufr_extract_datetime_subsets.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_bufr_extract_subsets.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_bufr_group.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_bufr_simple_thinning.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_bufr_string_values.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_bufrdc_expanded_descriptors.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_bytes.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_change_alternative_row_scanning.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_change_scanning_direction.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_check_internal_version.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_closest_date.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_codeflag.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_codetable.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_codetable_title.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_codetable_units.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_concept.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_constant.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_count_file.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_count_missing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_count_total.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_2order_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_apply_bitmap.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_apply_boustrophedonic.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_apply_boustrophedonic_bitmap.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_apply_gdsnotpresent.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_ccsds_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_complex_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_dummy_field.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_g1complex_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_g1second_order_constant_width_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_g1second_order_general_extended_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_g1second_order_general_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_g1second_order_row_by_row_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_g1secondary_bitmap.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_g1shsimple_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_g1simple_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_g22order_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_g2bifourier_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_g2complex_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_g2secondary_bitmap.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_g2shsimple_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_g2simple_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_g2simple_packing_with_preprocessing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_jpeg2000_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_png_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_raw_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_run_length_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_secondary_bitmap.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_sh_packed.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_sh_unpacked.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_shsimple_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_data_simple_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_decimal_precision.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_dictionary.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_dirty.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_divdouble.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_double.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_element.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_evaluate.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_expanded_descriptors.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_forward.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_from_scale_factor_scaled_value.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g1_half_byte_codeflag.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g1_message_length.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g1_section4_length.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g1area.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g1bitmap.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g1date.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g1day_of_the_year_date.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g1end_of_interval_monthly.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g1fcperiod.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g1forecastmonth.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g1monthlydate.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g1number_of_coded_values_sh_complex.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g1number_of_coded_values_sh_simple.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g1step_range.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g1verificationdate.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g2_aerosol.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g2_chemical.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g2_eps.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g2_mars_labeling.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g2bitmap.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g2bitmap_present.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g2date.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g2end_step.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g2grid.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g2latlon.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g2level.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g2lon.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_g2step_range.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_gaussian_grid_name.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_gds_is_present.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_gds_not_present_bitmap.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_getenv.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_global_gaussian.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_group.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_gts_header.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_hash_array.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_headers_only.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_ibmfloat.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_ieeefloat.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_ifs_param.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_int16.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_int16_little_endian.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_int32.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_int32_little_endian.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_int64.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_int64_little_endian.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_int8.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_iterator.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_julian_date.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_julian_day.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_ksec1expver.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_label.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_laplacian.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_latitudes.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_latlon_increment.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_latlonvalues.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_library_version.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_local_definition.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_long.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_long_vector.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_longitudes.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_lookup.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_mars_param.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_mars_step.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_md5.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_message.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_message_copy.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_missing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_nearest.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_non_alpha.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_number_of_coded_values.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_number_of_points.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_number_of_points_gaussian.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_number_of_values.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_number_of_values_data_raw_packing.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_octahedral_gaussian.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_octet_number.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_offset_file.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_offset_values.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_pack_bufr_values.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_pad.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_padding.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_padto.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_padtoeven.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_padtomultiple.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_position.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_raw.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_rdbtime_guess_date.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_reference_value_error.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_round.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_scale.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_scale_values.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_second_order_bits_per_value.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_section.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_section_length.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_section_padding.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_section_pointer.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_select_step_template.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_sexagesimal2decimal.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_signed.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_signed_bits.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_simple_packing_error.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_size.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_smart_table.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_smart_table_column.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_spd.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_spectral_truncation.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_sprintf.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_statistics.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_statistics_spectral.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_step_human_readable.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_step_in_units.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_sum.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_suppressed.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_time.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_times.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_to_double.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_to_integer.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_to_string.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_transient.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_transient_darray.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_trim.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_uint16.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_uint16_little_endian.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_uint32.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_uint32_little_endian.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_uint64.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_uint64_little_endian.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_uint8.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_unexpanded_descriptors.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_unpack_bufr_values.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_unsigned.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_unsigned_bits.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_validity_date.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_validity_time.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_values.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_variable.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_vector.cpp +cp grib_accessor_impl_TEMPLATE.cpp grib_accessor_impl_when.cpp diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_TEMPLATE.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_TEMPLATE.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_TEMPLATE.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_TEMPLATE.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_TEMPLATE.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_TEMPLATE.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_abstract_vector.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_abstract_vector.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_abstract_vector.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_abstract_vector.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_abstract_vector.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_abstract_vector.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_apply_operators.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_apply_operators.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_apply_operators.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_apply_operators.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_apply_operators.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_apply_operators.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_array.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_array.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_array.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_array.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_array.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_array.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_ascii.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_ascii.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_ascii.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_ascii.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_ascii.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_ascii.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_assert.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_assert.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_assert.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_assert.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_assert.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_assert.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bit.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bit.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bit.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bit.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bit.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bit.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bitmap.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bitmap.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bitmap.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bitmap.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bitmap.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bitmap.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bits.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bits.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bits.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bits.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bits.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bits.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bits_per_value.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bits_per_value.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bits_per_value.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bits_per_value.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bits_per_value.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bits_per_value.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_blob.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_blob.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_blob.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_blob.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_blob.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_blob.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_box.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_box.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_box.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_box.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_box.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_box.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_budgdate.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_budgdate.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_budgdate.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_budgdate.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_budgdate.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_budgdate.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_data_array.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_data_array.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_data_array.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_data_array.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_data_array.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_data_array.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_data_element.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_data_element.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_data_element.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_data_element.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_data_element.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_data_element.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_elements_table.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_elements_table.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_elements_table.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_elements_table.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_elements_table.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_elements_table.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_extract_area_subsets.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_extract_area_subsets.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_extract_area_subsets.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_extract_area_subsets.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_extract_area_subsets.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_extract_area_subsets.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_extract_datetime_subsets.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_extract_datetime_subsets.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_extract_datetime_subsets.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_extract_datetime_subsets.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_extract_datetime_subsets.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_extract_datetime_subsets.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_extract_subsets.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_extract_subsets.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_extract_subsets.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_extract_subsets.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_extract_subsets.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_extract_subsets.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_group.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_group.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_group.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_group.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_group.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_group.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_simple_thinning.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_simple_thinning.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_simple_thinning.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_simple_thinning.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_simple_thinning.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_simple_thinning.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_string_values.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_string_values.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_string_values.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_string_values.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_string_values.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufr_string_values.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufrdc_expanded_descriptors.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufrdc_expanded_descriptors.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufrdc_expanded_descriptors.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufrdc_expanded_descriptors.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufrdc_expanded_descriptors.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bufrdc_expanded_descriptors.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bytes.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bytes.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bytes.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bytes.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bytes.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_bytes.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_change_alternative_row_scanning.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_change_alternative_row_scanning.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_change_alternative_row_scanning.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_change_alternative_row_scanning.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_change_alternative_row_scanning.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_change_alternative_row_scanning.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_change_scanning_direction.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_change_scanning_direction.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_change_scanning_direction.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_change_scanning_direction.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_change_scanning_direction.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_change_scanning_direction.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_check_internal_version.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_check_internal_version.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_check_internal_version.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_check_internal_version.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_check_internal_version.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_check_internal_version.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_closest_date.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_closest_date.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_closest_date.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_closest_date.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_closest_date.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_closest_date.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_codeflag.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_codeflag.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_codeflag.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_codeflag.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_codeflag.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_codeflag.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_codetable.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_codetable.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_codetable.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_codetable.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_codetable.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_codetable.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_codetable_title.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_codetable_title.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_codetable_title.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_codetable_title.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_codetable_title.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_codetable_title.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_codetable_units.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_codetable_units.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_codetable_units.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_codetable_units.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_codetable_units.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_codetable_units.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_concept.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_concept.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_concept.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_concept.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_concept.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_concept.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_constant.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_constant.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_constant.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_constant.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_constant.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_constant.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_count_file.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_count_file.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_count_file.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_count_file.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_count_file.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_count_file.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_count_missing.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_count_missing.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_count_missing.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_count_missing.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_count_missing.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_count_missing.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_count_total.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_count_total.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_count_total.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_count_total.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_count_total.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_count_total.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_2order_packing.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_2order_packing.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_2order_packing.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_2order_packing.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_2order_packing.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_2order_packing.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_apply_bitmap.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_apply_bitmap.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_apply_bitmap.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_apply_bitmap.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_apply_bitmap.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_apply_bitmap.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_apply_boustrophedonic.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_apply_boustrophedonic.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_apply_boustrophedonic.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_apply_boustrophedonic.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_apply_boustrophedonic.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_apply_boustrophedonic.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_apply_boustrophedonic_bitmap.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_apply_boustrophedonic_bitmap.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_apply_boustrophedonic_bitmap.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_apply_boustrophedonic_bitmap.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_apply_boustrophedonic_bitmap.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_apply_boustrophedonic_bitmap.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_apply_gdsnotpresent.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_apply_gdsnotpresent.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_apply_gdsnotpresent.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_apply_gdsnotpresent.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_apply_gdsnotpresent.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_apply_gdsnotpresent.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_ccsds_packing.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_ccsds_packing.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_ccsds_packing.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_ccsds_packing.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_ccsds_packing.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_ccsds_packing.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_complex_packing.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_complex_packing.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_complex_packing.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_complex_packing.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_complex_packing.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_complex_packing.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_dummy_field.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_dummy_field.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_dummy_field.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_dummy_field.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_dummy_field.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_dummy_field.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1complex_packing.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1complex_packing.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1complex_packing.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1complex_packing.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1complex_packing.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1complex_packing.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1second_order_constant_width_packing.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1second_order_constant_width_packing.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1second_order_constant_width_packing.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1second_order_constant_width_packing.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1second_order_constant_width_packing.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1second_order_constant_width_packing.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1second_order_general_extended_packing.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1second_order_general_extended_packing.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1second_order_general_extended_packing.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1second_order_general_extended_packing.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1second_order_general_extended_packing.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1second_order_general_extended_packing.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1second_order_general_packing.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1second_order_general_packing.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1second_order_general_packing.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1second_order_general_packing.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1second_order_general_packing.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1second_order_general_packing.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1second_order_row_by_row_packing.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1second_order_row_by_row_packing.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1second_order_row_by_row_packing.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1second_order_row_by_row_packing.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1second_order_row_by_row_packing.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1second_order_row_by_row_packing.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1secondary_bitmap.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1secondary_bitmap.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1secondary_bitmap.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1secondary_bitmap.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1secondary_bitmap.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1secondary_bitmap.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1shsimple_packing.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1shsimple_packing.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1shsimple_packing.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1shsimple_packing.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1shsimple_packing.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1shsimple_packing.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1simple_packing.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1simple_packing.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1simple_packing.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1simple_packing.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1simple_packing.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g1simple_packing.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g22order_packing.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g22order_packing.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g22order_packing.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g22order_packing.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g22order_packing.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g22order_packing.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2bifourier_packing.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2bifourier_packing.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2bifourier_packing.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2bifourier_packing.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2bifourier_packing.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2bifourier_packing.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2complex_packing.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2complex_packing.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2complex_packing.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2complex_packing.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2complex_packing.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2complex_packing.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2secondary_bitmap.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2secondary_bitmap.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2secondary_bitmap.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2secondary_bitmap.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2secondary_bitmap.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2secondary_bitmap.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2shsimple_packing.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2shsimple_packing.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2shsimple_packing.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2shsimple_packing.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2shsimple_packing.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2shsimple_packing.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2simple_packing.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2simple_packing.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2simple_packing.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2simple_packing.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2simple_packing.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2simple_packing.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2simple_packing_with_preprocessing.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2simple_packing_with_preprocessing.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2simple_packing_with_preprocessing.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2simple_packing_with_preprocessing.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2simple_packing_with_preprocessing.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_g2simple_packing_with_preprocessing.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_jpeg2000_packing.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_jpeg2000_packing.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_jpeg2000_packing.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_jpeg2000_packing.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_jpeg2000_packing.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_jpeg2000_packing.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_png_packing.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_png_packing.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_png_packing.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_png_packing.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_png_packing.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_png_packing.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_raw_packing.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_raw_packing.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_raw_packing.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_raw_packing.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_raw_packing.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_raw_packing.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_run_length_packing.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_run_length_packing.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_run_length_packing.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_run_length_packing.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_run_length_packing.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_run_length_packing.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_secondary_bitmap.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_secondary_bitmap.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_secondary_bitmap.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_secondary_bitmap.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_secondary_bitmap.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_secondary_bitmap.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_sh_packed.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_sh_packed.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_sh_packed.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_sh_packed.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_sh_packed.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_sh_packed.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_sh_unpacked.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_sh_unpacked.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_sh_unpacked.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_sh_unpacked.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_sh_unpacked.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_sh_unpacked.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_shsimple_packing.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_shsimple_packing.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_shsimple_packing.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_shsimple_packing.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_shsimple_packing.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_shsimple_packing.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_simple_packing.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_simple_packing.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_simple_packing.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_simple_packing.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_simple_packing.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_data_simple_packing.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_decimal_precision.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_decimal_precision.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_decimal_precision.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_decimal_precision.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_decimal_precision.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_decimal_precision.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_dictionary.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_dictionary.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_dictionary.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_dictionary.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_dictionary.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_dictionary.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_dirty.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_dirty.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_dirty.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_dirty.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_dirty.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_dirty.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_divdouble.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_divdouble.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_divdouble.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_divdouble.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_divdouble.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_divdouble.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_double.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_double.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_double.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_double.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_double.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_double.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_element.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_element.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_element.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_element.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_element.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_element.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_evaluate.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_evaluate.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_evaluate.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_evaluate.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_evaluate.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_evaluate.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_expanded_descriptors.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_expanded_descriptors.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_expanded_descriptors.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_expanded_descriptors.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_expanded_descriptors.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_expanded_descriptors.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_forward.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_forward.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_forward.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_forward.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_forward.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_forward.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_from_scale_factor_scaled_value.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_from_scale_factor_scaled_value.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_from_scale_factor_scaled_value.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_from_scale_factor_scaled_value.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_from_scale_factor_scaled_value.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_from_scale_factor_scaled_value.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1_half_byte_codeflag.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1_half_byte_codeflag.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1_half_byte_codeflag.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1_half_byte_codeflag.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1_half_byte_codeflag.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1_half_byte_codeflag.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1_message_length.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1_message_length.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1_message_length.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1_message_length.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1_message_length.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1_message_length.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1_section4_length.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1_section4_length.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1_section4_length.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1_section4_length.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1_section4_length.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1_section4_length.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1area.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1area.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1area.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1area.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1area.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1area.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1bitmap.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1bitmap.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1bitmap.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1bitmap.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1bitmap.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1bitmap.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1date.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1date.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1date.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1date.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1date.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1date.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1day_of_the_year_date.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1day_of_the_year_date.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1day_of_the_year_date.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1day_of_the_year_date.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1day_of_the_year_date.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1day_of_the_year_date.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1end_of_interval_monthly.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1end_of_interval_monthly.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1end_of_interval_monthly.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1end_of_interval_monthly.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1end_of_interval_monthly.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1end_of_interval_monthly.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1fcperiod.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1fcperiod.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1fcperiod.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1fcperiod.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1fcperiod.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1fcperiod.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1forecastmonth.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1forecastmonth.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1forecastmonth.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1forecastmonth.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1forecastmonth.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1forecastmonth.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1monthlydate.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1monthlydate.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1monthlydate.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1monthlydate.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1monthlydate.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1monthlydate.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1number_of_coded_values_sh_complex.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1number_of_coded_values_sh_complex.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1number_of_coded_values_sh_complex.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1number_of_coded_values_sh_complex.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1number_of_coded_values_sh_complex.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1number_of_coded_values_sh_complex.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1number_of_coded_values_sh_simple.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1number_of_coded_values_sh_simple.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1number_of_coded_values_sh_simple.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1number_of_coded_values_sh_simple.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1number_of_coded_values_sh_simple.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1number_of_coded_values_sh_simple.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1verificationdate.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1verificationdate.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1verificationdate.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1verificationdate.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1verificationdate.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g1verificationdate.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2_aerosol.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2_aerosol.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2_aerosol.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2_aerosol.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2_aerosol.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2_aerosol.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2_chemical.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2_chemical.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2_chemical.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2_chemical.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2_chemical.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2_chemical.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2_eps.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2_eps.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2_eps.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2_eps.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2_eps.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2_eps.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2_mars_labeling.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2_mars_labeling.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2_mars_labeling.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2_mars_labeling.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2_mars_labeling.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2_mars_labeling.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2bitmap.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2bitmap.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2bitmap.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2bitmap.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2bitmap.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2bitmap.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2bitmap_present.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2bitmap_present.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2bitmap_present.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2bitmap_present.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2bitmap_present.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2bitmap_present.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2date.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2date.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2date.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2date.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2date.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2date.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2end_step.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2end_step.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2end_step.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2end_step.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2end_step.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2end_step.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2grid.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2grid.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2grid.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2grid.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2grid.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2grid.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2latlon.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2latlon.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2latlon.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2latlon.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2latlon.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2latlon.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2level.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2level.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2level.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2level.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2level.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2level.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2lon.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2lon.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2lon.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2lon.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2lon.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2lon.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2step_range.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2step_range.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2step_range.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2step_range.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2step_range.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_g2step_range.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_gaussian_grid_name.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_gaussian_grid_name.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_gaussian_grid_name.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_gaussian_grid_name.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_gaussian_grid_name.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_gaussian_grid_name.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_gds_is_present.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_gds_is_present.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_gds_is_present.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_gds_is_present.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_gds_is_present.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_gds_is_present.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_gds_not_present_bitmap.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_gds_not_present_bitmap.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_gds_not_present_bitmap.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_gds_not_present_bitmap.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_gds_not_present_bitmap.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_gds_not_present_bitmap.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_getenv.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_getenv.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_getenv.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_getenv.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_getenv.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_getenv.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_global_gaussian.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_global_gaussian.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_global_gaussian.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_global_gaussian.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_global_gaussian.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_global_gaussian.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_group.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_group.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_group.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_group.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_group.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_group.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_gts_header.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_gts_header.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_gts_header.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_gts_header.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_gts_header.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_gts_header.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_hash_array.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_hash_array.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_hash_array.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_hash_array.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_hash_array.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_hash_array.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_headers_only.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_headers_only.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_headers_only.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_headers_only.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_headers_only.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_headers_only.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_ibmfloat.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_ibmfloat.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_ibmfloat.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_ibmfloat.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_ibmfloat.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_ibmfloat.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_ieeefloat.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_ieeefloat.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_ieeefloat.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_ieeefloat.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_ieeefloat.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_ieeefloat.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_ifs_param.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_ifs_param.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_ifs_param.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_ifs_param.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_ifs_param.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_ifs_param.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_int16.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_int16.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_int16.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_int16.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_int16.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_int16.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_int16_little_endian.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_int16_little_endian.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_int16_little_endian.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_int16_little_endian.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_int16_little_endian.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_int16_little_endian.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_int32.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_int32.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_int32.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_int32.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_int32.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_int32.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_int32_little_endian.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_int32_little_endian.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_int32_little_endian.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_int32_little_endian.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_int32_little_endian.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_int32_little_endian.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_int64.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_int64.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_int64.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_int64.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_int64.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_int64.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_int64_little_endian.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_int64_little_endian.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_int64_little_endian.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_int64_little_endian.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_int64_little_endian.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_int64_little_endian.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_int8.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_int8.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_int8.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_int8.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_int8.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_int8.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_iterator.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_iterator.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_iterator.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_iterator.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_iterator.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_iterator.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_julian_date.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_julian_date.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_julian_date.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_julian_date.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_julian_date.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_julian_date.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_julian_day.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_julian_day.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_julian_day.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_julian_day.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_julian_day.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_julian_day.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_ksec1expver.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_ksec1expver.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_ksec1expver.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_ksec1expver.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_ksec1expver.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_ksec1expver.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_label.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_label.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_label.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_label.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_label.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_label.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_laplacian.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_laplacian.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_laplacian.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_laplacian.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_laplacian.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_laplacian.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_latitudes.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_latitudes.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_latitudes.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_latitudes.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_latitudes.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_latitudes.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_latlon_increment.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_latlon_increment.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_latlon_increment.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_latlon_increment.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_latlon_increment.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_latlon_increment.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_latlonvalues.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_latlonvalues.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_latlonvalues.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_latlonvalues.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_latlonvalues.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_latlonvalues.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_library_version.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_library_version.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_library_version.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_library_version.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_library_version.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_library_version.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_local_definition.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_local_definition.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_local_definition.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_local_definition.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_local_definition.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_local_definition.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_long.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_long.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_long.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_long.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_long.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_long.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_long_vector.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_long_vector.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_long_vector.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_long_vector.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_long_vector.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_long_vector.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_longitudes.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_longitudes.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_longitudes.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_longitudes.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_longitudes.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_longitudes.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_lookup.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_lookup.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_lookup.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_lookup.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_lookup.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_lookup.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_mars_param.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_mars_param.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_mars_param.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_mars_param.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_mars_param.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_mars_param.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_mars_step.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_mars_step.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_mars_step.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_mars_step.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_mars_step.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_mars_step.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_md5.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_md5.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_md5.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_md5.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_md5.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_md5.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_message.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_message.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_message.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_message.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_message.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_message.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_message_copy.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_message_copy.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_message_copy.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_message_copy.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_message_copy.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_message_copy.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_missing.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_missing.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_missing.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_missing.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_missing.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_missing.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_nearest.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_nearest.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_nearest.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_nearest.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_nearest.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_nearest.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_non_alpha.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_non_alpha.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_non_alpha.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_non_alpha.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_non_alpha.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_non_alpha.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_number_of_coded_values.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_number_of_coded_values.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_number_of_coded_values.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_number_of_coded_values.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_number_of_coded_values.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_number_of_coded_values.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_number_of_points.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_number_of_points.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_number_of_points.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_number_of_points.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_number_of_points.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_number_of_points.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_number_of_points_gaussian.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_number_of_points_gaussian.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_number_of_points_gaussian.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_number_of_points_gaussian.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_number_of_points_gaussian.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_number_of_points_gaussian.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_number_of_values.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_number_of_values.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_number_of_values.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_number_of_values.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_number_of_values.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_number_of_values.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_number_of_values_data_raw_packing.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_number_of_values_data_raw_packing.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_number_of_values_data_raw_packing.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_number_of_values_data_raw_packing.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_number_of_values_data_raw_packing.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_number_of_values_data_raw_packing.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_octahedral_gaussian.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_octahedral_gaussian.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_octahedral_gaussian.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_octahedral_gaussian.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_octahedral_gaussian.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_octahedral_gaussian.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_octet_number.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_octet_number.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_octet_number.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_octet_number.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_octet_number.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_octet_number.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_offset_file.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_offset_file.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_offset_file.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_offset_file.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_offset_file.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_offset_file.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_offset_values.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_offset_values.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_offset_values.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_offset_values.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_offset_values.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_offset_values.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_pack_bufr_values.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_pack_bufr_values.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_pack_bufr_values.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_pack_bufr_values.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_pack_bufr_values.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_pack_bufr_values.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_pad.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_pad.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_pad.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_pad.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_pad.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_pad.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_padding.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_padding.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_padding.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_padding.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_padding.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_padding.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_padto.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_padto.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_padto.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_padto.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_padto.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_padto.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_padtoeven.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_padtoeven.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_padtoeven.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_padtoeven.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_padtoeven.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_padtoeven.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_padtomultiple.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_padtomultiple.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_padtomultiple.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_padtomultiple.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_padtomultiple.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_padtomultiple.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_position.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_position.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_position.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_position.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_position.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_position.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_raw.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_raw.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_raw.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_raw.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_raw.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_raw.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_rdbtime_guess_date.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_rdbtime_guess_date.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_rdbtime_guess_date.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_rdbtime_guess_date.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_rdbtime_guess_date.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_rdbtime_guess_date.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_reference_value_error.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_reference_value_error.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_reference_value_error.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_reference_value_error.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_reference_value_error.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_reference_value_error.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_round.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_round.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_round.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_round.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_round.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_round.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_scale.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_scale.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_scale.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_scale.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_scale.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_scale.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_scale_values.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_scale_values.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_scale_values.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_scale_values.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_scale_values.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_scale_values.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_second_order_bits_per_value.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_second_order_bits_per_value.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_second_order_bits_per_value.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_second_order_bits_per_value.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_second_order_bits_per_value.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_second_order_bits_per_value.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_section.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_section.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_section.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_section.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_section.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_section.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_section_length.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_section_length.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_section_length.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_section_length.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_section_length.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_section_length.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_section_padding.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_section_padding.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_section_padding.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_section_padding.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_section_padding.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_section_padding.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_section_pointer.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_section_pointer.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_section_pointer.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_section_pointer.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_section_pointer.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_section_pointer.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_select_step_template.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_select_step_template.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_select_step_template.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_select_step_template.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_select_step_template.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_select_step_template.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_sexagesimal2decimal.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_sexagesimal2decimal.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_sexagesimal2decimal.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_sexagesimal2decimal.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_sexagesimal2decimal.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_sexagesimal2decimal.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_signed.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_signed.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_signed.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_signed.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_signed.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_signed.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_signed_bits.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_signed_bits.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_signed_bits.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_signed_bits.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_signed_bits.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_signed_bits.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_simple_packing_error.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_simple_packing_error.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_simple_packing_error.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_simple_packing_error.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_simple_packing_error.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_simple_packing_error.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_size.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_size.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_size.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_size.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_size.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_size.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_smart_table.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_smart_table.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_smart_table.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_smart_table.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_smart_table.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_smart_table.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_smart_table_column.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_smart_table_column.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_smart_table_column.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_smart_table_column.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_smart_table_column.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_smart_table_column.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_spd.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_spd.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_spd.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_spd.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_spd.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_spd.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_spectral_truncation.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_spectral_truncation.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_spectral_truncation.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_spectral_truncation.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_spectral_truncation.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_spectral_truncation.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_sprintf.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_sprintf.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_sprintf.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_sprintf.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_sprintf.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_sprintf.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_statistics.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_statistics.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_statistics.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_statistics.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_statistics.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_statistics.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_statistics_spectral.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_statistics_spectral.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_statistics_spectral.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_statistics_spectral.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_statistics_spectral.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_statistics_spectral.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_step_human_readable.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_step_human_readable.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_step_human_readable.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_step_human_readable.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_step_human_readable.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_step_human_readable.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_step_in_units.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_step_in_units.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_step_in_units.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_step_in_units.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_step_in_units.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_step_in_units.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_sum.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_sum.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_sum.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_sum.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_sum.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_sum.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_suppressed.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_suppressed.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_suppressed.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_suppressed.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_suppressed.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_suppressed.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_time.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_time.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_time.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_time.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_time.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_time.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_times.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_times.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_times.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_times.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_times.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_times.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_to_double.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_to_double.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_to_double.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_to_double.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_to_double.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_to_double.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_to_integer.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_to_integer.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_to_integer.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_to_integer.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_to_integer.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_to_integer.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_to_string.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_to_string.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_to_string.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_to_string.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_to_string.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_to_string.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_transient.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_transient.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_transient.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_transient.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_transient.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_transient.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_transient_darray.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_transient_darray.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_transient_darray.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_transient_darray.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_transient_darray.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_transient_darray.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_trim.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_trim.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_trim.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_trim.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_trim.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_trim.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint16.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint16.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint16.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint16.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint16.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint16.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint16_little_endian.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint16_little_endian.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint16_little_endian.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint16_little_endian.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint16_little_endian.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint16_little_endian.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint32.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint32.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint32.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint32.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint32.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint32.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint32_little_endian.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint32_little_endian.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint32_little_endian.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint32_little_endian.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint32_little_endian.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint32_little_endian.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint64.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint64.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint64.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint64.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint64.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint64.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint64_little_endian.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint64_little_endian.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint64_little_endian.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint64_little_endian.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint64_little_endian.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint64_little_endian.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint8.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint8.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint8.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint8.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint8.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_uint8.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_unexpanded_descriptors.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_unexpanded_descriptors.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_unexpanded_descriptors.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_unexpanded_descriptors.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_unexpanded_descriptors.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_unexpanded_descriptors.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_unpack_bufr_values.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_unpack_bufr_values.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_unpack_bufr_values.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_unpack_bufr_values.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_unpack_bufr_values.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_unpack_bufr_values.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_unsigned.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_unsigned.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_unsigned.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_unsigned.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_unsigned.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_unsigned.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_unsigned_bits.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_unsigned_bits.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_unsigned_bits.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_unsigned_bits.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_unsigned_bits.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_unsigned_bits.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_validity_date.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_validity_date.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_validity_date.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_validity_date.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_validity_date.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_validity_date.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_validity_time.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_validity_time.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_validity_time.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_validity_time.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_validity_time.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_validity_time.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_values.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_values.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_values.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_values.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_values.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_values.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_variable.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_variable.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_variable.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_variable.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_variable.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_variable.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_vector.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_vector.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_vector.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_vector.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_vector.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_vector.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_when.cpp b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_when.cpp new file mode 100644 index 000000000..ac74f34d7 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_when.cpp @@ -0,0 +1,62 @@ +#include "grib_accessor_impl_TEMPLATE.h" + +namespace eccodes { + + grib_accessor_impl_TEMPLATE::grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator) : + grib_accessor_impl_PARENT(p, ga_creator) + { + // No extra logic here - init() handles this + } + + grib_accessor_impl_TEMPLATE::~grib_accessor_impl_TEMPLATE() + {} + + void grib_accessor_impl_TEMPLATE::init(const long len, grib_arguments* params) + { + // Default is to call parent's init, then init self (i.e. like a constructor) + grib_accessor_impl_PARENT::init(len, params); + init_TEMPLATE(len, params); + } + + void grib_accessor_impl_TEMPLATE::init_TEMPLATE(const long len, grib_arguments* params) {} + + int grib_accessor_impl_TEMPLATE::pack_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::is_missing() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string_array(const char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_expression(grib_expression* e) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string_array(char** v, size_t* len) { return GRIB_NOT_IMPLEMENTED; } + size_t grib_accessor_impl_TEMPLATE::string_length() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_count() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::byte_offset() { return GRIB_NOT_IMPLEMENTED; } + long grib_accessor_impl_TEMPLATE::next_offset() { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::value_count(long* count) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::dump(grib_dumper* dumper) {} + void grib_accessor_impl_TEMPLATE::post_init() {} + int grib_accessor_impl_TEMPLATE::notify_change(grib_accessor* observed) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::update_size(size_t s) {} + size_t grib_accessor_impl_TEMPLATE::preferred_size(int from_handle) { return GRIB_NOT_IMPLEMENTED; } + void grib_accessor_impl_TEMPLATE::resize(size_t new_size) {} + int grib_accessor_impl_TEMPLATE::nearest_smaller_value (double val, double* nearest) { return GRIB_NOT_IMPLEMENTED; } + grib_accessor* grib_accessor_impl_TEMPLATE::next_accessor(int mod) { return NULL; } + int grib_accessor_impl_TEMPLATE::compare(grib_accessor_impl* ga_impl) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element(size_t i, double* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element(size_t i, float* val) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double_subarray(double* val, size_t start, size_t len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::clear() { return GRIB_NOT_IMPLEMENTED; } + grib_accessor_impl* grib_accessor_impl_TEMPLATE::make_clone(grib_section* s, int* err) { return NULL; } + + int grib_accessor_impl_TEMPLATE::pack_bytes(pack_buffer& bytes, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_double(pack_buffer& doubles, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_float(pack_buffer& floats, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_long(pack_buffer& longs, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::pack_string(pack_buffer& chars, std::size_t* packed_len) { return GRIB_NOT_IMPLEMENTED; } + + int grib_accessor_impl_TEMPLATE::unpack_bytes(byte_view bytes) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_double(double_view doubles) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_float(float_view floats) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_long(long_view longs) { return GRIB_NOT_IMPLEMENTED; } + int grib_accessor_impl_TEMPLATE::unpack_string(char_view chars) { return GRIB_NOT_IMPLEMENTED; } + +} diff --git a/src/grib_accessor_impl_v1/templates/grib_accessor_impl_when.h b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_when.h new file mode 100644 index 000000000..13afd9df4 --- /dev/null +++ b/src/grib_accessor_impl_v1/templates/grib_accessor_impl_when.h @@ -0,0 +1,72 @@ +#ifndef _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ +#define _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ + +#include "grib_accessor_impl_PARENT.h" + +namespace eccodes { + + class grib_accessor_impl_TEMPLATE : public grib_accessor_impl_PARENT { + protected: + // grib_accessor_TEMPLATE data + // + // WARNING: Whilst converting from C to C++ the code supports casting + // this class to the equivalent grib_accessor_TEMPLATE C struct + // + // This is only possible if the member variables MATCH EXACTLY! + // + // DO NOT ADD any extra member variables to this class otherwise + // this functionality will break! + // + public: + grib_accessor_impl_TEMPLATE(grib_section* p, grib_action* ga_creator); + ~grib_accessor_impl_TEMPLATE(); + void init(const long len, grib_arguments* params) override; + int native_type() override { return SET_TYPE_OR_DELETE_THIS_OVERLOAD; } + int pack_missing() override; + int is_missing() override; + int pack_string_array(const char** v, size_t* len) override; + int pack_expression(grib_expression* e) override; + int unpack_string_array(char** v, size_t* len) override; + size_t string_length() override; + long byte_count() override; + long byte_offset() override; + long next_offset() override; + int value_count(long* count) override; + void dump(grib_dumper* dumper) override; + void post_init() override; + int notify_change(grib_accessor* observed) override; + void update_size(size_t s) override; + size_t preferred_size(int from_handle) override; + void resize(size_t new_size) override; + int nearest_smaller_value (double val, double* nearest) override; + grib_accessor* next_accessor(int mod) override; + int compare(grib_accessor_impl* ga_impl) override; + int unpack_double_element(size_t i, double* val) override; + int unpack_float_element(size_t i, float* val) override; + int unpack_double_element_set(const size_t* index_array, size_t len, double* val_array) override; + int unpack_float_element_set(const size_t* index_array, size_t len, float* val_array) override; + int unpack_double_subarray(double* val, size_t start, size_t len) override; + int clear() override; + grib_accessor_impl* make_clone(grib_section* s, int* err) override; + + protected: + virtual void init_TEMPLATE(const long len, grib_arguments* params); + + int pack_bytes(pack_buffer& bytes, std::size_t* packed_len) override; + int pack_double(pack_buffer& doubles, std::size_t* packed_len) override; + int pack_float(pack_buffer& floats, std::size_t* packed_len) override; + int pack_long(pack_buffer& longs, std::size_t* packed_len) override; + int pack_string(pack_buffer& chars, std::size_t* packed_len) override; + + int unpack_bytes(byte_view bytes) override; + int unpack_double(double_view doubles) override; + int unpack_float(float_view floats) override; + int unpack_long(long_view longs) override; + int unpack_string(char_view chars) override; + + private: + void init_TEMPLATE(const long len, grib_arguments* params); + }; +} + +#endif // _GRIB_ACCESSOR_IMPL_TEMPLATE_H_2023MMDD_ diff --git a/src/grib_accessor_impl_v1/tests/pack_buffer_tests.cpp b/src/grib_accessor_impl_v1/tests/pack_buffer_tests.cpp new file mode 100644 index 000000000..78214a517 --- /dev/null +++ b/src/grib_accessor_impl_v1/tests/pack_buffer_tests.cpp @@ -0,0 +1,70 @@ +#include "pack_buffer_tests.h" +#include "../pack_buffer.h" +#include "grib_api_internal.h" + +namespace eccodes { + + void pack_buffer_test() + { + const std::size_t LEN{10}; + grib_context *context = grib_context_get_default(); + int status{GRIB_SUCCESS}; + + // Check we can't pass a nullptr for input_values +//#define TEST_PACK_BUFFER_NULLPTR_ARGS_FAILS_TO_COMPILE +#ifdef TEST_PACK_BUFFER_NULLPTR_ARGS_FAILS_TO_COMPILE + pack_buffer test_buffer(context, nullptr); // Compile error - CORRECT! +#endif // TEST_PACK_BUFFER_NULLPTR_ARGS_FAILS_TO_COMPILE + +//#define TEST_PACK_BUFFER_NULLPTR_ASSERTS +#ifdef TEST_PACK_BUFFER_NULLPTR_ASSERTS + std::size_t null_len{LEN}; + pack_buffer null_buffer(context, const_long_view{nullptr, &null_len}); +#endif // TEST_PACK_BUFFER_NULLPTR_ASSERTS + + // Check malloc fails correctly for buffers that are too big! +//#define TEST_PACK_BUFFER_LARGE_BUFFER_MALLOC_ASSERTS +#ifdef TEST_PACK_BUFFER_LARGE_BUFFER_MALLOC_ASSERTS + long test_long{42}; + std::size_t large_buffer_size_bytes = std::numeric_limits::max() / sizeof(long); + pack_buffer large_buffer(context, const_long_view{&test_long, &large_buffer_size_bytes}); + auto test_d_ptr = large_buffer.to_doubles(); +#endif // TEST_PACK_BUFFER_LARGE_BUFFER_MALLOC_ASSERTS + + // Long to double + long long_buf[LEN] = {1,1,2,3,5,8,13,21,34,55}; + std::size_t long_len{LEN}; + pack_buffer pb_long(context, const_long_view{long_buf, &long_len}); + auto pb_long_to_doubles = pb_long.to_doubles(); + if(!pb_long_to_doubles.ptr) + { + status = pb_long.current_status(); + } + + // double to long + double double_buf[LEN] = {0.5,1.1,2.2,3.3,4.4,5.5,6.6,7.7,8.8,9.9}; + std::size_t double_len{LEN}; + pack_buffer pb_double(context, const_double_view{double_buf, &double_len}); + auto pb_double_to_longs = pb_double.to_longs(); + if(!pb_double_to_longs.ptr) + { + status = pb_double.current_status(); + } + + // char to double and long + char const pch_long[LEN] = "-3.141593"; + std::size_t char_len{LEN}; + pack_buffer pb_char(context, const_char_view{pch_long, &char_len}); + auto pb_char_as_doubles = pb_char.to_doubles(); + if(!pb_char_as_doubles.ptr) + { + status = pb_char.current_status(); + } + auto pb_char_as_longs = pb_char.to_longs(); + if(!pb_char_as_longs.ptr) + { + status = pb_char.current_status(); + } + } + + } diff --git a/src/grib_accessor_impl_v1/tests/pack_buffer_tests.h b/src/grib_accessor_impl_v1/tests/pack_buffer_tests.h new file mode 100644 index 000000000..907090594 --- /dev/null +++ b/src/grib_accessor_impl_v1/tests/pack_buffer_tests.h @@ -0,0 +1,9 @@ +#ifndef _PACK_BUFFER_TESTS_H_20230620_ +#define _PACK_BUFFER_TESTS_H_20230620_ + +namespace eccodes { + + void run_pack_buffer_tests(); + } + +#endif // _PACK_BUFFER_TESTS_H_20230620_ diff --git a/src/grib_accessor_impl_v1/type_view.h b/src/grib_accessor_impl_v1/type_view.h new file mode 100644 index 000000000..6097ab589 --- /dev/null +++ b/src/grib_accessor_impl_v1/type_view.h @@ -0,0 +1,30 @@ +#ifndef _TYPE_VIEW_H_20230619_ +#define _TYPE_VIEW_H_20230619_ + +#include + +namespace eccodes { + + // Helper object to wrap a pointer and its size + + template + struct type_view{ + using type = T; + T* ptr{}; + std::size_t* len{}; + }; + + using const_byte_view = type_view; + using const_double_view = type_view; + using const_float_view = type_view; + using const_long_view = type_view; + using const_char_view = type_view; + + using byte_view = type_view; + using double_view = type_view; + using float_view = type_view; + using long_view = type_view; + using char_view = type_view; +} + +#endif // _TYPE_VIEW_H_20230619_