]>
Commit | Line | Data |
---|---|---|
1 | #ifndef SQUID_ADAPTATION__INITIATE_H | |
2 | #define SQUID_ADAPTATION__INITIATE_H | |
3 | ||
4 | #include "adaptation/forward.h" | |
5 | #include "base/AsyncJob.h" | |
6 | #include "base/CbcPointer.h" | |
7 | ||
8 | namespace Adaptation | |
9 | { | |
10 | ||
11 | /* | |
12 | * The Initiate is a common base for queries or transactions | |
13 | * initiated by an Initiator. This interface exists to allow an | |
14 | * initiator to signal its "initiatees" that it is aborting and no longer | |
15 | * expecting an answer. The class is also handy for implementing common | |
16 | * initiate actions such as maintaining and notifying the initiator. | |
17 | * | |
18 | * Initiate implementations must cbdata-protect themselves. | |
19 | * | |
20 | * This class could have been named Initiatee. | |
21 | */ | |
22 | class Initiate: virtual public AsyncJob | |
23 | { | |
24 | ||
25 | public: | |
26 | Initiate(const char *aTypeName); | |
27 | virtual ~Initiate(); | |
28 | ||
29 | void initiator(const CbcPointer<Initiator> &i); ///< sets initiator | |
30 | ||
31 | // communication with the initiator | |
32 | virtual void noteInitiatorAborted() = 0; | |
33 | ||
34 | protected: | |
35 | void sendAnswer(const Answer &answer); // send to the initiator | |
36 | void tellQueryAborted(bool final); // tell initiator | |
37 | void clearInitiator(); // used by noteInitiatorAborted; TODO: make private | |
38 | ||
39 | virtual void swanSong(); // internal cleanup | |
40 | ||
41 | virtual const char *status() const; // for debugging | |
42 | ||
43 | CbcPointer<Initiator> theInitiator; | |
44 | ||
45 | private: | |
46 | Initiate(const Initiate &); // no definition | |
47 | Initiate &operator =(const Initiate &); // no definition | |
48 | }; | |
49 | ||
50 | } // namespace Adaptation | |
51 | ||
52 | #endif /* SQUID_ADAPTATION__INITIATE_H */ |