mirror of https://github.com/ecmwf/eccodes.git
Added stubs to assist conversion process
This commit is contained in:
parent
8f4f7ee495
commit
517b7f02ef
|
@ -21,8 +21,9 @@ c_lib_substitutions = {
|
|||
|
||||
# grib_ functions that can be deleted - we'll comment them out for now!
|
||||
grib_deleted_function_substitutions = {
|
||||
#r"^\s*(.*?\bgrib_context_malloc_clear)": r"// [Removed grib_context_malloc_clear] \1",
|
||||
r"^\s*(.*?\bgrib_context_free)": r"// [Removed grib_context_free] \1",
|
||||
r"^\s*(.*?\bgrib_context_free_persistent)": r"// [Removed grib_context_free_persistent] \1",
|
||||
r"^\s*(.*?\bgrib_context_buffer_free)": r"// [Removed grib_context_buffer_free] \1",
|
||||
}
|
||||
|
||||
grib_context_substitutions = {
|
||||
|
|
|
@ -103,17 +103,6 @@ class FunctionConverter:
|
|||
|
||||
# ======================================== UPDATE FUNCTIONS ========================================
|
||||
|
||||
# TODO: Move to grib_api folder...
|
||||
def convert_grib_utils(self, line):
|
||||
for util in ["grib_is_earth_oblate",]:
|
||||
m = re.search(rf"\b{util}\b", line)
|
||||
if m:
|
||||
cpp_util = transform_function_name(util)
|
||||
line = re.sub(m.re, f"{cpp_util}", line)
|
||||
debug.line("convert_grib_utils", f"Replaced {util} with {cpp_util} [after ]: {line}")
|
||||
|
||||
return line
|
||||
|
||||
# Helper for transform_cfunction_call to apply any conversions specified in the
|
||||
# supplied conversions map
|
||||
# Returns the transformed cpp function name and C params, or None (for each)
|
||||
|
@ -341,6 +330,10 @@ class FunctionConverter:
|
|||
line = line[:match_start] + f"{cfuncname}({','.join([p for p in cparams])})" + remainder
|
||||
debug.line("convert_next_cfunction_call",f"[{depth}] No conversion for function [{cfuncname}], but may have tidied args [After]: {line}")
|
||||
|
||||
# DEBUG OUTPUT
|
||||
if cfuncname.startswith("grib_"):
|
||||
debug.line("GRIB FUNCTION", f"{cfuncname}")
|
||||
|
||||
return line
|
||||
|
||||
# Find any C function calls in the line and convert them
|
||||
|
@ -350,7 +343,7 @@ class FunctionConverter:
|
|||
return line
|
||||
|
||||
def update_grib_api_cfunctions(self, line):
|
||||
line = self.convert_grib_utils(line)
|
||||
# grib_is_earth_oblate was here...
|
||||
line = grib_api_converter.convert_grib_api_functions(line)
|
||||
|
||||
return line
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
|
||||
import funcsig_conversions.grib_cpp_funcsig_conversions.grib_bits_funcsig_conv as grib_bits_funcsig_conv
|
||||
import funcsig_conversions.grib_cpp_funcsig_conversions.grib_common_funcsig_conv as grib_common_funcsig_conv
|
||||
import funcsig_conversions.grib_cpp_funcsig_conversions.grib_query_funcsig_conv as grib_query_funcsig_conv
|
||||
import funcsig_conversions.grib_cpp_funcsig_conversions.grib_value_funcsig_conv as grib_value_funcsig_conv
|
||||
import funcsig_conversions.grib_cpp_funcsig_conversions.string_util_funcsig_conv as string_util_funcsig_conv
|
||||
|
||||
grib_cpp_funcsig_conversions = [
|
||||
grib_bits_funcsig_conv.grib_bits_funcsig_conversions,
|
||||
grib_common_funcsig_conv.grib_common_funcsig_conversions,
|
||||
grib_query_funcsig_conv.grib_query_funcsig_conversions,
|
||||
grib_value_funcsig_conv.grib_value_funcsig_conversions,
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
|
||||
from funcsig import FuncSig
|
||||
from arg_indexes import ArgIndexes
|
||||
from arg import Arg
|
||||
from funcsig_mapping import FuncSigMapping
|
||||
|
||||
grib_bits_funcsig_conversions = [
|
||||
FuncSigMapping( FuncSig("void", "grib_set_bit_on", [Arg("unsigned char*", "p"), Arg("long*", "bitp")]),
|
||||
FuncSig("void", "gribSetBitOn", [Arg("std::vector<unsigned char>&", "p"), Arg("long&", "bitp")])),
|
||||
|
||||
FuncSigMapping( FuncSig("void", "grib_set_bits_on", [Arg("unsigned char*", "p"), Arg("long*", "bitp"), Arg("long", "nbits")]),
|
||||
FuncSig("void", "gribSetBitsOn", [Arg("std::vector<unsigned char>&", "p"), Arg("long&", "bitp"), Arg("long", "nbits")])),
|
||||
|
||||
FuncSigMapping( FuncSig("void", "grib_set_bit_off", [Arg("unsigned char*", "p"), Arg("long*", "bitp")]),
|
||||
FuncSig("void", "gribSetBitOff", [Arg("std::vector<unsigned char>&", "p"), Arg("long&", "bitp")])),
|
||||
|
||||
FuncSigMapping( FuncSig("void", "grib_set_bit", [Arg("unsigned char*", "p"), Arg("long", "bitp"), Arg("int", "val")]),
|
||||
FuncSig("void", "gribSetBit", [Arg("std::vector<unsigned char>&", "p"), Arg("long&", "bitp"), Arg("int", "val")])),
|
||||
|
||||
]
|
|
@ -1,7 +1,11 @@
|
|||
|
||||
import funcsig_conversions.grib_stub_funcsig_conversions.grib_accessor_class_stub_funcsig_conv as grib_accessor_class_stub_funcsig_conv
|
||||
import funcsig_conversions.grib_stub_funcsig_conversions.grib_accessor_stub_funcsig_conv as grib_accessor_stub_funcsig_conv
|
||||
import funcsig_conversions.grib_stub_funcsig_conversions.grib_bits_any_endian_stub_funcsig_conv as grib_bits_any_endian_stub_funcsig_conv
|
||||
import funcsig_conversions.grib_stub_funcsig_conversions.grib_bits_fast_big_endian_stub_funcsig_conv as grib_bits_fast_big_endian_stub_funcsig_conv
|
||||
import funcsig_conversions.grib_stub_funcsig_conversions.grib_buffer_stub_funcsig_conv as grib_buffer_stub_funcsig_conv
|
||||
import funcsig_conversions.grib_stub_funcsig_conversions.grib_date_stub_funcsig_conv as grib_date_stub_funcsig_conv
|
||||
import funcsig_conversions.grib_stub_funcsig_conversions.grib_util_stub_funcsig_conv as grib_util_stub_funcsig_conv
|
||||
import funcsig_conversions.grib_stub_funcsig_conversions.grib_expression_stub_funcsig_conv as grib_expression_stub_funcsig_conv
|
||||
|
||||
grib_stub_funcsig_conversions = [
|
||||
|
@ -9,6 +13,9 @@ grib_stub_funcsig_conversions = [
|
|||
grib_accessor_stub_funcsig_conv.grib_accessor_stub_funcsig_conversions,
|
||||
grib_bits_any_endian_stub_funcsig_conv.grib_bits_any_endian_stub_funcsig_conversions,
|
||||
grib_bits_fast_big_endian_stub_funcsig_conv.grib_bits_fast_big_endian_stub_funcsig_conversions,
|
||||
grib_buffer_stub_funcsig_conv.grib_buffer_stub_funcsig_conversions,
|
||||
grib_date_stub_funcsig_conv.grib_date_stub_funcsig_conversions,
|
||||
grib_util_stub_funcsig_conv.grib_util_stub_funcsig_conversions,
|
||||
grib_expression_stub_funcsig_conv.grib_expression_stub_funcsig_conversions
|
||||
]
|
||||
|
||||
|
|
|
@ -7,4 +7,13 @@ from funcsig_mapping import FuncSigMapping
|
|||
grib_accessor_class_stub_funcsig_conversions = [
|
||||
FuncSigMapping( FuncSig("int", "grib_get_block_length", [Arg("grib_section*", "s"), Arg("size_t*", "l")]),
|
||||
FuncSig("GribStatus", "gribGetBlockLength", [Arg("AccessorPtr", "ptr"), Arg("size_t&", "l")])),
|
||||
|
||||
FuncSigMapping( FuncSig("grib_accessor*", "grib_accessor_factory", [Arg("grib_action*", "creator"), Arg("const long", "len"), Arg("grib_arguments*", "params")]),
|
||||
FuncSig("AccessorPtr", "gribAccessorFactory", [Arg("GribActionPtr", "creator"), Arg("const long", "len"), Arg("AccessorInitData", "initData")])),
|
||||
|
||||
FuncSigMapping( FuncSig("void", "grib_push_accessor", [Arg("grib_accessor*", "a"), Arg("grib_block_of_accessors*", "l")]),
|
||||
FuncSig("void", "gribPushAccessor", [Arg("AccessorPtr", "ptr"), Arg("std::vector<AccessorPtr>", "ptrList")])),
|
||||
|
||||
FuncSigMapping( FuncSig("int", "grib_section_adjust_sizes", [Arg("grib_section*", "s"), Arg("int", "update"), Arg("int", "depth")]),
|
||||
FuncSig("GribStatus", "gribSectionAdjustSizes", [None, Arg("int", "update"), Arg("int", "depth")])),
|
||||
]
|
||||
|
|
|
@ -180,4 +180,15 @@ grib_accessor_stub_funcsig_conversions = [
|
|||
FuncSigMapping( FuncSig("int", "grib_accessor_has_attributes", [Arg("grib_accessor*", "a")]),
|
||||
FuncSig("GribStatus", "gribAccessorHasAttributes", [Arg("AccessorPtr", "ptr")])),
|
||||
|
||||
# =============================================================================
|
||||
|
||||
FuncSigMapping( FuncSig("grib_accessor*", "grib_accessor_clone", [Arg("grib_accessor*", "a"), Arg("grib_section*", "s"), Arg("int*", "err")]),
|
||||
FuncSig("AccessorPtr", "gribAccessorClone", [Arg("AccessorPtr", "ptr"), None, Arg("int&", "err")])),
|
||||
|
||||
FuncSigMapping( FuncSig("grib_accessor*", "grib_accessor_get_attribute", [Arg("grib_accessor*", "a"), Arg("const char*", "name")]),
|
||||
FuncSig("AccessorPtr", "gribAccessorGetAttribute", [Arg("AccessorPtr", "ptr"), Arg("const std::string", "name")])),
|
||||
|
||||
FuncSigMapping( FuncSig("grib_accessors_list*", "grib_accessors_list_last", [Arg("grib_accessors_list*", "al")]),
|
||||
FuncSig("std::vector<AccessorPtr>", "gribAccessorsListLast", [Arg("std::vector<AccessorPtr>", "ptrList")])),
|
||||
|
||||
]
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
|
||||
from funcsig import FuncSig
|
||||
from arg_indexes import ArgIndexes
|
||||
from arg import Arg
|
||||
from funcsig_mapping import FuncSigMapping
|
||||
|
||||
grib_buffer_stub_funcsig_conversions = [
|
||||
FuncSigMapping( FuncSig("void", "grib_buffer_delete", [Arg("const grib_context*", "c"), Arg("grib_buffer*", "b")]),
|
||||
FuncSig("void", "griBufferDelete", [None, Arg("AccessorDataBuffer", "b")])),
|
||||
|
||||
FuncSigMapping( FuncSig("void", "grib_buffer_replace", [Arg("grib_accessor*", "a"), Arg("const unsigned char*", "data"), Arg("size_t", "newsize"), Arg("int", "update_lengths"), Arg("int", "update_paddings")]),
|
||||
FuncSig("void", "gribBufferReplace", [Arg("AccessorPtr", "ptr"), Arg("AccessorDataBuffer", "data"), Arg("size_t", "newsize"), Arg("int", "updateLengths"), Arg("int", "updatePaddings")])),
|
||||
|
||||
FuncSigMapping( FuncSig("void", "grib_buffer_set_ulength_bits", [Arg("const grib_context*", "c"), Arg("grib_buffer*", "b"), Arg("size_t", "length_bits")]),
|
||||
FuncSig("void", "gribBufferSetUlengthBits", [None, Arg("AccessorDataBuffer", "b"), Arg("size_t", "lengthBits")])),
|
||||
|
||||
FuncSigMapping( FuncSig("grib_buffer*", "grib_create_growable_buffer", [Arg("const grib_context*", "c")]),
|
||||
FuncSig("AccessorDataBuffer", "gribCreateGrowableBuffer", [None])),
|
||||
|
||||
]
|
|
@ -0,0 +1,23 @@
|
|||
|
||||
from funcsig import FuncSig
|
||||
from arg_indexes import ArgIndexes
|
||||
from arg import Arg
|
||||
from funcsig_mapping import FuncSigMapping
|
||||
|
||||
grib_date_stub_funcsig_conversions = [
|
||||
FuncSigMapping( FuncSig("long", "grib_date_to_julian", [Arg("long", "ddate")]),
|
||||
FuncSig("long", "gribDateToJulian", [Arg("long", "ddate")])),
|
||||
|
||||
FuncSigMapping( FuncSig("int", "grib_datetime_to_julian", [Arg("long", "year"), Arg("long", "month"), Arg("long", "day"), Arg("long", "hour"), Arg("long", "minute"), Arg("long", "second"), Arg("double*", "jd")]),
|
||||
FuncSig("int", "gribDatetimeToJulian", [Arg("long", "year"), Arg("long", "month"), Arg("long", "day"), Arg("long", "hour"), Arg("long", "minute"), Arg("long", "second"), Arg("double&", "jd")])),
|
||||
|
||||
FuncSigMapping( FuncSig("int", "grib_datetime_to_julian_d", [Arg("long", "year"), Arg("long", "month"), Arg("long", "day"), Arg("long", "hour"), Arg("long", "minute"), Arg("long", "second"), Arg("double*", "jd")]),
|
||||
FuncSig("int", "gribDatetimeToJulianD", [Arg("long", "year"), Arg("long", "month"), Arg("long", "day"), Arg("long", "hour"), Arg("long", "minute"), Arg("long", "second"), Arg("double&", "jd")])),
|
||||
|
||||
FuncSigMapping( FuncSig("long", "grib_julian_to_date", [Arg("long", "jdate")]),
|
||||
FuncSig("long", "gribJulianToDate", [Arg("long", "jdate")])),
|
||||
|
||||
FuncSigMapping( FuncSig("int", "grib_julian_to_datetime", [Arg("double", "jd"), Arg("long*", "year"), Arg("long*", "month"), Arg("long*", "day"), Arg("long*", "hour"), Arg("long*", "minute"), Arg("long*", "second")]),
|
||||
FuncSig("int", "gribJulianToDatetime", [Arg("double", "jd"), Arg("long&", "year"), Arg("long&", "month"), Arg("long&", "day"), Arg("long&", "hour"), Arg("long&", "minute"), Arg("long&", "second")])),
|
||||
|
||||
]
|
|
@ -0,0 +1,19 @@
|
|||
|
||||
from funcsig import FuncSig
|
||||
from arg_indexes import ArgIndexes
|
||||
from arg import Arg
|
||||
from funcsig_mapping import FuncSigMapping
|
||||
|
||||
grib_util_stub_funcsig_conversions = [
|
||||
FuncSigMapping( FuncSig("int", "grib_check_data_values_range", [Arg("grib_handle*", "h"), Arg("const double", "min_val"), Arg("const double", "max_val")]),
|
||||
FuncSig("GribStatus", "gribCheckDataValuesRange", [None, Arg("const double", "minVal"), Arg("const double", "maxVal")])),
|
||||
|
||||
FuncSigMapping( FuncSig("int", "grib_is_earth_oblate", [Arg("grib_handle*", "h")]),
|
||||
FuncSig("bool", "gribIsEarthOblate", [None])),
|
||||
|
||||
FuncSigMapping( FuncSig("int", "grib_producing_large_constant_fields", [Arg("int", "edition")]),
|
||||
FuncSig("bool", "gribProducingLargeConstantFields", [Arg("int", "edition")])),
|
||||
|
||||
FuncSigMapping( FuncSig("int", "grib_util_grib_data_quality_check", [Arg("grib_handle*", "h"), Arg("double", "min_val"), Arg("double", "max_val")]),
|
||||
FuncSig("GribStatus", "gribUtilGribDataQualityCheck", [None, Arg("double", "minVal"), Arg("double", "maxVal")])),
|
||||
]
|
|
@ -53,13 +53,13 @@ set(accessor_utils_src_files
|
|||
|
||||
set(accessor_grib_cpp_src_files
|
||||
${accessor_grib_cpp_dir}/GribCppIncludes.h
|
||||
${accessor_grib_cpp_dir}/GribBits.cc
|
||||
${accessor_grib_cpp_dir}/GribBits.h
|
||||
${accessor_grib_cpp_dir}/GribQuery.cc
|
||||
${accessor_grib_cpp_dir}/GribQuery.h
|
||||
${accessor_grib_cpp_dir}/GribStatus.h
|
||||
${accessor_grib_cpp_dir}/GribType.cc
|
||||
${accessor_grib_cpp_dir}/GribType.h
|
||||
${accessor_grib_cpp_dir}/GribUtils.cc
|
||||
${accessor_grib_cpp_dir}/GribUtils.h
|
||||
${accessor_grib_cpp_dir}/GribValue.cc
|
||||
${accessor_grib_cpp_dir}/GribValue.h
|
||||
${accessor_grib_cpp_dir}/StringUtil.cc
|
||||
|
@ -67,17 +67,24 @@ set(accessor_grib_cpp_src_files
|
|||
)
|
||||
|
||||
set(accessor_grib_stub_src_files
|
||||
${accessor_grib_stub_dir}/GribStubIncludes.h
|
||||
${accessor_grib_stub_dir}/GribAccessorStub.cc
|
||||
${accessor_grib_stub_dir}/GribAccessorStub.h
|
||||
${accessor_grib_stub_dir}/GribAccessorClassStub.cc
|
||||
${accessor_grib_stub_dir}/GribAccessorClassStub.h
|
||||
${accessor_grib_stub_dir}/GribActionStub.h
|
||||
${accessor_grib_stub_dir}/GribBitsAnyEndianStub.cc
|
||||
${accessor_grib_stub_dir}/GribBitsAnyEndianStub.h
|
||||
${accessor_grib_stub_dir}/GribBitsFastBigEndianStub.cc
|
||||
${accessor_grib_stub_dir}/GribBitsFastBigEndianStub.h
|
||||
${accessor_grib_stub_dir}/GribBufferStub.cc
|
||||
${accessor_grib_stub_dir}/GribBufferStub.h
|
||||
${accessor_grib_stub_dir}/GribDateStub.cc
|
||||
${accessor_grib_stub_dir}/GribDateStub.h
|
||||
${accessor_grib_stub_dir}/GribExpressionStub.cc
|
||||
${accessor_grib_stub_dir}/GribExpressionStub.h
|
||||
${accessor_grib_stub_dir}/GribStubIncludes.h
|
||||
${accessor_grib_stub_dir}/GribUtilStub.cc
|
||||
${accessor_grib_stub_dir}/GribUtilStub.h
|
||||
)
|
||||
|
||||
# Variables to be used in the parent CMakeLists.txt
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
#include "GribBits.h"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
namespace eccodes::accessor {
|
||||
|
||||
|
||||
void gribSetBitOn(std::vector<unsigned char>& p, long& bitp)
|
||||
{
|
||||
long index = bitp / 8;
|
||||
p[index] |= (1u << (7 - ((bitp) % 8)));
|
||||
bitp++;
|
||||
}
|
||||
|
||||
void gribSetBitsOn(std::vector<unsigned char>& p, long& bitp, long nbits)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < nbits; i++) {
|
||||
gribSetBitOn(p, bitp);
|
||||
}
|
||||
}
|
||||
|
||||
void gribSetBitOff(std::vector<unsigned char>& p, long& bitp)
|
||||
{
|
||||
long index = bitp / 8;
|
||||
p[index] &= ~(1u << (7 - ((bitp) % 8)));
|
||||
bitp++;
|
||||
}
|
||||
|
||||
void gribSetBit(std::vector<unsigned char>& p, long bitp, int val)
|
||||
{
|
||||
if (val == 0)
|
||||
gribSetBitOff(p, bitp);
|
||||
else
|
||||
gribSetBitOn(p, bitp);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
#pragma once
|
||||
|
||||
// C++ implementation of the functions in grib_accessor_class.cc that are not directly part of the C++ classes
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace eccodes::accessor {
|
||||
|
||||
void gribSetBitOn(std::vector<unsigned char>& p, long& bitp);
|
||||
void gribSetBitsOn(std::vector<unsigned char>& p, long& bitp, long nbits);
|
||||
void gribSetBitOff(std::vector<unsigned char>& p, long& bitp);
|
||||
void gribSetBit(std::vector<unsigned char>& p, long bitp, int val);
|
||||
|
||||
|
||||
}
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
// All includes in one place, for convenience!
|
||||
#include "GribAccessorFlag.h"
|
||||
#include "GribBits.h"
|
||||
#include "GribQuery.h"
|
||||
#include "GribStatus.h"
|
||||
#include "GribType.h"
|
||||
#include "GribUtils.h"
|
||||
#include "GribValue.h"
|
||||
#include "StringUtil.h"
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
#include "GribUtils.h"
|
||||
#include "GribValue.h"
|
||||
#include "AccessorUtils/ConversionHelper.h"
|
||||
|
||||
namespace eccodes::accessor {
|
||||
|
||||
bool gribIsEarthOblate()
|
||||
{
|
||||
long oblate{};
|
||||
GribStatus ret = gribGetLong(AccessorName("earthIsOblate"), oblate);
|
||||
|
||||
return (ret == GribStatus::SUCCESS && oblate == 1);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
// C++ implementation of the existing grib_util.cc helpers
|
||||
|
||||
namespace eccodes::accessor {
|
||||
|
||||
bool gribIsEarthOblate();
|
||||
|
||||
}
|
|
@ -16,8 +16,26 @@ GribStatus gribGetBlockLength(AccessorPtr ptr, size_t& l)
|
|||
{
|
||||
assert(false); // TO DO
|
||||
|
||||
return GribStatus::SUCCESS;
|
||||
return GribStatus::NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
AccessorPtr gribAccessorFactory(GribActionPtr creator, const long len, AccessorInitData initData)
|
||||
{
|
||||
assert(false); // TO DO
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void gribPushAccessor(AccessorPtr ptr, std::vector<AccessorPtr> ptrList)
|
||||
{
|
||||
assert(false); // TO DO
|
||||
}
|
||||
|
||||
GribStatus gribSectionAdjustSizes(int update, int depth)
|
||||
{
|
||||
assert(false); // TO DO
|
||||
|
||||
return GribStatus::NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
// C++ implementation of the functions in grib_accessor_class.cc that are not directly part of the C++ classes
|
||||
|
||||
#include "AccessorDefs.h"
|
||||
#include "AccessorData/AccessorInitData.h"
|
||||
#include "GribCpp/GribStatus.h"
|
||||
#include "GribStub/GribActionStub.h"
|
||||
|
||||
namespace eccodes::accessor {
|
||||
|
||||
|
@ -11,4 +13,8 @@ AccessorPtr parentOf(AccessorPtr ptr);
|
|||
|
||||
GribStatus gribGetBlockLength(AccessorPtr ptr, size_t& l);
|
||||
|
||||
AccessorPtr gribAccessorFactory(GribActionPtr creator, const long len, AccessorInitData initData);
|
||||
void gribPushAccessor(AccessorPtr ptr, std::vector<AccessorPtr> ptrList);
|
||||
GribStatus gribSectionAdjustSizes(int update, int depth);
|
||||
|
||||
}
|
||||
|
|
|
@ -376,4 +376,25 @@ GribStatus gribAccessorHasAttributes(AccessorPtr ptr)
|
|||
return GribStatus::NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
AccessorPtr gribAccessorClone(AccessorPtr ptr, int& err)
|
||||
{
|
||||
assert(false); // TO DO
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
AccessorPtr gribAccessorGetAttribute(AccessorPtr ptr, const std::string name)
|
||||
{
|
||||
assert(false); // TO DO
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::vector<AccessorPtr> gribAccessorsListLast(std::vector<AccessorPtr> ptrList)
|
||||
{
|
||||
assert(false); // TO DO
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -70,4 +70,7 @@ GribStatus gribAccessorReplaceAttribute(AccessorPtr ptr, AccessorPtr attr);
|
|||
GribStatus gribAccessorDeleteAttribute(AccessorPtr ptr, const std::string name);
|
||||
GribStatus gribAccessorHasAttributes(AccessorPtr ptr);
|
||||
|
||||
AccessorPtr gribAccessorClone(AccessorPtr ptr, int& err);
|
||||
AccessorPtr gribAccessorGetAttribute(AccessorPtr ptr, const std::string name);
|
||||
std::vector<AccessorPtr> gribAccessorsListLast(std::vector<AccessorPtr> ptrList);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
#pragma once
|
||||
|
||||
// C++ implementation of the existing grib_bits_fast_big_endian.cc
|
||||
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
namespace eccodes::accessor {
|
||||
|
||||
struct GribAction
|
||||
{
|
||||
std::string name_;
|
||||
std::string op_;
|
||||
std::string nameSpace_;
|
||||
unsigned long flags_;
|
||||
//char* defaultkey; /** name of the key used as default if not found */
|
||||
//grib_arguments* default_value; /** default expression as in .def file */
|
||||
//char* set;
|
||||
//char* debug_info; /** purely for debugging and tracing */
|
||||
};
|
||||
|
||||
using GribActionPtr = std::shared_ptr<GribAction>;
|
||||
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
#include "GribBufferStub.h"
|
||||
#include "Accessor.h"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
namespace eccodes::accessor {
|
||||
|
||||
void griBufferDelete(AccessorDataBuffer b)
|
||||
{
|
||||
assert(false);
|
||||
}
|
||||
|
||||
void gribBufferReplace(AccessorPtr ptr, AccessorDataBuffer data,
|
||||
size_t newsize, int update_lengths, int update_paddings)
|
||||
{
|
||||
assert(false);
|
||||
}
|
||||
|
||||
void gribBufferSetUlengthBits(AccessorDataBuffer b, size_t length_bits)
|
||||
{
|
||||
assert(false);
|
||||
}
|
||||
|
||||
AccessorDataBuffer gribCreateGrowableBuffer()
|
||||
{
|
||||
assert(false);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
#pragma once
|
||||
|
||||
// C++ implementation of the existing grib_bits_any_endian.cc
|
||||
|
||||
#include "AccessorDefs.h"
|
||||
#include "AccessorBuffer.h"
|
||||
|
||||
namespace eccodes::accessor {
|
||||
|
||||
void griBufferDelete(AccessorDataBuffer b);
|
||||
void gribBufferReplace(AccessorPtr ptr, AccessorDataBuffer data,
|
||||
size_t newsize, int updateLengths, int updatePaddings);
|
||||
void gribBufferSetUlengthBits(AccessorDataBuffer b, size_t lengthBits);
|
||||
AccessorDataBuffer gribCreateGrowableBuffer();
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
#include "GribDateStub.h"
|
||||
#include "Accessor.h"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
namespace eccodes::accessor {
|
||||
|
||||
long gribDateToJulian(long ddate)
|
||||
{
|
||||
assert(false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int gribDatetimeToJulian(long year, long month, long day,
|
||||
long hour, long minute, long second, double& jd)
|
||||
{
|
||||
assert(false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int gribDatetimeToJulianD(long year, long month, long day, long hour, long minute,
|
||||
double second, double& jd)
|
||||
{
|
||||
assert(false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//long grib_julian_to_date(long jdate);
|
||||
long gribJulianToDate(long jdate)
|
||||
{
|
||||
assert(false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int gribJulianToDatetime(double jd, long& year, long& month, long& day,
|
||||
long& hour, long& minute, long& second)
|
||||
{
|
||||
assert(false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
#pragma once
|
||||
|
||||
// C++ implementation of the existing grib_bits_any_endian.cc
|
||||
|
||||
#include "AccessorBuffer.h"
|
||||
|
||||
namespace eccodes::accessor {
|
||||
|
||||
long gribDateToJulian(long ddate);
|
||||
|
||||
int gribDatetimeToJulian(long year, long month, long day,
|
||||
long hour, long minute, long second, double& jd);
|
||||
|
||||
int gribDatetimeToJulianD(long year, long month, long day, long hour, long minute,
|
||||
double second, double& jd);
|
||||
|
||||
long gribJulianToDate(long jdate);
|
||||
|
||||
int gribJulianToDatetime(double jd, long& year, long& month, long& day,
|
||||
long& hour, long& minute, long& second);
|
||||
|
||||
}
|
|
@ -2,7 +2,11 @@
|
|||
|
||||
// All includes in one place, for convenience!
|
||||
#include "GribAccessorStub.h"
|
||||
#include "GribAccessorClassStub.h"
|
||||
#include "GribActionStub.h"
|
||||
#include "GribAccessorStub.h"
|
||||
#include "GribBitsAnyEndianStub.h"
|
||||
#include "GribBitsFastBigEndianStub.h"
|
||||
#include "GribBufferStub.h"
|
||||
#include "GribDateStub.h"
|
||||
#include "GribExpressionStub.h"
|
||||
#include "GribUtilStub.h"
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
#include "GribUtilStub.h"
|
||||
#include "GribCpp/GribValue.h"
|
||||
#include <cassert>
|
||||
|
||||
namespace eccodes::accessor {
|
||||
|
||||
GribStatus gribCheckDataValuesRange(const double minVal, const double maxVal)
|
||||
{
|
||||
assert(false);
|
||||
|
||||
return GribStatus::NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
bool gribIsEarthOblate()
|
||||
{
|
||||
long oblate{};
|
||||
GribStatus ret = gribGetLong(AccessorName("earthIsOblate"), oblate);
|
||||
|
||||
return (ret == GribStatus::SUCCESS && oblate == 1);
|
||||
}
|
||||
|
||||
bool gribProducingLargeConstantFields(int edition)
|
||||
{
|
||||
assert(false);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
GribStatus gribUtilGribDataQualityCheck(double minVal, double maxVal)
|
||||
{
|
||||
assert(false);
|
||||
|
||||
return GribStatus::NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
#pragma once
|
||||
|
||||
// C++ implementation of the existing grib_util.cc helpers
|
||||
#include "GribCpp/GribStatus.h"
|
||||
|
||||
namespace eccodes::accessor {
|
||||
|
||||
GribStatus gribCheckDataValuesRange(const double minVal, const double maxVal);
|
||||
bool gribIsEarthOblate();
|
||||
bool gribProducingLargeConstantFields(int edition);
|
||||
GribStatus gribUtilGribDataQualityCheck(double minVal, double maxVal);
|
||||
|
||||
}
|
Loading…
Reference in New Issue