From 84baf0acb5254857e424e22a6c1cedbd1ffb8ec2 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@585223 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/rubygen/templates/InvocationVisitor.rb | 101 ------------------------ 1 file changed, 101 deletions(-) delete mode 100644 qpid/cpp/rubygen/templates/InvocationVisitor.rb (limited to 'qpid/cpp/rubygen/templates/InvocationVisitor.rb') diff --git a/qpid/cpp/rubygen/templates/InvocationVisitor.rb b/qpid/cpp/rubygen/templates/InvocationVisitor.rb deleted file mode 100644 index 67a0479bb6..0000000000 --- a/qpid/cpp/rubygen/templates/InvocationVisitor.rb +++ /dev/null @@ -1,101 +0,0 @@ -#!/usr/bin/env ruby -$: << ".." # Include .. in load path -require 'cppgen' - -class InvocationVisitor < CppGen - - def initialize(outdir, amqp) - super(outdir, amqp) - @namespace="qpid::framing" - @classname="InvocationVisitor" - @filename="qpid/framing/InvocationVisitor" - end - - def invocation_args(m) - m.param_names.collect {|p| "body.get" + p.caps + "()" }.join(",\n") - end - - def null_visit(m) - genl "void InvocationVisitor::visit(const #{m.body_name}&){}" - end - - def define_visit(m) - if (m.fields.size > 0) - body = "body" - else - body = "/*body*/" - end - gen <(invocable); - } else { - ptr = ops->get#{m.parent.cppname}Handler(); - } - - if (ptr) { -EOS - if (m.result) - indent(2) { genl "encode<#{m.result.struct.cpptype.name}>(ptr->#{m.cppname}(#{invocation_args(m)}), result);" } - else - indent(2) { genl "ptr->#{m.cppname}(#{invocation_args(m)});" } - end - - gen <