summaryrefslogtreecommitdiff
path: root/qpid/cpp/rubygen/0-10/specification.rb
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2008-04-08 19:53:07 +0000
committerAlan Conway <aconway@apache.org>2008-04-08 19:53:07 +0000
commit7216a7c6837ff7d43b3ee6e2446d9938e864a74e (patch)
tree5eb31f048fba698acd71c1c6615012e3c45a0d62 /qpid/cpp/rubygen/0-10/specification.rb
parentc89fe1d8ef23cb6f3f2c60623dfdac08216baa06 (diff)
downloadqpid-python-7216a7c6837ff7d43b3ee6e2446d9938e864a74e.tar.gz
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@646054 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/rubygen/0-10/specification.rb')
-rwxr-xr-xqpid/cpp/rubygen/0-10/specification.rb15
1 files changed, 8 insertions, 7 deletions
diff --git a/qpid/cpp/rubygen/0-10/specification.rb b/qpid/cpp/rubygen/0-10/specification.rb
index d8c5378538..54d39de9b4 100755
--- a/qpid/cpp/rubygen/0-10/specification.rb
+++ b/qpid/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 "<boost/call_traits.hpp>"
include "<iosfwd>"
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 <class T> #{name}(const T& t) : #{holder_base}(t) {}"
+ genl "template <class T> 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 << \"<empty #{name}>\"); }"