blob: c13bf64d4d6f0369914ada43f045ed016f53bd28 [file] [log] [blame]
Ben Tynerb481d902020-03-05 10:24:23 -06001#include <attention.hpp>
2
3namespace attn
4{
5
6/** @brief Main constructor. */
7Attention::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 */
21int Attention::getPriority() const
22{
23 return iv_type;
24}
25
26/** @brief Get configuration flags */
27uint32_t Attention::getFlags() const
28{
29 return iv_flags;
30}
31
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
44/** @brief less than operator */
45bool Attention::operator<(const Attention& right) const
46{
47 return (getPriority() < right.getPriority());
48}
49
50} // namespace attn