diff options
author | Samuel Just <sam.just@inktank.com> | 2013-09-13 19:48:56 -0700 |
---|---|---|
committer | Samuel Just <sam.just@inktank.com> | 2013-09-25 19:18:42 -0700 |
commit | fde0f864a62af39a0854af39e4e329ff80f35cf9 (patch) | |
tree | a0fb29acfed176a94e2ada43024f573a239b2e18 | |
parent | 52c7f2796397b5e3aa24c24bf0c6615cadf927c6 (diff) | |
download | ceph-fde0f864a62af39a0854af39e4e329ff80f35cf9.tar.gz |
Context: add GenContext templated on the callback argument
Signed-off-by: Samuel Just <sam.just@inktank.com>
-rw-r--r-- | src/include/Context.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/include/Context.h b/src/include/Context.h index 9ec4414a047..663313ceec1 100644 --- a/src/include/Context.h +++ b/src/include/Context.h @@ -28,6 +28,26 @@ #define mydout(cct, v) lgeneric_subdout(cct, context, v) /* + * GenContext - abstract callback class + */ +template <typename T> +class GenContext { + GenContext(const GenContext& other); + const GenContext& operator=(const GenContext& other); + + protected: + virtual void finish(T t) = 0; + + public: + GenContext() {} + virtual ~GenContext() {} // we want a virtual destructor!!! + virtual void complete(T t) { + finish(t); + delete this; + } +}; + +/* * Context - abstract callback class */ class Context { |