-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbreakpoint_and.cpp
More file actions
48 lines (36 loc) · 751 Bytes
/
breakpoint_and.cpp
File metadata and controls
48 lines (36 loc) · 751 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
45
46
47
48
#include "breakpoint_and.h"
#include "utils.h"
breakpoint_and::breakpoint_and(bus *const b, const std::vector<breakpoint *> & triggers, const bp_action action):
breakpoint(b, action),
triggers(triggers)
{
}
breakpoint_and::~breakpoint_and()
{
for(auto & bp: triggers)
delete bp;
}
std::optional<std::string> breakpoint_and::is_triggered() const
{
std::string out;
for(auto & t: triggers) {
auto rc = t->is_triggered();
if (rc.has_value() == false)
return { };
out += (out.empty() ? "" : ", ") + rc.value();
}
return out;
}
std::string breakpoint_and::emit() const
{
std::string out;
for(auto & t: triggers) {
if (out.empty())
out = "(";
else
out += " and ";
out += t->emit();
}
out += ")";
return out;
}