Add templates for setters and getters; add temperature getter unit test for EnvState#464
Add templates for setters and getters; add temperature getter unit test for EnvState#464
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #464 +/- ##
==========================================
+ Coverage 91.04% 91.92% +0.87%
==========================================
Files 55 56 +1
Lines 2636 2564 -72
Branches 144 144
==========================================
- Hits 2400 2357 -43
+ Misses 163 132 -31
- Partials 73 75 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Maybe it would be beneficial to "abstract" the templates even more? namespace pypartmc { // possible namespace to avoid name conflicts
template <typename T, typename SelfType, typename Func>
inline T get_value(const SelfType &self, Func func) { // inline to keep it header-only
T value{};
func(self.ptr.f_arg(), &value);
return value;
}
template <typename T, typename SelfType, typename Func>
inline void set_value(SelfType &self, Func func, T value) {
func(self.ptr.f_arg_non_const(), &value);
}
}And an example call would look like: static auto get_height(const EnvState &self) {
return pypartmc::get_value<double>(self, f_env_state_get_height);
}The same could be considered for |
|
@jcurtis2, CI is now fixed here. Codecov detects two missing lines, which are a bit puzzling, but potentially seem to be a pair of important misses:
and
|


Attempting to simplify code by introducing templates for setting and getting of attributes and derived values.