Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversion of expressions and arguments to C++ #271

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 23 additions & 17 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -310,22 +310,27 @@ list( APPEND eccodes_src_files
grib_dependency.cc
grib_value.cc
grib_errors.cc
grib_expression_class_binop.cc
grib_expression_class_logical_and.cc
grib_expression_class_logical_or.cc
grib_expression_class_is_in_dict.cc
grib_expression_class_true.cc
grib_expression_class_string_compare.cc
grib_expression_class_unop.cc
grib_expression_class_functor.cc
grib_expression_class_accessor.cc
grib_expression_class_is_in_list.cc
grib_expression_class_is_integer.cc
grib_expression_class_length.cc
grib_expression_class_long.cc
grib_expression_class_double.cc
grib_expression_class_string.cc
grib_expression_class_sub_string.cc

expression/grib_arguments.cc

expression/grib_expression.cc
expression/grib_expression_class_binop.cc
expression/grib_expression_class_logical_and.cc
expression/grib_expression_class_logical_or.cc
expression/grib_expression_class_is_in_dict.cc
expression/grib_expression_class_true.cc
expression/grib_expression_class_string_compare.cc
expression/grib_expression_class_unop.cc
expression/grib_expression_class_functor.cc
expression/grib_expression_class_accessor.cc
expression/grib_expression_class_is_in_list.cc
expression/grib_expression_class_is_integer.cc
expression/grib_expression_class_length.cc
expression/grib_expression_class_long.cc
expression/grib_expression_class_double.cc
expression/grib_expression_class_string.cc
expression/grib_expression_class_sub_string.cc

geo_nearest/grib_nearest.cc
geo_nearest/grib_nearest_class_gen.cc
geo_nearest/grib_nearest_class_healpix.cc
Expand All @@ -337,6 +342,7 @@ list( APPEND eccodes_src_files
geo_nearest/grib_nearest_class_reduced.cc
geo_nearest/grib_nearest_class_regular.cc
geo_nearest/grib_nearest_class_space_view.cc

geo_iterator/grib_iterator.cc
geo_iterator/grib_iterator_class_gaussian.cc
geo_iterator/grib_iterator_class_gaussian_reduced.cc
Expand All @@ -351,7 +357,7 @@ list( APPEND eccodes_src_files
geo_iterator/grib_iterator_class_regular.cc
geo_iterator/grib_iterator_class_space_view.cc
geo_iterator/grib_iterator_class_unstructured.cc
grib_expression.cc

codes_util.cc
grib_util.cc
bufr_util.cc
Expand Down
4 changes: 2 additions & 2 deletions src/accessor/grib_accessor_class_bit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ void grib_accessor_bit_t::init(const long len, grib_arguments* arg)
{
grib_accessor_long_t::init(len, arg);
length_ = 0;
owner_ = grib_arguments_get_name(grib_handle_of_accessor(this), arg, 0);
bit_index_ = grib_arguments_get_long(grib_handle_of_accessor(this), arg, 1);
owner_ = arg->get_name(grib_handle_of_accessor(this), 0);
bit_index_ = arg->get_long(grib_handle_of_accessor(this), 1);
}

int grib_accessor_bit_t::unpack_long(long* val, size_t* len)
Expand Down
8 changes: 4 additions & 4 deletions src/accessor/grib_accessor_class_bitmap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ void grib_accessor_bitmap_t::init(const long len, grib_arguments* arg)
grib_handle* hand = grib_handle_of_accessor(this);
int n = 0;

tableReference_ = grib_arguments_get_name(hand, arg, n++);
missing_value_ = grib_arguments_get_name(hand, arg, n++);
offsetbsec_ = grib_arguments_get_name(hand, arg, n++);
sLength_ = grib_arguments_get_name(hand, arg, n++);
tableReference_ = arg->get_name(hand, n++);
missing_value_ = arg->get_name(hand, n++);
offsetbsec_ = arg->get_name(hand, n++);
sLength_ = arg->get_name(hand, n++);

compute_size();
}
Expand Down
12 changes: 6 additions & 6 deletions src/accessor/grib_accessor_class_bits.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@ void grib_accessor_bits_t::init(const long l, grib_arguments* c)
int n = 0;
referenceValue_ = 0;

argument_ = grib_arguments_get_name(hand, c, n++);
start_ = grib_arguments_get_long(hand, c, n++);
len_ = grib_arguments_get_long(hand, c, n++);
e = grib_arguments_get_expression(hand, c, n++);
argument_ = c->get_name(hand, n++);
start_ = c->get_long(hand, n++);
len_ = c->get_long(hand, n++);
e = c->get_expression(hand, n++);
if (e) {
grib_expression_evaluate_double(hand, e, &(referenceValue_));
e->evaluate_double(hand, &(referenceValue_));
referenceValuePresent_ = 1;
}
else {
referenceValuePresent_ = 0;
}
scale_ = 1;
if (referenceValuePresent_) {
scale_ = grib_arguments_get_double(hand, c, n++);
scale_ = c->get_double(hand, n++);
}

Assert(len_ <= sizeof(long) * 8);
Expand Down
4 changes: 2 additions & 2 deletions src/accessor/grib_accessor_class_bits_per_value.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ void grib_accessor_bits_per_value_t::init(const long l, grib_arguments* args)
{
grib_accessor_long_t::init(l, args);
int n = 0;
values_ = grib_arguments_get_name(grib_handle_of_accessor(this), args, n++);
bits_per_value_ = grib_arguments_get_name(grib_handle_of_accessor(this), args, n++);
values_ = args->get_name(grib_handle_of_accessor(this), n++);
bits_per_value_ = args->get_name(grib_handle_of_accessor(this), n++);
flags_ |= GRIB_ACCESSOR_FLAG_FUNCTION;
length_ = 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/accessor/grib_accessor_class_blob.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ void grib_accessor_blob_t::init(const long len, grib_arguments* arg)
{
grib_accessor_gen_t::init(len, arg);
grib_get_long_internal(grib_handle_of_accessor(this),
grib_arguments_get_name(parent_->h, arg, 0), &length_);
arg->get_name(parent_->h, 0), &length_);
Assert(length_ >= 0);
}

Expand Down
6 changes: 3 additions & 3 deletions src/accessor/grib_accessor_class_budgdate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ void grib_accessor_budgdate_t::init(const long l, grib_arguments* c)
grib_accessor_long_t::init(l, c);
int n = 0;

year_ = grib_arguments_get_name(grib_handle_of_accessor(this), c, n++);
month_ = grib_arguments_get_name(grib_handle_of_accessor(this), c, n++);
day_ = grib_arguments_get_name(grib_handle_of_accessor(this), c, n++);
year_ = c->get_name(grib_handle_of_accessor(this), n++);
month_ = c->get_name(grib_handle_of_accessor(this), n++);
day_ = c->get_name(grib_handle_of_accessor(this), n++);
}

int grib_accessor_budgdate_t::unpack_long(long* val, size_t* len)
Expand Down
14 changes: 7 additions & 7 deletions src/accessor/grib_accessor_class_bufr_data_array.cc
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,13 @@ void grib_accessor_bufr_data_array_t::init(const long v, grib_arguments* params)
tempStrings_ = NULL;


bufrDataEncodedName_ = grib_arguments_get_name(grib_handle_of_accessor(this), params, n++);
numberOfSubsetsName_ = grib_arguments_get_name(grib_handle_of_accessor(this), params, n++);
expandedDescriptorsName_ = grib_arguments_get_name(grib_handle_of_accessor(this), params, n++);
flagsName_ = grib_arguments_get_name(grib_handle_of_accessor(this), params, n++);
elementsDescriptorsIndexName_ = grib_arguments_get_name(grib_handle_of_accessor(this), params, n++);
compressedDataName_ = grib_arguments_get_name(grib_handle_of_accessor(this), params, n++);
dataKeysName = grib_arguments_get_name(grib_handle_of_accessor(this), params, n++);
bufrDataEncodedName_ = params->get_name(grib_handle_of_accessor(this), n++);
numberOfSubsetsName_ = params->get_name(grib_handle_of_accessor(this), n++);
expandedDescriptorsName_ = params->get_name(grib_handle_of_accessor(this), n++);
flagsName_ = params->get_name(grib_handle_of_accessor(this), n++);
elementsDescriptorsIndexName_ = params->get_name(grib_handle_of_accessor(this), n++);
compressedDataName_ = params->get_name(grib_handle_of_accessor(this), n++);
dataKeysName = params->get_name(grib_handle_of_accessor(this), n++);

dataKeysAcc = grib_find_accessor(grib_handle_of_accessor(this), dataKeysName);
dataKeys_ = dataKeysAcc->parent_;
Expand Down
6 changes: 3 additions & 3 deletions src/accessor/grib_accessor_class_bufr_elements_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ void grib_accessor_bufr_elements_table_t::init(const long len, grib_arguments* p
grib_accessor_gen_t::init(len, params);
int n = 0;

dictionary_ = grib_arguments_get_string(grib_handle_of_accessor(this), params, n++);
masterDir_ = grib_arguments_get_name(grib_handle_of_accessor(this), params, n++);
localDir_ = grib_arguments_get_name(grib_handle_of_accessor(this), params, n++);
dictionary_ = params->get_string(grib_handle_of_accessor(this), n++);
masterDir_ = params->get_name(grib_handle_of_accessor(this), n++);
localDir_ = params->get_name(grib_handle_of_accessor(this), n++);

length_ = 0;
flags_ |= GRIB_ACCESSOR_FLAG_READ_ONLY;
Expand Down
20 changes: 10 additions & 10 deletions src/accessor/grib_accessor_class_bufr_extract_area_subsets.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ void grib_accessor_bufr_extract_area_subsets_t::init(const long len, grib_argume
int n = 0;

length_ = 0;
doExtractSubsets_ = grib_arguments_get_name(h, arg, n++);
numberOfSubsets_ = grib_arguments_get_name(h, arg, n++);
extractSubsetList_ = grib_arguments_get_name(h, arg, n++);
extractAreaWestLongitude_ = grib_arguments_get_name(h, arg, n++);
extractAreaEastLongitude_ = grib_arguments_get_name(h, arg, n++);
extractAreaNorthLatitude_ = grib_arguments_get_name(h, arg, n++);
extractAreaSouthLatitude_ = grib_arguments_get_name(h, arg, n++);
extractAreaLongitudeRank_ = grib_arguments_get_name(h, arg, n++);
extractAreaLatitudeRank_ = grib_arguments_get_name(h, arg, n++);
extractedAreaNumberOfSubsets_ = grib_arguments_get_name(h, arg, n++);
doExtractSubsets_ = arg->get_name(h, n++);
numberOfSubsets_ = arg->get_name(h, n++);
extractSubsetList_ = arg->get_name(h, n++);
extractAreaWestLongitude_ = arg->get_name(h, n++);
extractAreaEastLongitude_ = arg->get_name(h, n++);
extractAreaNorthLatitude_ = arg->get_name(h, n++);
extractAreaSouthLatitude_ = arg->get_name(h, n++);
extractAreaLongitudeRank_ = arg->get_name(h, n++);
extractAreaLatitudeRank_ = arg->get_name(h, n++);
extractedAreaNumberOfSubsets_ = arg->get_name(h, n++);

flags_ |= GRIB_ACCESSOR_FLAG_FUNCTION;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ void grib_accessor_bufr_extract_datetime_subsets_t::init(const long len, grib_ar
int n = 0;

length_ = 0;
doExtractSubsets_ = grib_arguments_get_name(grib_handle_of_accessor(this), arg, n++);
numberOfSubsets_ = grib_arguments_get_name(grib_handle_of_accessor(this), arg, n++);
extractSubsetList_ = grib_arguments_get_name(grib_handle_of_accessor(this), arg, n++);
doExtractSubsets_ = arg->get_name(grib_handle_of_accessor(this), n++);
numberOfSubsets_ = arg->get_name(grib_handle_of_accessor(this), n++);
extractSubsetList_ = arg->get_name(grib_handle_of_accessor(this), n++);

flags_ |= GRIB_ACCESSOR_FLAG_FUNCTION;
}
Expand Down
4 changes: 2 additions & 2 deletions src/accessor/grib_accessor_class_bufr_extract_subsets.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ void grib_accessor_bufr_extract_subsets_t::init(const long len, grib_arguments*
int n = 0;

length_ = 0;
numericValues_ = grib_arguments_get_name(grib_handle_of_accessor(this), arg, n++);
pack_ = grib_arguments_get_name(grib_handle_of_accessor(this), arg, n++);
numericValues_ = arg->get_name(grib_handle_of_accessor(this), n++);
pack_ = arg->get_name(grib_handle_of_accessor(this), n++);
flags_ |= GRIB_ACCESSOR_FLAG_FUNCTION;

numericValuesAccessor_ = NULL;
Expand Down
12 changes: 6 additions & 6 deletions src/accessor/grib_accessor_class_bufr_simple_thinning.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ void grib_accessor_bufr_simple_thinning_t::init(const long len, grib_arguments*
int n = 0;

length_ = 0;
doExtractSubsets_ = grib_arguments_get_name(h, arg, n++);
numberOfSubsets_ = grib_arguments_get_name(h, arg, n++);
extractSubsetList_ = grib_arguments_get_name(h, arg, n++);
simpleThinningStart_ = grib_arguments_get_name(h, arg, n++);
simpleThinningMissingRadius_ = grib_arguments_get_name(h, arg, n++);
simpleThinningSkip_ = grib_arguments_get_name(h, arg, n++);
doExtractSubsets_ = arg->get_name(h, n++);
numberOfSubsets_ = arg->get_name(h, n++);
extractSubsetList_ = arg->get_name(h, n++);
simpleThinningStart_ = arg->get_name(h, n++);
simpleThinningMissingRadius_ = arg->get_name(h, n++);
simpleThinningSkip_ = arg->get_name(h, n++);

flags_ |= GRIB_ACCESSOR_FLAG_FUNCTION;
}
Expand Down
2 changes: 1 addition & 1 deletion src/accessor/grib_accessor_class_bufr_string_values.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void grib_accessor_bufr_string_values_t::init(const long len, grib_arguments* ar
{
grib_accessor_ascii_t::init(len, args);
int n = 0;
dataAccessorName_ = grib_arguments_get_name(grib_handle_of_accessor(this), args, n++);
dataAccessorName_ = args->get_name(grib_handle_of_accessor(this), n++);
dataAccessor_ = NULL;
length_ = 0;
flags_ |= GRIB_ACCESSOR_FLAG_READ_ONLY;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ void grib_accessor_bufrdc_expanded_descriptors_t::init(const long len, grib_argu
{
grib_accessor_long_t::init(len, args);
int n = 0;
expandedDescriptors_ = grib_arguments_get_name(grib_handle_of_accessor(this), args, n++);
expandedDescriptors_ = args->get_name(grib_handle_of_accessor(this), n++);
expandedDescriptorsAccessor_ = 0;
length_ = 0;
flags_ |= GRIB_ACCESSOR_FLAG_READ_ONLY;
Expand Down
2 changes: 1 addition & 1 deletion src/accessor/grib_accessor_class_cf_var_name.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ void grib_accessor_cf_var_name_t::init(const long l, grib_arguments* arg)
{
grib_accessor_ascii_t::init(l, arg);
grib_handle* h = grib_handle_of_accessor(this);
defaultKey_ = grib_arguments_get_name(h, arg, 0);
defaultKey_ = arg->get_name(h, 0);
}

int grib_accessor_cf_var_name_t::unpack_string(char* val, size_t* len)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ void grib_accessor_change_alternative_row_scanning_t::init(const long len, grib_
grib_accessor_gen_t::init(len, args);
int n = 0;

values_ = grib_arguments_get_name(grib_handle_of_accessor(this), args, n++);
Ni_ = grib_arguments_get_name(grib_handle_of_accessor(this), args, n++);
Nj_ = grib_arguments_get_name(grib_handle_of_accessor(this), args, n++);
alternativeRowScanning_ = grib_arguments_get_name(grib_handle_of_accessor(this), args, n++);
values_ = args->get_name(grib_handle_of_accessor(this), n++);
Ni_ = args->get_name(grib_handle_of_accessor(this), n++);
Nj_ = args->get_name(grib_handle_of_accessor(this), n++);
alternativeRowScanning_ = args->get_name(grib_handle_of_accessor(this), n++);

flags_ |= GRIB_ACCESSOR_FLAG_FUNCTION;
length_ = 0;
Expand Down
16 changes: 8 additions & 8 deletions src/accessor/grib_accessor_class_change_scanning_direction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ void grib_accessor_change_scanning_direction_t::init(const long len, grib_argume
grib_handle* h = grib_handle_of_accessor(this);
int n = 0;

values_ = grib_arguments_get_name(h, args, n++);
Ni_ = grib_arguments_get_name(h, args, n++);
Nj_ = grib_arguments_get_name(h, args, n++);
i_scans_negatively_ = grib_arguments_get_name(h, args, n++);
j_scans_positively_ = grib_arguments_get_name(h, args, n++);
first_ = grib_arguments_get_name(h, args, n++);
last_ = grib_arguments_get_name(h, args, n++);
axis_ = grib_arguments_get_name(h, args, n++);
values_ = args->get_name(h, n++);
Ni_ = args->get_name(h, n++);
Nj_ = args->get_name(h, n++);
i_scans_negatively_ = args->get_name(h, n++);
j_scans_positively_ = args->get_name(h, n++);
first_ = args->get_name(h, n++);
last_ = args->get_name(h, n++);
axis_ = args->get_name(h, n++);

flags_ |= GRIB_ACCESSOR_FLAG_FUNCTION;
length_ = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/accessor/grib_accessor_class_check_internal_version.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void grib_accessor_check_internal_version_t::init(const long l, grib_arguments*
int err = 0;
long defs_file_version = 0;
grib_handle* h = grib_handle_of_accessor(this);
const char* s_defn_version = grib_arguments_get_name(h, args, 0);
const char* s_defn_version = args->get_name(h, 0);
Assert(s_defn_version);

err = grib_get_long_internal(h, s_defn_version, &defs_file_version);
Expand Down
18 changes: 9 additions & 9 deletions src/accessor/grib_accessor_class_closest_date.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ void grib_accessor_closest_date_t::init(const long l, grib_arguments* c)
grib_handle* h = grib_handle_of_accessor(this);
int n = 0;

dateLocal_ = grib_arguments_get_name(h, c, n++);
timeLocal_ = grib_arguments_get_name(h, c, n++);
numForecasts_ = grib_arguments_get_name(h, c, n++);
year_ = grib_arguments_get_name(h, c, n++);
month_ = grib_arguments_get_name(h, c, n++);
day_ = grib_arguments_get_name(h, c, n++);
hour_ = grib_arguments_get_name(h, c, n++);
minute_ = grib_arguments_get_name(h, c, n++);
second_ = grib_arguments_get_name(h, c, n++);
dateLocal_ = c->get_name(h, n++);
timeLocal_ = c->get_name(h, n++);
numForecasts_ = c->get_name(h, n++);
year_ = c->get_name(h, n++);
month_ = c->get_name(h, n++);
day_ = c->get_name(h, n++);
hour_ = c->get_name(h, n++);
minute_ = c->get_name(h, n++);
second_ = c->get_name(h, n++);

length_ = 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/accessor/grib_accessor_class_codeflag.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ void grib_accessor_codeflag_t::init(const long len, grib_arguments* param)
{
grib_accessor_unsigned_t::init(len, param);
length_ = len;
tablename_ = grib_arguments_get_string(grib_handle_of_accessor(this), param, 0);
tablename_ = param->get_string(grib_handle_of_accessor(this), 0);
Assert(length_ >= 0);
}

Expand Down
Loading
Loading