]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/mgr/FunAction.h
2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
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.
9 /* DEBUG: section 16 Cache Manager API */
11 #ifndef SQUID_MGR_FUN_ACTION_H
12 #define SQUID_MGR_FUN_ACTION_H
14 #include "mgr/Action.h"
15 #include "mgr/ActionCreator.h"
20 /// function-based cache manager Action; a wrapper for so called legacy actions
21 /// that do everything using a single OBJH function
22 class FunAction
: public Action
25 FunAction(const CommandPointer
&cmd
, OBJH
*aHandler
);
28 static Pointer
Create(const CommandPointer
&cmd
, OBJH
*aHandler
);
31 virtual void respond(const Request
& request
);
32 // we cannot aggregate because we do not even know what the handler does
33 virtual bool aggregatable() const { return false; }
37 virtual void dump(StoreEntry
*entry
);
40 OBJH
*handler
; ///< legacy function that collects and dumps info
43 /// creates FunAction using ActionCreator API
44 class FunActionCreator
: public ActionCreator
47 explicit FunActionCreator(OBJH
*aHandler
): handler(aHandler
) {}
49 /* ActionCreator API */
50 virtual Action::Pointer
create(const CommandPointer
&cmd
) const {
51 return FunAction::Create(cmd
, handler
);
55 OBJH
*handler
; ///< legacy function to pass to the FunAction wrapper
60 #endif /* SQUID_MGR_FUN_ACTION_H */