-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbreakpoint_or.cpp
More file actions
44 lines (34 loc) · 664 Bytes
/
Copy pathbreakpoint_or.cpp
File metadata and controls
44 lines (34 loc) · 664 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "breakpoint_or.h"
#include "utils.h"
breakpoint_or::breakpoint_or(bus *const b, const std::vector<breakpoint *> & triggers, const bp_action action):
breakpoint(b, action),
triggers(triggers)
{
}
breakpoint_or::~breakpoint_or()
{
for(auto & bp: triggers)
delete bp;
}
std::optional<std::string> breakpoint_or::is_triggered() const
{
for(auto & t: triggers) {
auto rc = t->is_triggered();
if (rc.has_value())
return rc;
}
return { };
}
std::string breakpoint_or::emit() const
{
std::string out;
for(auto & t: triggers) {
if (out.empty())
out = "(";
else
out += " or ";
out += t->emit();
}
out += ")";
return out;
}