]> git.ipfire.org Git - thirdparty/squid.git/blob - src/mgr/FunAction.h
Removed CVS $ markers
[thirdparty/squid.git] / src / mgr / FunAction.h
1 /*
2 * DEBUG: section 16 Cache Manager API
3 *
4 */
5
6 #ifndef SQUID_MGR_FUN_ACTION_H
7 #define SQUID_MGR_FUN_ACTION_H
8
9 #include "mgr/Action.h"
10 #include "mgr/ActionCreator.h"
11
12 namespace Mgr
13 {
14
15 /// function-based cache manager Action; a wrapper for so called legacy actions
16 /// that do everything using a single OBJH function
17 class FunAction: public Action
18 {
19 protected:
20 FunAction(const CommandPointer &cmd, OBJH *aHandler);
21
22 public:
23 static Pointer Create(const CommandPointer &cmd, OBJH *aHandler);
24
25 /* Action API */
26 virtual void respond(const Request& request);
27 // we cannot aggregate because we do not even know what the handler does
28 virtual bool aggregatable() const { return false; }
29
30 protected:
31 /* Action API */
32 virtual void dump(StoreEntry *entry);
33
34 private:
35 OBJH *handler; ///< legacy function that collects and dumps info
36 };
37
38 /// creates FunAction using ActionCreator API
39 class FunActionCreator: public ActionCreator
40 {
41 public:
42 explicit FunActionCreator(OBJH *aHandler): handler(aHandler) {}
43
44 /* ActionCreator API */
45 virtual Action::Pointer create(const CommandPointer &cmd) const {
46 return FunAction::Create(cmd, handler);
47 }
48
49 private:
50 OBJH *handler; ///< legacy function to pass to the FunAction wrapper
51 };
52
53 } // namespace Mgr
54
55 #endif /* SQUID_MGR_FUN_ACTION_H */