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