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-13 19:49:27 -0700 |
commit | 02d0cc86e6d16d4672744e2eafa504a4b2e68f21 (patch) | |
tree | 7d33b9384807d8240ce50174febcb62f47a4df10 | |
parent | 388dd1e2012eacc1e91fa2fb6b8cb1fd71f1834c (diff) | |
download | ceph-02d0cc86e6d16d4672744e2eafa504a4b2e68f21.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 { |