bmcweb as a design goal should try to have no non-const global variables. Most of these variables can be thought of as general application state, and should be put in the App object. We used global variables initially because we didn't have access to modify the App object, as it was a template that individual callers didn't have access to without also being a template.
But times have changed, and that issue has been fixed, so we can now just directly call to and from app when making our requests. One such example of a non-const, nontrivial global variable is in the websocket monitor class:
|
static boost::container::flat_map<crow::websocket::Connection*, |
bmcweb as a design goal should try to have no non-const global variables. Most of these variables can be thought of as general application state, and should be put in the App object. We used global variables initially because we didn't have access to modify the App object, as it was a template that individual callers didn't have access to without also being a template.
But times have changed, and that issue has been fixed, so we can now just directly call to and from app when making our requests. One such example of a non-const, nontrivial global variable is in the websocket monitor class:
bmcweb/include/dbus_monitor.hpp
Line 25 in 65f7365