summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/framing/Handler.h
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/qpid/framing/Handler.h')
-rw-r--r--cpp/src/qpid/framing/Handler.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/cpp/src/qpid/framing/Handler.h b/cpp/src/qpid/framing/Handler.h
index 56e150a66d..f6b59393d9 100644
--- a/cpp/src/qpid/framing/Handler.h
+++ b/cpp/src/qpid/framing/Handler.h
@@ -40,11 +40,21 @@ template <class T> struct Handler {
Chain out;
};
+ Handler() {}
+ Handler(Chain next_) : next(next_) {}
virtual ~Handler() {}
+
virtual void handle(T) = 0;
+
+ /** Next handler. Public so chains can be modified by altering next. */
Chain next;
-};
+ protected:
+ /** Derived handle() implementations call nextHandler to invoke the
+ * next handler in the chain. */
+ void nextHandler(T data) { if (next) next->handle(data); }
+
+};
}}