diff options
Diffstat (limited to 'cpp/rubygen/templates')
-rw-r--r-- | cpp/rubygen/templates/InvocationVisitor.rb | 8 | ||||
-rwxr-xr-x | cpp/rubygen/templates/Operations.rb | 12 | ||||
-rw-r--r-- | cpp/rubygen/templates/Session.rb | 2 | ||||
-rw-r--r-- | cpp/rubygen/templates/structs.rb | 20 |
4 files changed, 27 insertions, 15 deletions
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 <<EOS }; // class #{handlerclass} diff --git a/cpp/rubygen/templates/Session.rb b/cpp/rubygen/templates/Session.rb index f4af2041dd..95b10c6dbf 100644 --- a/cpp/rubygen/templates/Session.rb +++ b/cpp/rubygen/templates/Session.rb @@ -88,7 +88,7 @@ public: #{@classname}(ConnectionImpl::shared_ptr, SessionCore::shared_ptr); ~#{@classname}(); - ReceivedContent::shared_ptr get() { return impl->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 <<EOS using AMQMethodBody::accept; void accept(MethodBodyConstVisitor& v) const { v.visit(*this); } inline ClassId amqpClassId() const { return CLASS_ID; } inline MethodId amqpMethodId() const { return METHOD_ID; } + inline bool isContentBearing() const { return #{content}; } EOS end @@ -132,6 +149,9 @@ EOS if (s.kind_of? AmqpMethod) genl "#{name}(ProtocolVersion=ProtocolVersion()) {}" end + if (s.kind_of? AmqpStruct) + genl "#{name}() #{default_initialisation(s)} {}" + end end def define_accessors(f) |