From 9bf82c2c8c45a5228643a285f8db0b1061a69ad9 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Wed, 18 Jun 2008 17:53:30 +0000 Subject: Bring cluster code up to date. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@669236 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/framing/Handler.h | 27 +++++++++++++-------------- cpp/src/qpid/framing/HeaderProperties.h | 2 -- 2 files changed, 13 insertions(+), 16 deletions(-) (limited to 'cpp/src/qpid/framing') diff --git a/cpp/src/qpid/framing/Handler.h b/cpp/src/qpid/framing/Handler.h index b93869be85..5e3d48ac88 100644 --- a/cpp/src/qpid/framing/Handler.h +++ b/cpp/src/qpid/framing/Handler.h @@ -46,22 +46,21 @@ struct Handler { /** Pointer to next handler in a linked list. */ Handler* next; - /** A Chain is a handler that forwards to a modifiable - * linked list of handlers. + /** A Chain is a handler holding a linked list of sub-handlers. + * Chain::next is invoked after the full, it is not itself part of the chain. + * Handlers inserted into the chain are deleted by the Chain dtor. */ - struct Chain : public Handler { - Chain(Handler* first=0) : Handler(first) {} - void operator=(Handler* h) { next = h; } - void handle(T t) { next->handle(t); } - // TODO aconway 2007-08-29: chain modifier ops here. - }; + 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; } - /** In/out pair of handler chains. */ - struct Chains { - Chains(Handler* in_=0, Handler* out_=0) : in(in_), out(out_) {} - void reset(Handler* in_=0, Handler* out_=0) { in = in_; out = out_; } - Chain in; - Chain out; + private: + void pop() { Handler* p=first; first=first->next; delete p; } + Handler* first; }; /** Adapt any void(T) functor as a Handler. diff --git a/cpp/src/qpid/framing/HeaderProperties.h b/cpp/src/qpid/framing/HeaderProperties.h index 0c805922e8..d66c1d00d6 100644 --- a/cpp/src/qpid/framing/HeaderProperties.h +++ b/cpp/src/qpid/framing/HeaderProperties.h @@ -27,8 +27,6 @@ namespace qpid { namespace framing { - enum header_classes{BASIC = 60}; - class HeaderProperties { -- cgit v1.2.1