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 | fe15649 | 2021-04-08 07:28:13 -0500 | [diff] [blame] | 10 | iv_flags.reset(dfltTi); // 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); |
austinfcui | d28d5f8 | 2022-04-28 16:20:39 -0500 | [diff] [blame] | 32 | iv_flags.set(enClrAttnIntr); |
Ben Tyner | 72feadc | 2020-04-06 12:57:31 -0500 | [diff] [blame] | 33 | } |
| 34 | |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 35 | /** @brief Clear configuration flag */ |
| 36 | void Config::clearFlag(AttentionFlag i_flag) |
| 37 | { |
| 38 | iv_flags.reset(i_flag); |
| 39 | } |
| 40 | |
Ben Tyner | 72feadc | 2020-04-06 12:57:31 -0500 | [diff] [blame] | 41 | /** @brief Clear all configuration flags */ |
| 42 | void Config::clearFlagAll() |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 43 | { |
Ben Tyner | 72feadc | 2020-04-06 12:57:31 -0500 | [diff] [blame] | 44 | iv_flags.reset(enVital); |
| 45 | iv_flags.reset(enCheckstop); |
| 46 | iv_flags.reset(enTerminate); |
| 47 | iv_flags.reset(enBreakpoints); |
austinfcui | d28d5f8 | 2022-04-28 16:20:39 -0500 | [diff] [blame] | 48 | iv_flags.reset(enClrAttnIntr); |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 49 | } |
| 50 | |
| 51 | } // namespace attn |