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