Component manager
| 34 | |
| 35 | // Component manager |
| 36 | class workspace { |
| 37 | public: |
| 38 | class bid { |
| 39 | workbranch* base = nullptr; |
| 40 | friend class workspace; |
| 41 | |
| 42 | public: |
| 43 | bid(workbranch* b) |
| 44 | : base(b) { |
| 45 | } |
| 46 | |
| 47 | bool operator==(const bid& other) { |
| 48 | return base == other.base; |
| 49 | } |
| 50 | bool operator!=(const bid& other) { |
| 51 | return base != other.base; |
| 52 | } |
| 53 | bool operator<(const bid& other) { |
| 54 | return base < other.base; |
| 55 | } |
| 56 | friend std::ostream& operator<<(std::ostream& os, const bid& id) { |
| 57 | os << (uint64_t)(id.base); |
| 58 | return os; |
| 59 | } |
| 60 | }; |
| 61 | class sid { |
| 62 | supervisor* base = nullptr; |
| 63 | friend class workspace; |
| 64 | |
| 65 | public: |
| 66 | sid(supervisor* b) |
| 67 | : base(b) { |
| 68 | } |
| 69 | |
| 70 | bool operator==(const sid& other) { |
| 71 | return base == other.base; |
| 72 | } |
| 73 | bool operator!=(const sid& other) { |
| 74 | return base != other.base; |
| 75 | } |
| 76 | bool operator<(const sid& other) { |
| 77 | return base < other.base; |
| 78 | } |
| 79 | friend std::ostream& operator<<(std::ostream& os, const sid& id) { |
| 80 | os << (uint64_t)(id.base); |
| 81 | return os; |
| 82 | } |
| 83 | }; |
| 84 | |
| 85 | private: |
| 86 | using branch_lst = std::list<std::unique_ptr<workbranch>>; |
| 87 | using superv_map = std::map<const supervisor*, std::unique_ptr<supervisor>>; |
| 88 | using pos_t = branch_lst::iterator; |
| 89 | |
| 90 | pos_t cur = {}; |
| 91 | branch_lst branches; |
| 92 | superv_map supervs; |
| 93 |