NOAA-OWP / ngen

Next Generation Water Modeling Engine and Framework Prototype
Other
84 stars 62 forks source link

Add `const` specifiers to various virtual member functions #849

Closed program-- closed 2 months ago

program-- commented 3 months ago

This PR adds const specifiers as applicable to classes associated with DataProvider<...>.

The primary reason for this change is to ensure const-correctness within the DataProvider class hierarchy, as there's no reason not to (at least no reasons that I can think of immediately).

Changes

const qualifies the following:

data_access::DataProvider + `get_available_variable_names` + `get_data_start_time` + `get_data_stop_time` + `record_duration` + `get_ts_index_for_time` + `is_property_sum_over_time_step`
realization::Formulation + `get_formulation_type` + `get_required_parameters`
realization::Catchment_Formulation + `get_output_header_line`
realization::Bmi_Formulation + `convert_model_time` + `get_bmi_input_variables` + `get_bmi_model_start_time_forcing_offset_s` + `get_bmi_output_variables` + `get_config_mapped_variable_name` + `get_model_current_time` + `get_model_end_time` + `get_model_type_name` + `is_bmi_input_variable` + `is_bmi_model_time_step_fixed` + `is_bmi_output_variable` + `is_model_initialized`

Checklist

PhilMiller commented 3 months ago

I think is_property_sum_over_time_step should also be const

PhilMiller commented 3 months ago

Re noexcept:

So, my take is that we should go ahead with adding const, and hold off on noexcept for now.

program-- commented 3 months ago

Re noexcept:

...

Yeah I agree. I forgot the extent of the DataProvider hierarchy (thankfully CI reminded me 😄), but I'm happy with only const being added.

PhilMiller commented 2 months ago

This all looks good, but I'm sick enough that I'm not going to press "merge" on anything myself today.