From 428de9b6fe6f81f2bfc3f47d5db013b4b00da6a2 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Tue, 16 Oct 2007 19:07:54 +0000 Subject: * Summary: generalized Invoker visitor to all *Operations and *Handler classes, client and broker. Single template free function invoke(Invocable, const AMQBody&); works for all invocable handlers. * rubygen/templates/OperationsInvoker.rb: Generates invoker visitors for all Operations classes, client and server. * src/qpid/framing/Invoker.h: Invoker base class and template invoke() function. * rubygen/templates/structs.rb: add generic invoke method template to invoke an arbitrary object with the correct memeber function. * src/qpid/framing/AMQMethodBody.cpp, .h: Removed invoke(), replaced by qpid::framing::invoke() * src/qpid/broker/SemanticHandler.cpp, ConnectionHandler.cpp: Replace AMQMethodBody::invoke with invoke() free function. * src/qpid/framing/StructHelper.h: Avoid un-necessary alloc and copy in encode/decode. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@585223 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/client/ExecutionHandler.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'cpp/src/qpid/client/ExecutionHandler.cpp') diff --git a/cpp/src/qpid/client/ExecutionHandler.cpp b/cpp/src/qpid/client/ExecutionHandler.cpp index 25813dd623..e4edece414 100644 --- a/cpp/src/qpid/client/ExecutionHandler.cpp +++ b/cpp/src/qpid/client/ExecutionHandler.cpp @@ -25,6 +25,7 @@ #include "qpid/framing/MessageTransferBody.h" #include "qpid/framing/AMQP_HighestVersion.h" #include "qpid/framing/all_method_bodies.h" +#include "qpid/framing/ServerInvoker.h" using namespace qpid::client; using namespace qpid::framing; @@ -49,20 +50,13 @@ bool isContentFrame(AMQFrame& frame) return type == HEADER_BODY || type == CONTENT_BODY || isMessageMethod(body); } -bool invoke(AMQBody* body, Invocable* target) -{ - AMQMethodBody* method=body->getMethod(); - return method && method->invoke(target); -} - ExecutionHandler::ExecutionHandler(uint64_t _maxFrameSize) : version(framing::highestProtocolVersion), maxFrameSize(_maxFrameSize) {} //incoming: void ExecutionHandler::handle(AMQFrame& frame) { - AMQBody* body = frame.getBody(); - if (!invoke(body, this)) { + if (!invoke(*this, *frame.getBody())) { if (!arriving) { arriving = FrameSet::shared_ptr(new FrameSet(++incomingCounter)); } -- cgit v1.2.1