-
Notifications
You must be signed in to change notification settings - Fork 14
Add templates for setters and getters; add temperature getter unit test for EnvState #464
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #464 +/- ##
==========================================
+ Coverage 91.04% 91.23% +0.19%
==========================================
Files 55 56 +1
Lines 2636 2591 -45
Branches 144 144
==========================================
- Hits 2400 2364 -36
+ Misses 163 154 -9
Partials 73 73 ☔ 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 |
Attempting to simplify code by introducing templates for setting and getting of attributes and derived values.