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 */ |
Ben Tyner | 72feadc | 2020-04-06 12:57:31 -0500 | [diff] [blame] | 7 | Config::Config() |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 8 | { |
Ben Tyner | 72feadc | 2020-04-06 12:57:31 -0500 | [diff] [blame] | 9 | setFlagAll(); |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 10 | } |
| 11 | |
| 12 | /** @brief Get state of flag */ |
| 13 | bool Config::getFlag(AttentionFlag i_flag) const |
| 14 | { |
| 15 | return (iv_flags.test(i_flag)); |
| 16 | } |
| 17 | |
| 18 | /** @brief Set configuration flag */ |
| 19 | void Config::setFlag(AttentionFlag i_flag) |
| 20 | { |
| 21 | iv_flags.set(i_flag); |
| 22 | } |
| 23 | |
Ben Tyner | 72feadc | 2020-04-06 12:57:31 -0500 | [diff] [blame] | 24 | /** @brief Set all configuration flags */ |
| 25 | void Config::setFlagAll() |
| 26 | { |
| 27 | iv_flags.set(enVital); |
| 28 | iv_flags.set(enCheckstop); |
| 29 | iv_flags.set(enTerminate); |
| 30 | iv_flags.set(enBreakpoints); |
| 31 | } |
| 32 | |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 33 | /** @brief Clear configuration flag */ |
| 34 | void Config::clearFlag(AttentionFlag i_flag) |
| 35 | { |
| 36 | iv_flags.reset(i_flag); |
| 37 | } |
| 38 | |
Ben Tyner | 72feadc | 2020-04-06 12:57:31 -0500 | [diff] [blame] | 39 | /** @brief Clear all configuration flags */ |
| 40 | void Config::clearFlagAll() |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 41 | { |
Ben Tyner | 72feadc | 2020-04-06 12:57:31 -0500 | [diff] [blame] | 42 | iv_flags.reset(enVital); |
| 43 | iv_flags.reset(enCheckstop); |
| 44 | iv_flags.reset(enTerminate); |
| 45 | iv_flags.reset(enBreakpoints); |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 46 | } |
| 47 | |
| 48 | } // namespace attn |