]>
Commit | Line | Data |
---|---|---|
51ea0904 CT |
1 | /* |
2 | * $Id$ | |
3 | * | |
4 | * DEBUG: section 54 Interprocess Communication | |
5 | * | |
6 | */ | |
7 | ||
8 | #ifndef SQUID_IPC_RESPONSE_H | |
9 | #define SQUID_IPC_RESPONSE_H | |
10 | ||
11 | #include "ipc/forward.h" | |
12 | #include "RefCount.h" | |
13 | ||
51ea0904 CT |
14 | namespace Ipc |
15 | { | |
16 | ||
17 | /// A response to Ipc::Request. | |
18 | class Response: public RefCountable | |
19 | { | |
20 | public: | |
21 | typedef RefCount<Response> Pointer; | |
22 | ||
23 | public: | |
24 | explicit Response(unsigned int aRequestId): | |
8fb5a96c | 25 | requestId(aRequestId) {} |
51ea0904 CT |
26 | |
27 | virtual void pack(TypedMsgHdr& msg) const = 0; ///< prepare for sendmsg() | |
28 | virtual Pointer clone() const = 0; ///< returns a copy of this | |
29 | ||
30 | private: | |
31 | Response(const Response&); // not implemented | |
32 | Response& operator= (const Response&); // not implemented | |
33 | ||
34 | public: | |
35 | unsigned int requestId; ///< ID of request we are responding to | |
36 | }; | |
37 | ||
f738d783 CT |
38 | inline |
39 | std::ostream& operator << (std::ostream &os, const Response& response) | |
40 | { | |
41 | os << "[response.requestId %u]" << response.requestId << '}'; | |
42 | return os; | |
43 | } | |
44 | ||
51ea0904 CT |
45 | } // namespace Ipc |
46 | ||
47 | #endif /* SQUID_IPC_RESPONSE_H */ |