RequestId.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2025 The Squid Software Foundation and contributors
3  *
4  * Squid software is distributed under GPLv2+ license and includes
5  * contributions from numerous individuals and organizations.
6  * Please see the COPYING and CONTRIBUTORS files for details.
7  */
8 
9 #ifndef SQUID_SRC_IPC_REQUESTID_H
10 #define SQUID_SRC_IPC_REQUESTID_H
11 
12 #include "ipc/forward.h"
13 #include "ipc/QuestionerId.h"
14 
15 #include <iosfwd>
16 
17 namespace Ipc
18 {
19 
22 class RequestId
23 {
24 public:
27  typedef unsigned int Index;
28 
31  explicit RequestId(Index);
32 
34  RequestId() = default;
35 
38  void reset() { index_ = 0; }
39 
42  void reset(const Index anIndex) { *this = RequestId(anIndex); }
43 
44  QuestionerId questioner() const { return qid_; }
45  Index index() const { return index_; }
46 
47  // these conversion operators allow our users to treat us as an Index
48  operator Index() const { return index_; }
49  RequestId &operator =(const Index anIndex) { anIndex ? reset(anIndex) : reset(); return *this; }
50 
51 private:
54 
57 };
58 
59 std::ostream &operator <<(std::ostream &, const RequestId &);
60 
61 } // namespace Ipc;
62 
63 #endif /* SQUID_SRC_IPC_REQUESTID_H */
64 
void reset(const Index anIndex)
Definition: RequestId.h:42
Index index_
request ID; unique within pending same-qid_ questions of the same kind
Definition: RequestId.h:56
QuestionerId qid_
the sender of the request
Definition: RequestId.h:53
RequestId & operator=(const Index anIndex)
Definition: RequestId.h:49
RequestId()=default
request recipient's constructor
Index index() const
Definition: RequestId.h:45
QuestionerId questioner() const
Definition: RequestId.h:44
unsigned int Index
Definition: RequestId.h:27
std::ostream & operator<<(std::ostream &os, const QuestionerId &qid)
Definition: QuestionerId.h:63
void reset()
Definition: RequestId.h:38
Definition: IpcIoFile.h:23

 

Introduction

Documentation

Support

Miscellaneous