From e72e25abd1272c4e9489f7efd5bc02c4ecf0b5cd Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Tue, 8 Apr 2008 19:53:07 +0000 Subject: Summary: added 0-10 Array encoding and decoding. rubygen/0-10/allsegmenttypes.rb: test header,body and each command and control type. rubygen/0-10/specification.rb: enable packed encoding. src/qpid/amqp_0_10/Array.h: Implemented array and array domains. src/qpid/amqp_0_10/Codec.h: enable litte-endian encoding for pack bits src/qpid/amqp_0_10/Packer.h: use litte-endian encoding for pack bits src/qpid/amqp_0_10/Unit.cpp, .h: setting flags, fix op <<. src/qpid/amqp_0_10/complex_types.cpp, .h: added op << src/qpid/framing/Blob.h: copy-object template constructor. src/tests/amqp_0_10/serialize.cpp: - test Array Minor adjustments for new Array.h: src/qpid/amqp_0_10/Map.cpp src/qpid/amqp_0_10/Map.h src/qpid/amqp_0_10/UnknownType.h src/qpid/amqp_0_10/built_in_types.h src/qpid/amqp_0_10/Body.h git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@646054 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/rubygen/0-10/specification.rb | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'cpp/rubygen/0-10/specification.rb') diff --git a/cpp/rubygen/0-10/specification.rb b/cpp/rubygen/0-10/specification.rb index d8c5378538..54d39de9b4 100755 --- a/cpp/rubygen/0-10/specification.rb +++ b/cpp/rubygen/0-10/specification.rb @@ -64,11 +64,11 @@ class Specification < CppGen genl yield if block } + genl "inline Packer<#{x.classname}> serializable(#{x.classname}& x) { return Packer<#{x.classname}>(x); }" unless x.respond_to? :pack and x.pack == "0" genl "std::ostream& operator << (std::ostream&, const #{x.classname}&);" genl "bool operator==(const #{x.classname}&, const #{x.classname}&);" end - # FIXME aconway 2008-03-10: packing, coding def action_struct_cpp(x) genl genl "const char* #{x.classname}::NAME=\"#{x.fqname}\";" @@ -89,7 +89,7 @@ class Specification < CppGen scope("std::ostream& operator << (std::ostream& o, const #{x.classname}&#{"x" unless x.fields.empty?}) {") { genl "o << \"[#{x.fqname}\";"; x.fields.each{ |f| genl "o << \" #{f.name}=\" << x.#{f.cppname};" } - genl "o << \"];\";" + genl "o << \"]\";" genl "return o;" } end @@ -151,8 +151,8 @@ class Specification < CppGen def gen_specification() h_file("#{@dir}/specification") { include "#{@dir}/specification_fwd" - include "#{@dir}/complex_types" - include "#{@dir}/Map.h" + include "#{@dir}/all_built_in_types" + include "#{@dir}/Packer.h" include "" include "" genl "using boost::call_traits;" @@ -271,7 +271,7 @@ class Specification < CppGen holder_base="amqp_0_10::Holder<#{base}Holder, #{base}, #{base.downcase}_max::MAX>" struct("#{name}", "public #{holder_base}") { genl "#{name}() {}" - genl "template #{name}(const T& t) : #{holder_base}(t) {}" + genl "template explicit #{name}(const T& t) : #{holder_base}(t) {}" genl "using #{holder_base}::operator=;" genl "void set(uint8_t classCode, uint8_t code);" } @@ -281,7 +281,8 @@ class Specification < CppGen } cpp_file("#{@dir}/#{name}") { - include "#{@dir}/#{name}" + include "#{name}" + include "exceptions.h" namespace(@ns) { genl "using framing::in_place;" genl @@ -291,7 +292,7 @@ class Specification < CppGen subs.each { |s| genl "case 0x#{s.full_code.to_s(16)}: *this=in_place<#{s.fqclassname}>(); break;" } - genl "default: assert(0);" + genl "default: throw CommandInvalidException(QPID_MSG(\"Invalid class-#{base.downcase} key \" << std::hex << key));" }} genl genl "std::ostream& operator<<(std::ostream& o, const #{name}& h) { return h.get() ? (o << *h.get()) : (o << \"\"); }" -- cgit v1.2.1