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 | e4f5dbe | 2020-10-19 07:19:33 -0500 | [diff] [blame] | 10 | iv_flags.reset(dfltBreakpoint); // default value is clear |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 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 | |
Ben Tyner | 72feadc | 2020-04-06 12:57:31 -0500 | [diff] [blame] | 25 | /** @brief Set all configuration flags */ |
| 26 | void Config::setFlagAll() |
| 27 | { |
| 28 | iv_flags.set(enVital); |
| 29 | iv_flags.set(enCheckstop); |
| 30 | iv_flags.set(enTerminate); |
| 31 | iv_flags.set(enBreakpoints); |
| 32 | } |
| 33 | |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 34 | /** @brief Clear configuration flag */ |
| 35 | void Config::clearFlag(AttentionFlag i_flag) |
| 36 | { |
| 37 | iv_flags.reset(i_flag); |
| 38 | } |
| 39 | |
Ben Tyner | 72feadc | 2020-04-06 12:57:31 -0500 | [diff] [blame] | 40 | /** @brief Clear all configuration flags */ |
| 41 | void Config::clearFlagAll() |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 42 | { |
Ben Tyner | 72feadc | 2020-04-06 12:57:31 -0500 | [diff] [blame] | 43 | iv_flags.reset(enVital); |
| 44 | iv_flags.reset(enCheckstop); |
| 45 | iv_flags.reset(enTerminate); |
| 46 | iv_flags.reset(enBreakpoints); |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 47 | } |
| 48 | |
| 49 | } // namespace attn |