C++ Device API Reference Manual
Reference documentation for the Simics C++ Device API.
 
Loading...
Searching...
No Matches
pattern.h
Go to the documentation of this file.
1/*
2 © 2023 Intel Corporation
3
4 This software and the related documents are Intel copyrighted materials, and
5 your use of them is governed by the express license under which they were
6 provided to you ("License"). Unless the License provides otherwise, you may
7 not use, modify, copy, publish, distribute, disclose or transmit this software
8 or the related documents without Intel's prior written permission.
9
10 This software and the related documents are provided as is, with no express or
11 implied warranties, other than those that are expressly stated in the License.
12*/
13
14// -*- C++ -*-
15
16#ifndef CPP_API_EXTENSIONS_SRC_SME_PATTERN_RULES_PATTERN_H
17#define CPP_API_EXTENSIONS_SRC_SME_PATTERN_RULES_PATTERN_H
18
20#include <iostream>
21#include <ios>
22namespace sme {
23
24 namespace rules {
25
30 class pattern : public I_pattern_rule
31 {
32 public:
33
38 uint64_t m_mask;
39
44 uint64_t m_start;
45
50 uint64_t m_end;
51
59 pattern( uint64_t _mask, uint64_t _start, uint64_t _end)
61 , m_mask( _mask)
62 , m_start( _start)
63 , m_end( _end)
64 {
65 }
66
71 virtual ~pattern() {;}
72
79 virtual void process_rule( uint64_t _old_value, uint64_t & _new_value) {
80 if( is_active() && is_bound() && ( ( _old_value & m_mask) == m_start) && ( ( _new_value & m_mask) == m_end) ) {
81 m_lambda();
82 }
83 }
84 };
85
86 }
87
88}
89
90#endif /*NOTIFICATION_RULE_PATTERN_H_*/
Interface and base class for all notification rule types.
Definition: I_pattern_rule.h:32
_always_inline bool is_active()
reports if rule is active for processing.
Definition: I_pattern_rule.h:78
std::function< void()> m_lambda
placeholder for lambda
Definition: I_pattern_rule.h:38
_always_inline bool is_bound()
has the lambda callback been bound.
Definition: I_pattern_rule.h:85
rule executes if the masked pattern matches the start (old) and end (new) values.
Definition: pattern.h:31
uint64_t m_mask
mask to apply for rule evaluation.
Definition: pattern.h:38
uint64_t m_start
initial value to match with mask.
Definition: pattern.h:44
pattern(uint64_t _mask, uint64_t _start, uint64_t _end)
Construct a new pattern object.
Definition: pattern.h:59
virtual ~pattern()
Destroy the pattern object.
Definition: pattern.h:71
virtual void process_rule(uint64_t _old_value, uint64_t &_new_value)
process rule evaluation between old and new values.
Definition: pattern.h:79
uint64_t m_end
new value to match with mask.
Definition: pattern.h:50
Definition: expression_vector.h:25