Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | #include <bitset> |
| 3 | |
| 4 | namespace attn |
| 5 | { |
| 6 | |
| 7 | /** @brief configuration flags */ |
| 8 | enum AttentionFlag |
| 9 | { |
| 10 | enVital = 0, |
| 11 | enCheckstop = 1, |
| 12 | enTerminate = 2, |
| 13 | enBreakpoints = 3, |
| 14 | lastFlag |
| 15 | }; |
| 16 | |
| 17 | /** @brief Objhects to hold configuration data */ |
| 18 | class Config |
| 19 | { |
| 20 | public: // methods |
| 21 | /** @brief Default constructor */ |
Ben Tyner | 72feadc | 2020-04-06 12:57:31 -0500 | [diff] [blame] | 22 | Config(); |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 23 | |
| 24 | /** @brief Default destructor */ |
| 25 | ~Config() = default; |
| 26 | |
| 27 | /** @brief Get state of flag */ |
| 28 | bool getFlag(AttentionFlag i_flag) const; |
| 29 | |
| 30 | /** @brief Set configuration flag */ |
| 31 | void setFlag(AttentionFlag i_flag); |
| 32 | |
Ben Tyner | 72feadc | 2020-04-06 12:57:31 -0500 | [diff] [blame] | 33 | /** @brief Set all configuration flags */ |
| 34 | void setFlagAll(); |
| 35 | |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 36 | /** @brief Clear configuration flag */ |
| 37 | void clearFlag(AttentionFlag i_flag); |
| 38 | |
Ben Tyner | 72feadc | 2020-04-06 12:57:31 -0500 | [diff] [blame] | 39 | /** @brief Clear all configuration flags */ |
| 40 | void clearFlagAll(); |
| 41 | |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 42 | /** @brief Set state of all configuration data */ |
| 43 | void setConfig(bool i_vital, bool i_checkstop, bool i_terminate, |
| 44 | bool i_breakpoints); |
| 45 | |
| 46 | private: |
| 47 | std::bitset<lastFlag> iv_flags; // configuration flags |
| 48 | }; |
| 49 | |
| 50 | } // namespace attn |