Initiate.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2023 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_ADAPTATION_INITIATE_H
10 #define SQUID_SRC_ADAPTATION_INITIATE_H
11 
12 #include "adaptation/forward.h"
13 #include "base/AsyncJob.h"
14 #include "base/CbcPointer.h"
15 
16 namespace Adaptation
17 {
18 
19 /*
20  * The Initiate is a common base for queries or transactions
21  * initiated by an Initiator. This interface exists to allow an
22  * initiator to signal its "initiatees" that it is aborting and no longer
23  * expecting an answer. The class is also handy for implementing common
24  * initiate actions such as maintaining and notifying the initiator.
25  *
26  * Initiate implementations must cbdata-protect themselves.
27  *
28  * This class could have been named Initiatee.
29  */
30 class Initiate: virtual public AsyncJob
31 {
32 
33 public:
34  Initiate(const char *aTypeName);
35  ~Initiate() override;
36 
37  void initiator(const CbcPointer<Initiator> &i);
38 
39  // communication with the initiator
40  virtual void noteInitiatorAborted() = 0;
41 
42 protected:
43  void sendAnswer(const Answer &answer); // send to the initiator
44  void tellQueryAborted(bool final); // tell initiator
45  void clearInitiator(); // used by noteInitiatorAborted; TODO: make private
46 
47  void swanSong() override; // internal cleanup
48 
49  const char *status() const override; // for debugging
50 
52 
53 private:
54  Initiate(const Initiate &); // no definition
55  Initiate &operator =(const Initiate &); // no definition
56 };
57 
58 } // namespace Adaptation
59 
60 #endif /* SQUID_SRC_ADAPTATION_INITIATE_H */
61 
Initiate & operator=(const Initiate &)
void swanSong() override
Definition: Initiate.cc:62
CbcPointer< Initiator > theInitiator
Definition: Initiate.h:51
Initiate(const char *aTypeName)
Definition: Initiate.cc:42
void initiator(const CbcPointer< Initiator > &i)
sets initiator
Definition: Initiate.cc:54
~Initiate() override
Definition: Initiate.cc:46
virtual void noteInitiatorAborted()=0
void tellQueryAborted(bool final)
Definition: Initiate.cc:87
void sendAnswer(const Answer &answer)
Definition: Initiate.cc:79
summarizes adaptation service answer for the noteAdaptationAnswer() API
Definition: Answer.h:24
const char * status() const override
internal cleanup; do not call directly
Definition: Initiate.cc:92

 

Introduction

Documentation

Support

Miscellaneous