From 8c3baf496f9424249e2a666d79f0e3b38ba8d8fc Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Tue, 8 Jul 2008 22:58:37 +0000 Subject: HandlerChain: plug-in handler chain extension points. Replaces Handler::Chain. Updated Sessoin & Connection handler chains and Cluster. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@675017 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/framing/Handler.h | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) (limited to 'cpp/src/qpid/framing') diff --git a/cpp/src/qpid/framing/Handler.h b/cpp/src/qpid/framing/Handler.h index edd7f469b0..a2a8ee7bfa 100644 --- a/cpp/src/qpid/framing/Handler.h +++ b/cpp/src/qpid/framing/Handler.h @@ -28,7 +28,6 @@ namespace qpid { namespace framing { -/** Generic handler that can be linked into chains. */ template struct Handler { typedef T HandledType; @@ -46,23 +45,6 @@ struct Handler { /** Pointer to next handler in a linked list. */ Handler* next; - /** A Chain is a handler holding a linked list of sub-handlers. - * Chain::next is invoked after the full chain, it is not itself part of the chain. - * Handlers inserted into the chain are deleted by the Chain dtor. - */ - class Chain : public Handler { - public: - Chain(Handler& next_) : Handler(&next_), first(&next_) {} - ~Chain() { while (first != next) pop(); } - void handle(T t) { first->handle(t); } - void insert(Handler* h) { h->next = first; first = h; } - bool empty() { return first == next; } - - private: - void pop() { Handler* p=first; first=first->next; delete p; } - Handler* first; - }; - /** Adapt any void(T) functor as a Handler. * Functor(f) will copy f. * Functor(f) will only take a reference to x. @@ -84,7 +66,7 @@ struct Handler { MemFunRef(X& x, Handler* next=0) : Handler(next), target(&x) {} void handle(T t) { (target->*F)(t); } - /** Allow calling with -> syntax, compatible with Chains */ + /** Allow calling with -> syntax, like a qpid::HandlerChain */ MemFunRef* operator->() { return this; } private: @@ -103,15 +85,13 @@ struct Handler { }; /** Support for implementing an in-out handler pair as a single class. - * Public interface is Handler::Chains pair, but implementation - * overrides handleIn, handleOut functions in a single class. + * Overrides handleIn, handleOut functions in a single class. */ struct InOutHandler : protected InOutHandlerInterface { InOutHandler(Handler* nextIn=0, Handler* nextOut=0) : in(*this, nextIn), out(*this, nextOut) {} MemFunRef in; MemFunRef out; }; - }; -- cgit v1.2.1