OLD | NEW |
1 #ifndef COMMUNICATION_H | 1 #ifndef COMMUNICATION_H |
2 #define COMMUNICATION_H | 2 #define COMMUNICATION_H |
3 | 3 |
4 #include <memory> | 4 #include <memory> |
5 #include <sstream> | 5 #include <sstream> |
6 #include <stdexcept> | 6 #include <stdexcept> |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 #include <Windows.h> | 10 #include <Windows.h> |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 throw new std::runtime_error("Unexpected error writing to output buffer"
); | 134 throw new std::runtime_error("Unexpected error writing to output buffer"
); |
135 } | 135 } |
136 }; | 136 }; |
137 | 137 |
138 class PipeConnectionError : public std::runtime_error | 138 class PipeConnectionError : public std::runtime_error |
139 { | 139 { |
140 public: | 140 public: |
141 PipeConnectionError(); | 141 PipeConnectionError(); |
142 }; | 142 }; |
143 | 143 |
| 144 class PipeBusyError : public std::runtime_error |
| 145 { |
| 146 public: |
| 147 PipeBusyError(); |
| 148 }; |
| 149 |
144 class Pipe | 150 class Pipe |
145 { | 151 { |
146 public: | 152 public: |
147 enum Mode {MODE_CREATE, MODE_CONNECT}; | 153 enum Mode {MODE_CREATE, MODE_CONNECT}; |
148 | 154 |
149 Pipe(const std::wstring& name, Mode mode); | 155 Pipe(const std::wstring& name, Mode mode); |
150 ~Pipe(); | 156 ~Pipe(); |
151 | 157 |
152 InputBuffer ReadMessage(); | 158 InputBuffer ReadMessage(); |
153 void WriteMessage(OutputBuffer& message); | 159 void WriteMessage(OutputBuffer& message); |
154 | 160 |
155 protected: | 161 protected: |
156 HANDLE pipe; | 162 HANDLE pipe; |
157 }; | 163 }; |
158 } | 164 } |
159 | 165 |
160 #endif | 166 #endif |
OLD | NEW |