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