Initiate.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 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_ADAPTATION__INITIATE_H
10 #define SQUID_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  virtual ~Initiate();
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  virtual void swanSong(); // internal cleanup
48 
49  virtual const char *status() const; // 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_ADAPTATION__INITIATE_H */
61 
summarizes adaptation service answer for the noteAdaptationAnswer() API
Definition: Answer.h:22
void tellQueryAborted(bool final)
Definition: Initiate.cc:87
virtual ~Initiate()
Definition: Initiate.cc:46
int i
Definition: membanger.c:49
Initiate(const char *aTypeName)
Definition: Initiate.cc:42
Initiate & operator=(const Initiate &)
virtual const char * status() const
internal cleanup; do not call directly
Definition: Initiate.cc:92
CbcPointer< Initiator > theInitiator
Definition: Initiate.h:51
void sendAnswer(const Answer &answer)
Definition: Initiate.cc:79
void initiator(const CbcPointer< Initiator > &i)
sets initiator
Definition: Initiate.cc:54
virtual void swanSong()
Definition: Initiate.cc:62
virtual void noteInitiatorAborted()=0

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors