From bb2883b9f5cfad0e028a9849ed91e36418a2d0ff Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Tue, 21 Aug 2007 15:51:41 +0000 Subject: Refresh of transitional xml to more closely reflect latest specification Initial execution-result support (not yet handled on c++ client) Generation is now all done through the ruby code (it is a little slower at present I'm afraid, will try to speed it up over the next weeks) git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@568174 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/rubygen/templates/Operations.rb | 108 ++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100755 cpp/rubygen/templates/Operations.rb (limited to 'cpp/rubygen/templates/Operations.rb') diff --git a/cpp/rubygen/templates/Operations.rb b/cpp/rubygen/templates/Operations.rb new file mode 100755 index 0000000000..79b82a9d59 --- /dev/null +++ b/cpp/rubygen/templates/Operations.rb @@ -0,0 +1,108 @@ +#!/usr/bin/env ruby +# Usage: output_directory xml_spec_file [xml_spec_file...] +# +$: << '..' +require 'cppgen' + +class OperationsGen < CppGen + + def initialize(chassis, outdir, amqp) + super(outdir, amqp) + @chassis=chassis + @classname="AMQP_#{@chassis.caps}Operations" + end + + def handler_method (m) + if (m.has_result?) + return_type = "#{m.amqp_parent.name.caps}#{m.cppname.caps}Result" + else + return_type = "void" + end + if (m.amqp_parent.name == "message" && (m.name == "transfer" || m.name == "append")) + gen "\nvirtual #{return_type} #{m.cppname}(const framing::AMQMethodBody& context) = 0;\n" + else + gen "\nvirtual #{return_type} #{m.cppname}(" + gen m.signature.join(",\n") + gen ") = 0;\n" + end + end + + def handler_classname(c) c.name.caps+"Handler"; end + + def handler_class(c) + if (!c.amqp_methods_on(@chassis).empty?) + handlerclass=handler_classname c + gen < +#include "qpid/framing/ProtocolVersion.h" +#include "qpid/framing/amqp_structs.h" + +namespace qpid { +namespace framing { + +class AMQMethodBody; + +class Invocable +{ +protected: + Invocable() {} + virtual ~Invocable() {} +}; + +class #{@classname} { + + public: + virtual ~#{@classname}() {} + + virtual ProtocolVersion getVersion() const = 0; + + // Include framing constant declarations - why? + //#include "qpid/framing/AMQP_Constants.h" + + // Inner classes +EOS + indent { @amqp.amqp_classes.each { |c| handler_class(c) } } + gen <