Began removal of platform/. The Monitor:: namespace is completely converted.
[aesalon.git] / src / monitor / ptrace / Breakpoint.h
blob63f19789ad4b941a0a9538d64af6e4a56b0cea75
1 #ifndef AESALON_MONITOR_BREAKPOINT_H
2 #define AESALON_MONITOR_BREAKPOINT_H
4 #include <set>
5 #include <vector>
7 #include "Types.h"
8 #include "BreakpointObserver.h"
10 namespace Aesalon {
11 namespace Monitor {
12 namespace PTrace {
14 class Breakpoint {
15 protected:
16 typedef std::set<Misc::SmartPointer<BreakpointObserver> > observer_list_t;
17 private:
18 Word address;
19 Byte original;
20 const Byte BREAKPOINT_CHARACTER;
21 std::size_t id;
22 bool valid;
24 observer_list_t observer_list;
25 public:
26 Breakpoint(Word address, Byte original);
27 virtual ~Breakpoint() {}
29 std::size_t get_id() const { return id; }
30 Byte get_original() const { return original; }
31 Word get_address() const { return address; }
32 Byte get_breakpoint_character() const { return BREAKPOINT_CHARACTER; }
34 bool is_valid() const { return valid; }
35 void set_valid(bool new_validity) { valid = new_validity; }
37 void add_observer(Misc::SmartPointer<BreakpointObserver> observer)
38 { observer_list.insert(observer); this->set_valid(true); }
39 void remove_observer(Misc::SmartPointer<BreakpointObserver> observer) {
40 observer_list_t::iterator i = observer_list.find(observer);
41 if(i != observer_list.end()) observer_list.erase(i);
42 if(observer_list.size() == 0) this->set_valid(false);
45 void notify();
48 } // namespace PTrace
49 } // namespace Monitor
50 } // namespace Aesalon
52 #endif