Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 1 | #include <attn/attn_config.hpp> |
| 2 | |
| 3 | namespace attn |
| 4 | { |
| 5 | |
| 6 | /** @brief Main constructor */ |
| 7 | Config::Config(bool i_vital, bool i_checkstop, bool i_terminate, |
| 8 | bool i_breakpoints) |
| 9 | { |
| 10 | setConfig(i_vital, i_checkstop, i_terminate, i_breakpoints); |
| 11 | } |
| 12 | |
| 13 | /** @brief Get state of flag */ |
| 14 | bool Config::getFlag(AttentionFlag i_flag) const |
| 15 | { |
| 16 | return (iv_flags.test(i_flag)); |
| 17 | } |
| 18 | |
| 19 | /** @brief Set configuration flag */ |
| 20 | void Config::setFlag(AttentionFlag i_flag) |
| 21 | { |
| 22 | iv_flags.set(i_flag); |
| 23 | } |
| 24 | |
| 25 | /** @brief Clear configuration flag */ |
| 26 | void Config::clearFlag(AttentionFlag i_flag) |
| 27 | { |
| 28 | iv_flags.reset(i_flag); |
| 29 | } |
| 30 | |
| 31 | /** @brief Set state of all configuration data */ |
| 32 | void Config::setConfig(bool i_vital, bool i_checkstop, bool i_terminate, |
| 33 | bool i_breakpoints) |
| 34 | { |
| 35 | (true == i_vital) ? iv_flags.set(enVital) : iv_flags.reset(enVital); |
| 36 | |
| 37 | (true == i_checkstop) ? iv_flags.set(enCheckstop) |
| 38 | : iv_flags.reset(enCheckstop); |
| 39 | |
| 40 | (true == i_terminate) ? iv_flags.set(enTerminate) |
| 41 | : iv_flags.reset(enTerminate); |
| 42 | |
| 43 | (true == i_breakpoints) ? iv_flags.set(enBreakpoints) |
| 44 | : iv_flags.reset(enBreakpoints); |
| 45 | } |
| 46 | |
| 47 | } // namespace attn |