From 9e10f4ea3b2f8ab6650f635cada48e4735ca20d7 Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Tue, 28 Aug 2007 19:38:17 +0000 Subject: Updated message.transfer encoding to use header and content segments (including new structs). Unified more between the basic and message classes messages. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@570538 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/rubygen/templates/InvocationVisitor.rb | 8 ++------ cpp/rubygen/templates/Operations.rb | 12 ++++-------- cpp/rubygen/templates/Session.rb | 2 +- cpp/rubygen/templates/structs.rb | 20 ++++++++++++++++++++ 4 files changed, 27 insertions(+), 15 deletions(-) (limited to 'cpp/rubygen/templates') diff --git a/cpp/rubygen/templates/InvocationVisitor.rb b/cpp/rubygen/templates/InvocationVisitor.rb index befbdd53c7..67a0479bb6 100644 --- a/cpp/rubygen/templates/InvocationVisitor.rb +++ b/cpp/rubygen/templates/InvocationVisitor.rb @@ -12,11 +12,7 @@ class InvocationVisitor < CppGen end def invocation_args(m) - if (m.parent.name == "message" && (m.name == "transfer" || m.name == "append")) - "body" - else - m.param_names.collect {|p| "body.get" + p.caps + "()" }.join(",\n") - end + m.param_names.collect {|p| "body.get" + p.caps + "()" }.join(",\n") end def null_visit(m) @@ -95,7 +91,7 @@ EOS } genl "}" genl - @amqp.methods_.each { |m| m.on_server? ? define_visit(m) : null_visit(m) } + @amqp.methods_.each { |m| m.on_server? && !m.content() ? define_visit(m) : null_visit(m) } } } end diff --git a/cpp/rubygen/templates/Operations.rb b/cpp/rubygen/templates/Operations.rb index 9f242f5910..fff4f796c3 100755 --- a/cpp/rubygen/templates/Operations.rb +++ b/cpp/rubygen/templates/Operations.rb @@ -17,13 +17,9 @@ class OperationsGen < CppGen def handler_method (m) return_type = m.result ? m.result.cpptype.ret : "void" - if (m.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 + gen "\nvirtual #{return_type} #{m.cppname}(" + gen m.signature.join(",\n") + gen ") = 0;\n" end def handler_classname(c) c.name.caps+"Handler"; end @@ -40,7 +36,7 @@ class #{handlerclass} : public virtual Invocable { virtual ~#{handlerclass}() {} // Protocol methods EOS - c.methods_on(@chassis).each { |m| handler_method(m) } + c.methods_on(@chassis).each { |m| handler_method(m) if !m.content() } gen <get(); } + framing::FrameSet::shared_ptr get() { return impl->get(); } void setSynchronous(bool sync) { impl->setSync(sync); } void close(); EOS diff --git a/cpp/rubygen/templates/structs.rb b/cpp/rubygen/templates/structs.rb index c92f71c777..2543c43717 100644 --- a/cpp/rubygen/templates/structs.rb +++ b/cpp/rubygen/templates/structs.rb @@ -33,6 +33,16 @@ class StructGen < CppGen ValueTypes=["octet", "short", "long", "longlong", "timestamp"] + def default_initialisation(s) + params = s.fields.select {|f| ValueTypes.include?(f.domain.type_) || f.domain.type_ == "bit"} + strings = params.collect {|f| "#{f.cppname}(0)"} + if strings.empty? + return "" + else + return " : " + strings.join(", ") + end + end + def printable_form(f) if (f.cpptype.name == "u_int8_t") return "(int) " + f.cppname @@ -108,12 +118,19 @@ class StructGen < CppGen end def methodbody_extra_defs(s) + if (s.content) + content = "true" + else + content = "false" + end + gen <