blob: 0806ef2f7ff808272012c70001f88d383a2eea76 [file] [log] [blame]
Ben Tynerb481d902020-03-05 10:24:23 -06001#include <attention.hpp>
Ben Tyner3fb52e52020-03-31 10:10:07 -05002#include <attn_config.hpp>
Ben Tynerb481d902020-03-05 10:24:23 -06003
4namespace attn
5{
6
7/** @brief Main constructor. */
8Attention::Attention(AttentionType i_type, int (*i_handler)(Attention*),
Ben Tyner3fb52e52020-03-31 10:10:07 -05009 pdbg_target* i_target, Config* i_config) :
Ben Tynerb481d902020-03-05 10:24:23 -060010 iv_type(i_type),
Ben Tyner3fb52e52020-03-31 10:10:07 -050011 iv_handler(i_handler), iv_target(i_target), iv_config(i_config)
Ben Tynerb481d902020-03-05 10:24:23 -060012
Ben Tyner3fb52e52020-03-31 10:10:07 -050013{}
Ben Tynerb481d902020-03-05 10:24:23 -060014
15/** @brief Get attention priority */
16int Attention::getPriority() const
17{
18 return iv_type;
19}
20
Ben Tyner3fb52e52020-03-31 10:10:07 -050021/* @brief Get config object */
22Config* Attention::getConfig() const
Ben Tynerb481d902020-03-05 10:24:23 -060023{
Ben Tyner3fb52e52020-03-31 10:10:07 -050024 return iv_config;
Ben Tynerb481d902020-03-05 10:24:23 -060025}
26
27/* @brief Call attention handler function */
28int Attention::handle()
29{
30 return iv_handler(this);
31}
32
Ben Tyner3fb52e52020-03-31 10:10:07 -050033/** @brief less than operator, for heap creation */
Ben Tynerb481d902020-03-05 10:24:23 -060034bool Attention::operator<(const Attention& right) const
35{
36 return (getPriority() < right.getPriority());
37}
38
39} // namespace attn