]> git.ipfire.org Git - thirdparty/squid.git/blame - src/ipc/Response.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / ipc / Response.h
CommitLineData
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
14namespace Ipc
15{
16
17/// A response to Ipc::Request.
18class Response: public RefCountable
19{
20public:
21 typedef RefCount<Response> Pointer;
22
23public:
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
30private:
31 Response(const Response&); // not implemented
32 Response& operator= (const Response&); // not implemented
33
34public:
35 unsigned int requestId; ///< ID of request we are responding to
36};
37
f738d783
CT
38inline
39std::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 */