-
Notifications
You must be signed in to change notification settings - Fork 11
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
eliminate global variables #3
Comments
It turns out to be a lot of hassles to initialize and pass around the local version of this loglevel flag due to its universal usage among every classes defined in |
Maybe a naive question, but wouldn't a conditional definition using the preprocessor work? |
I am not sure if that will allow user to switch on/off the log at runtime |
For now, I defined a macro as |
@gfinak , |
Yes, makes sense. Thanks for the clarification. |
There are currently two global variables used by
cytolib
(mainly for troubleshooting purpose)https://github.com/RGLab/cytolib/blob/trunk/inst/include/cytolib/global.hpp#L30-L31
extern
keyword indicates they are only the variable declaration instead of definition. Because due to the nature ofheader-only
,cytolib
can't define them in any header in order to avoidmulti-definition
compiling errors (when header is included multiple times).Therefore it implicitly requires the
cytolib
users to define it somewhere in the user code in order forcytolib
function, even if they don't necessarily need to care about this log feature.We shouldn't force user to do this (besides it is not best practice to use global variable). Instead, we can move them into
GatingSet
class and initialize/change their values either throughparseWorkspace
call or throughsetter
methods onceGatingSet
is created.The text was updated successfully, but these errors were encountered: