From: Samuel Just Date: Sat, 14 Sep 2013 02:48:56 +0000 (-0700) Subject: Context: add GenContext templated on the callback argument X-Git-Tag: v0.71~68^2~37 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fde0f864a62af39a0854af39e4e329ff80f35cf9;p=ceph.git Context: add GenContext templated on the callback argument Signed-off-by: Samuel Just --- diff --git a/src/include/Context.h b/src/include/Context.h index 9ec4414a047c..663313ceec17 100644 --- a/src/include/Context.h +++ b/src/include/Context.h @@ -27,6 +27,26 @@ #define mydout(cct, v) lgeneric_subdout(cct, context, v) +/* + * GenContext - abstract callback class + */ +template +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 */