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 */ |
| 22 | Config() = delete; |
| 23 | |
| 24 | /** @brief Crate configuration object |
| 25 | * |
| 26 | * Create a configuration object to hold the attention handler |
| 27 | * configuration data |
| 28 | * |
| 29 | * @param i_vital Enable vital attention handling |
| 30 | * @param i_checkstop Enable checkstop attention handling |
| 31 | * @param i_terminate Enable TI attention handling |
| 32 | * @param i_+breakpoint Enable breakpoint attention handling |
| 33 | */ |
| 34 | Config(bool i_vital, bool i_checkstop, bool i_terminate, |
| 35 | bool i_breakpoints); |
| 36 | |
| 37 | /** @brief Default destructor */ |
| 38 | ~Config() = default; |
| 39 | |
| 40 | /** @brief Get state of flag */ |
| 41 | bool getFlag(AttentionFlag i_flag) const; |
| 42 | |
| 43 | /** @brief Set configuration flag */ |
| 44 | void setFlag(AttentionFlag i_flag); |
| 45 | |
| 46 | /** @brief Clear configuration flag */ |
| 47 | void clearFlag(AttentionFlag i_flag); |
| 48 | |
| 49 | /** @brief Set state of all configuration data */ |
| 50 | void setConfig(bool i_vital, bool i_checkstop, bool i_terminate, |
| 51 | bool i_breakpoints); |
| 52 | |
| 53 | private: |
| 54 | std::bitset<lastFlag> iv_flags; // configuration flags |
| 55 | }; |
| 56 | |
| 57 | } // namespace attn |