blob: caee221a2fee4179c0bd95999b29418ad3e55b0d [file] [log] [blame]
Ben Tyner3fb52e52020-03-31 10:10:07 -05001#include <attn/attn_config.hpp>
2
3namespace attn
4{
5
6/** @brief Main constructor */
7Config::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 */
14bool Config::getFlag(AttentionFlag i_flag) const
15{
16 return (iv_flags.test(i_flag));
17}
18
19/** @brief Set configuration flag */
20void Config::setFlag(AttentionFlag i_flag)
21{
22 iv_flags.set(i_flag);
23}
24
25/** @brief Clear configuration flag */
26void Config::clearFlag(AttentionFlag i_flag)
27{
28 iv_flags.reset(i_flag);
29}
30
31/** @brief Set state of all configuration data */
32void 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