Ben Tyner | b481d90 | 2020-03-05 10:24:23 -0600 | [diff] [blame] | 1 | #include <attention.hpp> |
| 2 | |
| 3 | namespace attn |
| 4 | { |
| 5 | |
| 6 | /** @brief Main constructor. */ |
| 7 | Attention::Attention(AttentionType i_type, int (*i_handler)(Attention*), |
| 8 | pdbg_target* i_target, bool i_breakpoints) : |
| 9 | iv_type(i_type), |
| 10 | iv_handler(i_handler), iv_target(i_target) |
| 11 | |
| 12 | { |
| 13 | // set attention handler configuration flags |
| 14 | if (true == i_breakpoints) |
| 15 | { |
| 16 | iv_flags |= enableBreakpoints; |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | /** @brief Get attention priority */ |
| 21 | int Attention::getPriority() const |
| 22 | { |
| 23 | return iv_type; |
| 24 | } |
| 25 | |
| 26 | /** @brief Get configuration flags */ |
| 27 | uint32_t Attention::getFlags() const |
| 28 | { |
| 29 | return iv_flags; |
| 30 | } |
| 31 | |
| 32 | /** @brief Set configuration flags */ |
| 33 | void Attention::setFlags(uint32_t i_flags) |
| 34 | { |
| 35 | iv_flags = i_flags; |
| 36 | } |
| 37 | |
| 38 | /* @brief Call attention handler function */ |
| 39 | int Attention::handle() |
| 40 | { |
| 41 | return iv_handler(this); |
| 42 | } |
| 43 | |
| 44 | /** @brief less than operator */ |
| 45 | bool Attention::operator<(const Attention& right) const |
| 46 | { |
| 47 | return (getPriority() < right.getPriority()); |
| 48 | } |
| 49 | |
| 50 | } // namespace attn |