16#ifndef CPP_API_EXTENSIONS_SRC_SME_OVERLAYS_CALLBACK_OVERLAY_H
17#define CPP_API_EXTENSIONS_SRC_SME_OVERLAYS_CALLBACK_OVERLAY_H
36#include "sme/overlays/I_bank_element.hpp"
101 case stage::POST_READ:
105 case stage::PRE_WRITE:
109 case stage::POST_WRITE:
114 std::cerr <<
"[ERROR][get_rule_container]: Invalid stage for rule container! (" << _stage <<
")" << std::endl;
209 std::vector<uint64_t> ordered_arguments;
210 va_start(args, _name);
212 for (
int i = 0; i < 3; ++i) {
213 ordered_arguments.push_back(va_arg(args, uint64_t));
222 va_start( args, _name);
254 case type::RISING_BIT:
257 case type::FALLING_BIT:
266 case type::USER_DEFINED:
267 std::cerr <<
"[ERROR][add_rule]: User defined rules must use add_user_rule and prototype 'void func( uint64_t & _old, uint64_t & _new)'" << std::endl;
270 std::cerr <<
"[ERROR][add_rule]: Invalid stage for rule container! (" << _stage <<
")" << std::endl;
274 if (rules !=
nullptr && rule !=
nullptr) {
278 else if (rules ==
nullptr) {
309 case type::RISING_BIT:
310 case type::FALLING_BIT:
313 std::cerr <<
"[ERROR][add_rule]: Non user defined rules must use add rule and prototype 'void func()'" << std::endl;
315 case type::USER_DEFINED:
319 std::cerr <<
"[ERROR][__add_rule]: Invalid stage for rule container! (" << _stage <<
")" << std::endl;
323 if (rules !=
nullptr && rule !=
nullptr) {
327 else if (rules ==
nullptr) {
345 std::map< std::string, I_pattern_rule *> rule_map = _rule_container->
get_active_rules();
346 std::map< std::string, I_pattern_rule *>::iterator it;
347 for(it = rule_map.begin(); it != rule_map.end(); ++it) {
351 for(it = rule_map.begin(); it != rule_map.end(); ++it) {
#define _keep_hot
Definition: _inline.h:32
Interface and base class for all notification rule types.
Definition: I_pattern_rule.h:32
virtual void action(std::function< void()> _action)=0
Binds a void(void) lambda as the callback action to this rule.
class which houses all four rule containers, only allocated if utilized.
Definition: callback_overlay.h:45
callback_overlay()
Construct a new callback overlay object.
Definition: callback_overlay.h:51
pattern_rule_container * m_post_read
post_read rule container (ptr).
Definition: callback_overlay.h:367
_keep_hot I_pattern_rule * __add_rule(std::function< void()> _func, stage::E _stage, type::E _type, std::string _name, std::vector< uint64_t > &_ordered_args)
real implementation of add a rule to this entity (decompressed va_list).
Definition: callback_overlay.h:239
void delete_rules_from_container(pattern_rule_container *_rule_container)
Free the memory from the rules within the rule container.
Definition: callback_overlay.h:343
~callback_overlay()
Destroy the callback overlay object.
Definition: callback_overlay.h:62
I_pattern_rule * add_rule(std::function< void()> _func, stage::E _stage, type::E _type, std::string _name,...)
add a rule to this entity.
Definition: callback_overlay.h:207
void process_pre_write_rules(uint64_t _old_value, uint64_t _new_value)
processes pre_write_rules.
Definition: callback_overlay.h:176
pattern_rule_container * m_pre_write
pre_write rule container (ptr).
Definition: callback_overlay.h:373
void deactivate_rule(stage::E _stage, std::string _name)
deactivates rule by name at stage.
Definition: callback_overlay.h:126
void process_post_write_rules(uint64_t _old_value, uint64_t _new_value)
processes post_write_rules.
Definition: callback_overlay.h:188
pattern_rule_container * get_rule_container(stage::E _stage)
Get the rule container object.
Definition: callback_overlay.h:95
_keep_hot I_pattern_rule * __add_rule(std::function< void(uint64_t, uint64_t)> _func, stage::E _stage, type::E _type, std::string _name, va_list &args)
real implementation of add a rule to this entity (decompressed va_list).
Definition: callback_overlay.h:299
void process_pre_read_rules(uint64_t _old_value, uint64_t _new_value)
processes pre_read_rules.
Definition: callback_overlay.h:152
pattern_rule_container * m_pre_read
pre_read rule container (ptr).
Definition: callback_overlay.h:361
void process_post_read_rules(uint64_t _old_value, uint64_t _new_value)
processes post_read_rules.
Definition: callback_overlay.h:164
void activate_rule(stage::E _stage, std::string _name)
activates rule by name at stage.
Definition: callback_overlay.h:139
pattern_rule_container * m_post_write
post_write rule container (ptr).
Definition: callback_overlay.h:379
I_pattern_rule * add_user_rule(std::function< void(uint64_t, uint64_t)> _func, stage::E _stage, std::string _name,...)
Definition: callback_overlay.h:220
tracks all rules of a single type for a particular target.
Definition: pattern_rule_container.h:38
void activate_rule(std::string _name)
activate rule by name.
Definition: pattern_rule_container.h:107
const std::map< std::string, I_pattern_rule * > & get_inactive_rules() const
return const reference to 'inactive' string map of pattern rules.
Definition: pattern_rule_container.h:194
bool add_rule(std::string _name, I_pattern_rule *_rule, bool _active=true)
Adds a descendant of I_pattern_rule by name to this container.
Definition: pattern_rule_container.h:64
void deactivate_rule(std::string _name)
deactivate rule by name.
Definition: pattern_rule_container.h:87
void process_active_rules(uint64_t _old_value, uint64_t _new_value)
processes all active rules.
Definition: pattern_rule_container.h:128
const std::map< std::string, I_pattern_rule * > & get_active_rules() const
return const reference to 'active' string map of pattern rules.
Definition: pattern_rule_container.h:185
rule specifically to monitor a single bit for falling edge.
Definition: falling_bit.h:32
rule specifically to monitor the edge when all bits in the register have fallen.
Definition: falling.h:33
rule executes if anything "masked" changes between the old and new value.
Definition: masked.h:31
Basic rule executes with access (no change required).
Definition: notify.h:31
rule executes if the masked pattern matches the start (old) and end (new) values.
Definition: pattern.h:32
rule specifically to monitor a single bit for rising edge.
Definition: rising_bit.h:32
rule specifically to monitor the edge when any bit in the register is first to rise.
Definition: rising.h:33
Basic rule executes with access (no change required).
Definition: user_defined.h:31
Definition: expression_vector.h:25