-
Notifications
You must be signed in to change notification settings - Fork 56
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
C++ modules should start using setters and getters #715
Comments
@juan-g-bonilla , I just pushed my setter/getter branch to Or, can we expand the |
I see the issue now. The thing is that because we are using raw C arrays, we need to return them from functions as pointers:
but then SWIG does not have enough information to transform that into a Python type (because it doesn't know the length of the data). There is really no way to return something like this in C++:
So we would need to use a more information rich type. I've added some commits with a switch to using Changing from C arrays to |
Thanks for the support @juan-g-bonilla . I pulled your commits to my branch and will review and integrated. I like the new combined |
Describe your use case
C++ Basilisk modules sometimes have user configurable variable
foo
defined as a public variable set, and thus set throughSome modules use setters and getters where the module variable is set using
Describe alternatives solutions you've considered
Going forward we should have all new C++ Basilisk module variables be private and user setter and
getter methods. The setter method should check if the variable is being given valid number(s). Required variables
can still be checked in the module
Reset()
method. This way the python code with throw an immediate error if avariable is set to an invalid value.
Further, if the use of a variable is being depreciated, the associated setter and getter methods can be gracefully
depreciated. If the variables are public class variables, there is now way to catch all the ways this variable could be set.
Additional context
All the instructions need to be updated to discuss using setters and getters in C++ modules, the
makeDraftModule.py
script needs to be updated, the C++ template modules need updating. Further, with private variables it the regular
module variable logger cannot be used. Documentation needs to be updated on how to log a private class variable.
The text was updated successfully, but these errors were encountered: