diff options
| author | Alan Conway <aconway@apache.org> | 2008-07-08 22:58:37 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2008-07-08 22:58:37 +0000 |
| commit | 8c3baf496f9424249e2a666d79f0e3b38ba8d8fc (patch) | |
| tree | 5fd950f023cacb47cf3cc9dc11aed91c94f380f8 /cpp/src/qpid/framing/Handler.h | |
| parent | 391608a73f18a1797ab0c358f0a94364dc888eb2 (diff) | |
| download | qpid-python-8c3baf496f9424249e2a666d79f0e3b38ba8d8fc.tar.gz | |
HandlerChain: plug-in handler chain extension points. Replaces Handler<T>::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
Diffstat (limited to 'cpp/src/qpid/framing/Handler.h')
| -rw-r--r-- | cpp/src/qpid/framing/Handler.h | 24 |
1 files changed, 2 insertions, 22 deletions
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 <class T> struct Handler { typedef T HandledType; @@ -46,23 +45,6 @@ struct Handler { /** Pointer to next handler in a linked list. */ Handler<T>* 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<T> { - public: - Chain(Handler<T>& next_) : Handler(&next_), first(&next_) {} - ~Chain() { while (first != next) pop(); } - void handle(T t) { first->handle(t); } - void insert(Handler<T>* h) { h->next = first; first = h; } - bool empty() { return first == next; } - - private: - void pop() { Handler<T>* p=first; first=first->next; delete p; } - Handler<T>* first; - }; - /** Adapt any void(T) functor as a Handler. * Functor<F>(f) will copy f. * Functor<F&>(f) will only take a reference to x. @@ -84,7 +66,7 @@ struct Handler { MemFunRef(X& x, Handler<T>* 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<T>::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<T>* nextIn=0, Handler<T>* nextOut=0) : in(*this, nextIn), out(*this, nextOut) {} MemFunRef<InOutHandlerInterface, &InOutHandlerInterface::handleIn> in; MemFunRef<InOutHandlerInterface, &InOutHandlerInterface::handleOut> out; }; - }; |
