summaryrefslogtreecommitdiff
path: root/qpid/cpp
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2014-07-03 03:00:18 +0000
committerAndrew Stitcher <astitcher@apache.org>2014-07-03 03:00:18 +0000
commit019efd3773a2f6986ef8eef3749ecb2dfbef2147 (patch)
treef4ed8908df05fa7da45385457a28344bdc79ea1b /qpid/cpp
parentd75ced8626fbe4064b56c7ccdb56236c2c968584 (diff)
downloadqpid-python-019efd3773a2f6986ef8eef3749ecb2dfbef2147.tar.gz
QPID-5871: Remove unused generated code and dependent code
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1607521 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp')
-rwxr-xr-xqpid/cpp/rubygen/0-10/allsegmenttypes.rb52
-rwxr-xr-xqpid/cpp/rubygen/0-10/exceptions.rb73
-rwxr-xr-xqpid/cpp/rubygen/0-10/handlers.rb47
-rwxr-xr-xqpid/cpp/rubygen/0-10/specification.rb389
-rwxr-xr-xqpid/cpp/rubygen/0-10/typecode.rb117
-rwxr-xr-xqpid/cpp/rubygen/generate15
-rw-r--r--qpid/cpp/src/qpid/amqp_0_10/Array.cpp34
-rw-r--r--qpid/cpp/src/qpid/amqp_0_10/Array.h124
-rw-r--r--qpid/cpp/src/qpid/amqp_0_10/Body.h55
-rw-r--r--qpid/cpp/src/qpid/amqp_0_10/Codec.h213
-rw-r--r--qpid/cpp/src/qpid/amqp_0_10/Command.h62
-rw-r--r--qpid/cpp/src/qpid/amqp_0_10/CommmandPacker.h60
-rw-r--r--qpid/cpp/src/qpid/amqp_0_10/Connection.cpp3
-rw-r--r--qpid/cpp/src/qpid/amqp_0_10/Control.h70
-rw-r--r--qpid/cpp/src/qpid/amqp_0_10/Decimal.h51
-rw-r--r--qpid/cpp/src/qpid/amqp_0_10/Exception.h96
-rw-r--r--qpid/cpp/src/qpid/amqp_0_10/FrameHeader.cpp50
-rw-r--r--qpid/cpp/src/qpid/amqp_0_10/FrameHeader.h90
-rw-r--r--qpid/cpp/src/qpid/amqp_0_10/Header.cpp34
-rw-r--r--qpid/cpp/src/qpid/amqp_0_10/Header.h53
-rw-r--r--qpid/cpp/src/qpid/amqp_0_10/Holder.h103
-rw-r--r--qpid/cpp/src/qpid/amqp_0_10/Map.cpp66
-rw-r--r--qpid/cpp/src/qpid/amqp_0_10/Map.h188
-rw-r--r--qpid/cpp/src/qpid/amqp_0_10/Packer.h195
-rw-r--r--qpid/cpp/src/qpid/amqp_0_10/SerializableString.h62
-rw-r--r--qpid/cpp/src/qpid/amqp_0_10/Struct.h60
-rw-r--r--qpid/cpp/src/qpid/amqp_0_10/Struct32.cpp36
-rw-r--r--qpid/cpp/src/qpid/amqp_0_10/Struct32.h64
-rw-r--r--qpid/cpp/src/qpid/amqp_0_10/Unit.cpp65
-rw-r--r--qpid/cpp/src/qpid/amqp_0_10/Unit.h82
-rw-r--r--qpid/cpp/src/qpid/amqp_0_10/UnitHandler.h35
-rw-r--r--qpid/cpp/src/qpid/amqp_0_10/UnknownStruct.cpp34
-rw-r--r--qpid/cpp/src/qpid/amqp_0_10/UnknownStruct.h55
-rw-r--r--qpid/cpp/src/qpid/amqp_0_10/UnknownType.cpp56
-rw-r--r--qpid/cpp/src/qpid/amqp_0_10/UnknownType.h87
-rw-r--r--qpid/cpp/src/qpid/amqp_0_10/apply.h86
-rw-r--r--qpid/cpp/src/qpid/amqp_0_10/built_in_types.h171
-rw-r--r--qpid/cpp/src/qpid/amqp_0_10/complex_types.cpp84
-rw-r--r--qpid/cpp/src/qpid/framing/TemplateVisitor.h89
-rw-r--r--qpid/cpp/src/qpid/framing/Visitor.h92
40 files changed, 2 insertions, 3396 deletions
diff --git a/qpid/cpp/rubygen/0-10/allsegmenttypes.rb b/qpid/cpp/rubygen/0-10/allsegmenttypes.rb
deleted file mode 100755
index 26363d6a1f..0000000000
--- a/qpid/cpp/rubygen/0-10/allsegmenttypes.rb
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/usr/bin/env ruby
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-$: << ".." # Include .. in load path
-require 'cppgen'
-
-class GenAllSegmentTypes < CppGen
- def initialize(outdir, amqp)
- super(outdir, amqp)
- end
-
- def generate
- h_file("tests/allSegmentTypes.h") {
- include "qpid/amqp_0_10/specification.h"
- include "qpid/amqp_0_10/Header.h"
- include "qpid/amqp_0_10/Body.h"
- genl
- genl "using namespace qpid::amqp_0_10;"
- genl
- scope("template <class Op> size_t allSegmentTypes(Op& op) {"){
- genl "op(Header());"
- genl "op(Body());"
- n = 2;
- @amqp.classes.each { |c|
- c.commands.each { |s| genl "op(CommandHolder(#{c.nsname}::#{s.classname}()));" }
- c.controls.each { |s| genl "op(ControlHolder(#{c.nsname}::#{s.classname}()));" }
- n += 2
- }
- genl "return #{n};"
- }
- }
- end
-end
-
-GenAllSegmentTypes.new($outdir, $amqp).generate();
-
diff --git a/qpid/cpp/rubygen/0-10/exceptions.rb b/qpid/cpp/rubygen/0-10/exceptions.rb
deleted file mode 100755
index fed8fdac5b..0000000000
--- a/qpid/cpp/rubygen/0-10/exceptions.rb
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/usr/bin/env ruby
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-$: << ".." # Include .. in load path
-require 'cppgen'
-
-class GenExceptions < CppGen
-
- def initialize(outdir, amqp)
- super(outdir, amqp)
- @ns="qpid::amqp_#{@amqp.version.bars}"
- @dir="qpid/amqp_#{@amqp.version.bars}"
- end
-
- def exceptions_for_enum(enum, base, ns, suffix="")
- enum.choices.each { |c|
- name=c.name.typename+suffix+"Exception"
- genl
- doxygen_comment { genl c.doc } if c.doc
- struct(name, "public #{base}") {
- genl "#{name}(const std::string& msg=std::string())"
- genl " : #{base}(#{ns}::#{c.name.shout}, msg) {}"
- protected
- genl "std::string getPrefix() const { return \"#{name}\"; }"
- }
- }
- end
-
- def gen_exceptions()
- h_file("#{@dir}/exceptions") {
- include "qpid/amqp_0_10/Exception"
- namespace("#{@ns}") {
- error_code = @amqp.class_("execution").domain("error-code").enum
- exceptions_for_enum(error_code, "SessionAbortedException", "execution")
- genl
-
- detach_code = @amqp.class_("session").domain("detach-code").enum
- exceptions_for_enum(detach_code, "SessionDetachedException", "session", "Detached")
-
- genl
- exceptions_for_enum(detach_code, "SessionExpiredException", "session", "Expired")
- genl
-
- close_code = @amqp.class_("connection").domain("close-code").enum
- exceptions_for_enum(close_code, "ConnectionException", "connection")
- }
- }
- end
-
- def generate()
- gen_exceptions
- end
-end
-
-GenExceptions.new($outdir, $amqp).generate();
-
-
diff --git a/qpid/cpp/rubygen/0-10/handlers.rb b/qpid/cpp/rubygen/0-10/handlers.rb
deleted file mode 100755
index 981ea890e6..0000000000
--- a/qpid/cpp/rubygen/0-10/handlers.rb
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/usr/bin/env ruby
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-$: << ".." # Include .. in load path
-require 'cppgen'
-
-class GenHandlers < CppGen
- def initialize(outdir, amqp)
- super(outdir, amqp)
- @ns="qpid::amqp_#{@amqp.version.bars}"
- @dir="qpid/amqp_#{@amqp.version.bars}"
- end
-
- def action_handler(type, actions)
- genl
- bases=actions.map { |a| "public #{a.fqclassname}::Handler" }
- struct("#{type}Handler", *bases) { }
- end
-
- def generate()
- h_file("#{@dir}/handlers.h") {
- include "#{@dir}/specification"
- namespace("#{@ns}") {
- action_handler "Command", @amqp.collect_all(AmqpCommand)
- action_handler "Control", @amqp.collect_all(AmqpControl)
- }
- }
- end
-end
-
-GenHandlers.new($outdir, $amqp).generate()
diff --git a/qpid/cpp/rubygen/0-10/specification.rb b/qpid/cpp/rubygen/0-10/specification.rb
deleted file mode 100755
index ef193f5fd0..0000000000
--- a/qpid/cpp/rubygen/0-10/specification.rb
+++ /dev/null
@@ -1,389 +0,0 @@
-#!/usr/bin/env ruby
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-$: << ".." # Include .. in load path
-require 'cppgen'
-
-
-# Dummy element representing an unknown struct type.
-class UnknownStruct
- def visitable?() true end
- def fqclassname() "UnknownStruct" end
-end
-
-# Dummy element representing a session.header field
-class SessionHeaderField
- def amqp2cpp() "session::Header" end
- def cppname() "sessionHeader" end
- def name() "session-header" end
-end
-
-class Specification < CppGen
- def initialize(outdir, amqp)
- super(outdir, amqp)
- @ns="qpid::amqp_#{@amqp.version.bars}"
- @dir="qpid/amqp_#{@amqp.version.bars}"
- end
-
- # domains
-
- def domain_h(d)
- genl
- typename=d.name.typename
- if d.enum
- scope("enum #{typename} {", "};") {
- genl d.enum.choices.map { |c|
- "#{c.name.constname} = #{c.value}" }.join(",\n")
- }
- scope("inline SerializeAs<#{typename}, uint8_t> serializable(#{typename}& e) {") {
- genl "return SerializeAs<#{typename}, uint8_t>(e);"
- }
- else
- genl "typedef #{d.amqp2cpp} #{typename};"
- end
- end
-
- def visitable?(x) x.code and x.size=="4" end
-
- # Used by structs, commands and controls.
- def action_struct_h(x, base, consts, &block)
- genl
- base = visitable?(x) ? ["public #{base}"] : []
- struct(x.classname, *base) {
- x.fields.each { |f| genl "#{f.amqp2cpp} #{f.cppname};" }
- genl
- genl "static const char* NAME;"
- consts.each {
- |c| genl "static const uint8_t #{c.upcase}=#{(x.send c) or 0};"
- }
- genl "static const uint8_t CLASS_CODE=#{x.containing_class.nsname}::CODE;"
- genl "static const char* CLASS_NAME;"
- ctor_decl("explicit #{x.classname}", x.parameters(true))
-
- if visitable? x
- genl "void accept(Visitor&);"
- genl "void accept(ConstVisitor&) const;"
- end
-
- if (x.fields.empty?)
- genl "template <class S> void serialize(S&) {}"
- else
- scope("template <class S> void serialize(S& s) {") {
- gen "s"; x.fields.each { |f| gen "(#{f.cppname})"}; genl ";"
- }
- end
- genl
- yield if block
- }
- case x
- when AmqpCommand then packer = "CommandPacker"
- when AmqpControl then packer = "Packer"
- when AmqpStruct then packer = "SizedPacker"
- end
- 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
-
- def action_struct_cpp(x, &block)
- genl
- genl "const char* #{x.classname}::NAME=\"#{x.fqname}\";"
- genl "const char* #{x.classname}::CLASS_NAME=#{x.containing_class.nsname}::NAME;"
- genl
- ctor=x.classname+"::"+x.classname
- ctor_defn(ctor, x.parameters, x.initializers) {}
-
- if visitable? x
- genl "void #{x.classname}::accept(Visitor& v) { v.visit(*this); }"
- genl "void #{x.classname}::accept(ConstVisitor& v) const { v.visit(*this); }"
- end
- genl
- 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 "return o;"
- }
- yield if block
- end
-
- # structs
-
- def struct_h(s) action_struct_h(s, "Struct", ["size","pack","code"]); end
- def struct_cpp(s) action_struct_cpp(s) end
-
- # command and control
-
- def action_h(a)
- action_struct_h(a, a.base, ["code"]) {
- struct("Handler") {
- scope("void #{a.funcname}(", ");") {
- genl a.parameters.join(",\n")
- }
- }
- function_defn("template <class T> void invoke", ["T& target"], "const") {
- genl "target.#{a.funcname}(#{a.values.join(', ')} );"
- }
- }
- end
-
- def action_cpp(a)
- action_struct_cpp(a) {
- scope("void #{a.classname}::Handler::#{a.funcname}(", ")") {
- genl a.unused_parameters.join(",\n")
- }
- scope {
- genl "assert(0);"
- genl "throw NotImplementedException(QPID_MSG(\"#{a.fqname} not implemented.\"));"
- }
- }
- end
-
- # Types that must be generated early because they are used by other types.
- def pregenerate?(x) not @amqp.used_by[x.fqname].empty?; end
-
- def pregenerate_class?(c)
- c.children.select{ |t| (t.is_a? AmqpStruct or t.is_a? AmqpDomain) and pregenerate? t}
- end
-
- # Typedefs, enums and forward declarations for classes.
- def gen_specification_fwd()
- h_file("#{@dir}/specification_fwd") {
- include "#{@dir}/built_in_types"
- namespace(@ns) {
- # Top level
- @amqp.domains.each { |d|
- # segment-type and track are are built in
- domain_h d unless ["track","segment-type"].include?(d.name)
- }
- each_class_ns { |c|
- genl "const uint8_t CODE=#{c.code};" # class code
- genl "extern const char* NAME;"
- c.each_descendant { |x|
- case x
- when AmqpDomain then domain_h x
- when AmqpStruct then genl "class #{x.classname};"
- when AmqpAction then genl "class #{x.classname};"
- end
- }
- }
- }
- }
- end
-
- # Generate struct definitions into a separate header file so the
- # can be included by StructHolder.h without circularity.
- def gen_structs()
- h_file("#{@dir}/structs") {
- include "#{@dir}/specification_fwd"
- include "#{@dir}/Map.h"
- include "#{@dir}/Array.h"
- include "#{@dir}/Struct.h"
- include "#{@dir}/UnknownStruct.h"
- include "#{@dir}/Packer.h"
- namespace(@ns) {
- each_class_ns { |c|
- c.collect_all(AmqpStruct).each { |s| struct_h s }
- }
- }
- }
-
- cpp_file("#{@dir}/structs") {
- include "#{@dir}/structs"
- include "#{@dir}/StructHolder"
- namespace(@ns) {
- each_class_ns { |c|
- c.collect_all(AmqpStruct).each { |s| struct_cpp(s) }
- }
- }
- }
- end
-
- # Generate the specification files
- def gen_specification()
- h_file("#{@dir}/specification") {
- include "#{@dir}/specification_fwd.h"
- include "#{@dir}/Map.h"
- include "#{@dir}/Array.h"
- include "#{@dir}/UnknownType.h"
- include "#{@dir}/Struct32"
- include "#{@dir}/Control.h"
- include "#{@dir}/Command.h"
- include "#{@dir}/Packer.h"
- include "<iosfwd>"
- namespace(@ns) {
- each_class_ns { |c|
- c.collect_all(AmqpAction).each { |a| action_h a }
- }
- }}
-
- cpp_file("#{@dir}/specification") {
- include "#{@dir}/specification"
- include "#{@dir}/exceptions"
- include "<iostream>"
- ["Command","Control", "Struct"].each { |x| include "#{@dir}/Apply#{x}" }
- namespace(@ns) {
- each_class_ns { |c|
- genl "const char* NAME=\"#{c.fqname}\";"
- c.actions.each { |a| action_cpp a}
- }
- }
- }
- end
-
- def gen_proxy()
- h_file("#{@dir}/ProxyTemplate.h") {
- include "#{@dir}/specification"
- namespace(@ns) {
- genl "template <class F, class R=typename F::result_type>"
- cpp_extern_class("QPID_COMMON_CLASS_EXTERN", "ProxyTemplate") {
- public
- genl "ProxyTemplate(F f=F()) : functor(f) {}"
- @amqp.classes.each { |c|
- c.actions.each { |a|
- genl
- function_defn("R #{a.funcname}", a.parameters) {
- var=a.name.funcname
- args = a.arguments.empty? ? "" : "("+a.arguments.join(", ")+")"
- genl("#{a.fqclassname} #{var}#{args};")
- genl "return functor(#{var});"
- }
- }
- }
- private
- genl "F functor;"
- }
- }
- }
- end
-
- def visitor_interface_h(base, subs, is_const)
- name="#{is_const ? 'Const' : ''}#{base}Visitor"
- const=is_const ? "const " : ""
- struct(name) {
- genl "virtual ~#{name}() {}"
- genl "typedef #{const}#{base} BaseType;"
- subs.each{ |s|
- genl "virtual void visit(#{const}#{s.fqclassname}&) = 0;"
- }}
- end
-
- def visitor_impl(base, subs, is_const)
- name="#{is_const ? 'Const' : ''}#{base}Visitor"
- const=is_const ? "const " : ""
- genl "template <class F>"
- struct("ApplyVisitor<#{name}, F>", "public ApplyVisitorBase<#{name}, F>") {
- subs.each{ |s|
- genl "virtual void visit(#{const}#{s.fqclassname}& x) { this->invoke(x); }"
- }}
- end
-
- def gen_visitor(base, subs)
- h_file("#{@dir}/#{base}Visitor.h") {
- include base=="Struct" ? "#{@dir}/structs" : "#{@dir}/specification"
- namespace("#{@ns}") {
- visitor_interface_h(base, subs, false)
- visitor_interface_h(base, subs, true)
- }}
-
- h_file("#{@dir}/Apply#{base}.h") {
- include "#{@dir}/#{base}Visitor.h"
- include "#{@dir}/apply.h"
- namespace("#{@ns}") {
- visitor_impl(base, subs, false)
- visitor_impl(base, subs, true)
- }
- }
- end
-
- def gen_holder(base, subs)
- name=base+"Holder"
- h_file("#{@dir}/#{name}") {
- include "#{@dir}/Apply#{base}"
- include "#{@dir}/Holder"
- include base=="Struct" ? "#{@dir}/structs" : "#{@dir}/specification"
- namespace(@ns){
- namespace("#{base.downcase}_max") {
- genl "static const size_t MAX000=0;"
- last="MAX000"
- subs.each { |s|
- sizeof="sizeof(#{s.fqclassname})"
- genl "static const size_t #{last.succ} = #{sizeof} > #{last} ? #{sizeof} : #{last};"
- last.succ!
- }
- genl "static const int MAX=#{last};"
- }
- holder_base="amqp_0_10::Holder<#{name}, #{base}, #{base.downcase}_max::MAX>"
- struct("#{name}", "public #{holder_base}") {
- genl "#{name}() {}"
- 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);"
- }
- genl
- genl "std::ostream& operator<<(std::ostream& o, const #{name}& h);"
- }
- }
-
- cpp_file("#{@dir}/#{name}") {
- include "#{@dir}/#{name}"
- include "#{@dir}/exceptions.h"
- namespace(@ns) {
- genl "using framing::in_place;"
- genl
- scope("void #{name}::set(uint8_t classCode, uint8_t code) {") {
- genl "uint16_t key=(classCode<<8)+code;"
- scope ("switch(key) {") {
- subs.each { |s|
- genl "case 0x#{s.full_code.to_s(16)}: *this=in_place<#{s.fqclassname}>(); break;" unless (s.is_a? UnknownStruct)
- }
- genl "default: "
- indent {
- if (base=="Struct")
- genl "*this=in_place<UnknownStruct>(classCode, code);"
- else
- genl "throw CommandInvalidException(QPID_MSG(\"Invalid class-#{base.downcase} key \" << std::hex << key));"
- end
- }
- }
- }
- genl
- genl "std::ostream& operator<<(std::ostream& o, const #{name}& h) { return h.get() ? (o << *h.get()) : (o << \"<empty #{name}>\"); }"
- }
- }
- end
-
- def gen_visitable(base, subs)
- subs << UnknownStruct.new if base=="Struct" # Extra case for unknown structs.
- gen_holder(base, subs)
- gen_visitor(base, subs)
- end
-
- def generate
- gen_specification_fwd
- gen_specification
- gen_proxy
- gen_structs
- gen_visitable("Command", @amqp.collect_all(AmqpCommand))
- gen_visitable("Control", @amqp.collect_all(AmqpControl))
- gen_visitable("Struct", @amqp.collect_all(AmqpStruct).select { |s| s.code})
- end
-end
-
-Specification.new($outdir, $amqp).generate();
diff --git a/qpid/cpp/rubygen/0-10/typecode.rb b/qpid/cpp/rubygen/0-10/typecode.rb
deleted file mode 100755
index 0ab9c4be5d..0000000000
--- a/qpid/cpp/rubygen/0-10/typecode.rb
+++ /dev/null
@@ -1,117 +0,0 @@
-#!/usr/bin/env ruby
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-$: << ".." # Include .. in load path
-require 'cppgen'
-
-class TypeCode < CppGen
- def initialize(outdir, amqp)
- super(outdir, amqp)
- @ns="qpid::amqp_#{@amqp.version.bars}"
- @dir="qpid/amqp_#{@amqp.version.bars}"
- @types = @amqp.collect_all(AmqpType).select { |t| t.code }
-
- end
-
- def type_for_code_h()
- h_file("#{@dir}/TypeForCode") {
- include "#{@dir}/built_in_types.h"
- include "#{@dir}/UnknownType.h"
- namespace(@ns) {
- genl
- genl "template <uint8_t Code> struct TypeForCode;"
- genl
- @types.each { |t|
- genl "template <> struct TypeForCode<#{t.code}> { typedef #{t.typename} type; };"
- }
- genl
- genl "template <class V> typename V::result_type"
- scope("apply_visitor(V& visitor, uint8_t code) {") {
- scope("switch (code) {", "}") {
- @types.each { |t|
- genl "case #{t.code}: return visitor((#{t.typename}*)0);"
- }
- genl "default: return visitor((UnknownType*)0);"
- }
- }
- genl
- genl "std::string typeName(uint8_t code);"
- }
- }
- end
-
- def type_for_code_cpp()
- cpp_file("#{@dir}/TypeForCode") {
- include "<string>"
- include "<sstream>"
- namespace(@ns) {
- namespace("") {
- struct("Names") {
- scope("Names() {") {
- scope("for (int i =0; i < 256; ++i) {") {
- genl "std::ostringstream os;"
- genl "os << \"UnknownType<\" << i << \">\";"
- genl "names[i] = os.str();"
- }
- @types.each { |t| genl "names[#{t.code}] = \"#{t.name}\";" }
- }
- genl "std::string names[256];"
- }
- genl "Names names;"
- }
- genl "std::string typeName(uint8_t code) { return names.names[code]; }"
- }}
- end
-
- def code_for_type_h()
- name="#{@dir}/CodeForType"
- h_file(name) {
- include "#{@dir}/built_in_types.h"
-
- namespace(@ns) {
- genl
- genl "template <class T> struct CodeForType;"
- genl
- @types.each { |t|
- genl "template <> struct CodeForType<#{t.typename}> { static const uint8_t value; };"
- }
- genl
- genl "template <class T> uint8_t codeFor(const T&) { return CodeForType<T>::value; }"
- }
- }
-
- cpp_file(name) {
- include name
- namespace(@ns) {
- @types.each { |t|
- genl "const uint8_t CodeForType<#{t.typename}>::value=#{t.code};"
- }
- }
- }
- end
-
- def generate
- type_for_code_h
- type_for_code_cpp
- code_for_type_h
- end
-end
-
-TypeCode.new($outdir, $amqp).generate();
-
diff --git a/qpid/cpp/rubygen/generate b/qpid/cpp/rubygen/generate
index 89b9b99520..3ab22e4fda 100755
--- a/qpid/cpp/rubygen/generate
+++ b/qpid/cpp/rubygen/generate
@@ -140,21 +140,6 @@ EOS
rgen_subdirs.each_key { |subdir|
out << "\nset(rgen_#{subdir}_srcs #{cmake_continue(rgen_subdirs[subdir])})\n"
}
- out << <<EOS
-set(rgen_srcs #{cmake_continue rgen_srcs})
-
-# Header file install rules.
-EOS
- ["amqp_0_10", "framing", "client/no_keyword","client", "broker"].each { |ns|
- dir="qpid/#{ns}"
- dir_ = dir.tr("/", "_")
- regex=%r|#{dir}/[^/]+\.h$|
- out << <<EOS
-set(#{dir_}dir \${includedir}/#{dir})
-set(dist_#{dir_}_HEADERS #{cmake_continue rgen_srcs.grep(regex)})
-
-EOS
- } # each
} # File makefile
end # if (makefile)
end
diff --git a/qpid/cpp/src/qpid/amqp_0_10/Array.cpp b/qpid/cpp/src/qpid/amqp_0_10/Array.cpp
deleted file mode 100644
index 2ee47546f2..0000000000
--- a/qpid/cpp/src/qpid/amqp_0_10/Array.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "qpid/amqp_0_10/Array.h"
-
-namespace qpid {
-namespace amqp_0_10 {
-
-std::ostream& operator<<(std::ostream& o, const Array& a) {
- std::ostream_iterator<UnknownType> i(o, " ");
- o << "Array<" << typeName(a.getType()) << "[";
- std::copy(a.begin(), a.end(), i);
- o << "]";
- return o;
-}
-
-}} // namespace qpid::amqp_0_10
diff --git a/qpid/cpp/src/qpid/amqp_0_10/Array.h b/qpid/cpp/src/qpid/amqp_0_10/Array.h
deleted file mode 100644
index 6e8a419df7..0000000000
--- a/qpid/cpp/src/qpid/amqp_0_10/Array.h
+++ /dev/null
@@ -1,124 +0,0 @@
-#ifndef QPID_AMQP_0_10_ARRAY_H
-#define QPID_AMQP_0_10_ARRAY_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/amqp_0_10/TypeForCode.h"
-#include "qpid/amqp_0_10/CodeForType.h"
-#include "qpid/amqp_0_10/UnknownType.h"
-#include "qpid/amqp_0_10/exceptions.h"
-#include "qpid/amqp_0_10/Codec.h"
-#include <vector>
-#include <ostream>
-
-namespace qpid {
-namespace amqp_0_10 {
-
-template <class T> class ArrayDomain : public std::vector<T> {
- public:
- template <class S> void serialize(S& s) { s.split(*this); }
-
- template <class S> void encode(S& s) const {
- s(contentSize())(CodeForType<T>::value)(uint32_t(this->size()));
- s(this->begin(), this->end());
- }
-
- void encode(Codec::Size& s) const { s.raw(0, contentSize() + 4/*size*/); }
-
- template <class S> void decode(S& s) {
- uint32_t size; uint8_t type; uint32_t count;
- s(size);
- typename S::ScopedLimit l(s, size);
- s(type);
- if (type != CodeForType<T>::value)
- throw InvalidArgumentException(QPID_MSG("Array domain expected type " << CodeForType<T>::value << " but found " << type));
- s(count);
- this->resize(count);
- s(this->begin(), this->end());
- }
-
- private:
- uint32_t contentSize() const {
- return Codec::size(this->begin(), this->end()) + sizeof(uint32_t) /*count*/ + sizeof(uint8_t) /*type*/;
- }
-};
-
-template <class T>
-std::ostream& operator<<(std::ostream& o, const ArrayDomain<T>& ad) {
- std::ostream_iterator<T> i(o, " ");
- o << "Array<" << typeName(CodeForType<T>::value) << ">[";
- std::copy(ad.begin(), ad.end(), i);
- o << "]";
- return o;
-}
-
-/** A non-domain array is represented as and array of UnknownType.
- * Special case templat.
- */
-template<> class ArrayDomain<UnknownType> : public std::vector<UnknownType> {
- public:
- ArrayDomain(uint8_t type_=0) : type(type_) {}
-
- template <class S> void serialize(S& s) { s.split(*this); }
-
- template <class S> void encode(S& s) const {
- s(contentSize())(type)(uint32_t(this->size()));
- s(this->begin(), this->end());
- }
-
- void encode(Codec::Size& s) const { s.raw(0, contentSize() + 4/*size*/); }
-
- template <class S> void decode(S& s) {
- uint32_t size; uint32_t count;
- s(size);
- typename S::ScopedLimit l(s, size);
- s(type)(count);
- this->clear();
- this->resize(count, UnknownType(type));
- s(this->begin(), this->end());
- }
-
- uint8_t getType() const { return type; }
-
- private:
- uint32_t contentSize() const {
- return Codec::size(this->begin(), this->end()) + sizeof(uint32_t) /*count*/ + sizeof(uint8_t) /*type*/;
- }
- uint8_t type;
-};
-
-std::ostream& operator<<(std::ostream& o, const Array& a);
-
-// FIXME aconway 2008-04-08: hack to supress encoding of
-// command-fragments and in-doubt as there is a problem with the spec
-// (command-fragments does not have a one byte type code.)
-namespace session { class CommandFragment; }
-namespace dtx { class Xid; }
-
-template <> struct ArrayDomain<session::CommandFragment> : public Void {};
-template <> struct ArrayDomain<dtx::Xid> : public Void {};
-inline std::ostream& operator<<(std::ostream& o, const ArrayDomain<session::CommandFragment>&) { return o; }
-inline std::ostream& operator<<(std::ostream& o, const ArrayDomain<dtx::Xid>&) { return o; }
-
-}} // namespace qpid::amqp_0_10
-
-#endif /*!QPID_AMQP_0_10_ARRAY_H*/
diff --git a/qpid/cpp/src/qpid/amqp_0_10/Body.h b/qpid/cpp/src/qpid/amqp_0_10/Body.h
deleted file mode 100644
index c96931551c..0000000000
--- a/qpid/cpp/src/qpid/amqp_0_10/Body.h
+++ /dev/null
@@ -1,55 +0,0 @@
-#ifndef QPID_AMQP_0_10_BODY_H
-#define QPID_AMQP_0_10_BODY_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include <string>
-#include <ostream>
-
-namespace qpid {
-namespace amqp_0_10 {
-
-/** Holds data from a body frame. */
-class Body {
- public:
- Body() {}
- Body(size_t size_) : str(size_, '\0') {}
- Body(const char* data_, size_t size_) : str(data_, size_) {}
-
- size_t size() const { return str.size(); };
- const char* data() const { return str.data(); }
- char* data() { return const_cast<char*>(str.data()); }
-
- template <class S> void serialize(S& s) { s.raw(data(), size()); }
-
- private:
- std::string str;
-
- friend std::ostream& operator<<(std::ostream&, const Body&);
-};
-
-inline std::ostream& operator<<(std::ostream& o, const Body& b) {
- return o << b.str.substr(0, 16) << "... (" << b.size() << ")";
-}
-
-}} // namespace qpid::amqp_0_10
-
-#endif /*!QPID_AMQP_0_10_BODY_H*/
diff --git a/qpid/cpp/src/qpid/amqp_0_10/Codec.h b/qpid/cpp/src/qpid/amqp_0_10/Codec.h
deleted file mode 100644
index fd006a348e..0000000000
--- a/qpid/cpp/src/qpid/amqp_0_10/Codec.h
+++ /dev/null
@@ -1,213 +0,0 @@
-#ifndef QPID_AMQP_0_10_CODEC_H
-#define QPID_AMQP_0_10_CODEC_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/amqp_0_10/built_in_types.h"
-#include "qpid/Serializer.h"
-#include <boost/type_traits/is_integral.hpp>
-#include <boost/type_traits/is_float.hpp>
-#include <boost/type_traits/is_arithmetic.hpp>
-#include <boost/detail/endian.hpp>
-#include <boost/static_assert.hpp>
-#include <iterator>
-
-namespace qpid {
-namespace amqp_0_10 {
-
-template <class T> void reverse(T& t) {
- char*p =reinterpret_cast<char*>(&t);
- std::reverse(p, p+sizeof(T));
-}
-
-#ifdef BOOST_LITTLE_ENDIAN
-template <class T> void bigEndian(T& t) { reverse(t); }
-template <class T> void littleEndian(T&) {}
-#else
-template <class T> void littleEndian(T& t) { reverse(t); }
-template <class T> void bigEndian(T&) {}
-#endif
-
-/**
- * AMQP 0-10 encoding and decoding.
- */
-struct Codec {
- /** Encode to an output byte iterator */
- template <class OutIter>
- class Encoder : public EncoderBase<Encoder<OutIter> >
- {
- public:
- typedef EncoderBase<Encoder<OutIter> > Base;
- typedef OutIter Iterator;
-
- Encoder(OutIter o, size_t limit=Base::maxLimit()) : out(o) {
- this->setLimit(limit);
- }
-
- using EncoderBase<Encoder<OutIter> >::operator();
-
- Encoder& operator()(bool x) { raw(x); return *this;}
- Encoder& operator()(char x) { raw(x); return *this; }
- Encoder& operator()(int8_t x) { raw(x); return *this; }
- Encoder& operator()(uint8_t x) { raw(x); return *this; }
-
- Encoder& operator()(int16_t x) { return networkByteOrder(x); }
- Encoder& operator()(int32_t x) { return networkByteOrder(x); }
- Encoder& operator()(int64_t x) { return networkByteOrder(x); }
-
- Encoder& operator()(uint16_t x) { return networkByteOrder(x); }
- Encoder& operator()(uint32_t x) { return networkByteOrder(x); }
- Encoder& operator()(uint64_t x) { return networkByteOrder(x); }
-
- Encoder& operator()(float x) { return networkByteOrder(x); }
- Encoder& operator()(double x) { return networkByteOrder(x); }
-
- void raw(const void* p, size_t n) {
- this->addBytes(n);
- out = std::copy((const char*)p, (const char*)p+n, out);
- }
-
- void raw(char b) { this->addBytes(1); *out++=b; }
-
- template <class T> Encoder& littleEnd(T x) {
- littleEndian(x); raw(&x, sizeof(x)); return *this;
- }
-
- OutIter pos() const { return out; }
-
- private:
-
- template <class T> Encoder& networkByteOrder(T x) {
- bigEndian(x); raw(&x, sizeof(x)); return *this;
- }
-
- OutIter out;
- };
-
- template <class InIter>
- class Decoder : public DecoderBase<Decoder<InIter> > {
- public:
- typedef DecoderBase<Decoder<InIter> > Base;
- typedef InIter Iterator;
-
- Decoder(InIter i, size_t limit=Base::maxLimit()) : in(i) {
- this->setLimit(limit);
- }
-
- using DecoderBase<Decoder<InIter> >::operator();
-
- // FIXME aconway 2008-03-10: wrong encoding, need packing support
- Decoder& operator()(bool& x) { raw((char&)x); return *this; }
-
- Decoder& operator()(char& x) { raw((char&)x); return *this; }
- Decoder& operator()(int8_t& x) { raw((char&)x); return *this; }
- Decoder& operator()(uint8_t& x) { raw((char&)x); return *this; }
-
- Decoder& operator()(int16_t& x) { return networkByteOrder(x); }
- Decoder& operator()(int32_t& x) { return networkByteOrder(x); }
- Decoder& operator()(int64_t& x) { return networkByteOrder(x); }
-
- Decoder& operator()(uint16_t& x) { return networkByteOrder(x); }
- Decoder& operator()(uint32_t& x) { return networkByteOrder(x); }
- Decoder& operator()(uint64_t& x) { return networkByteOrder(x); }
-
- Decoder& operator()(float& x) { return networkByteOrder(x); }
- Decoder& operator()(double& x) { return networkByteOrder(x); }
-
- void raw(void *p, size_t n) {
- this->addBytes(n);
- std::copy(in, in+n, (char*)p);
- std::advance(in, n);
- }
-
- void raw(char &b) { this->addBytes(1); b=*in++; }
-
- template <class T> Decoder& littleEnd(T& x) {
- raw(&x, sizeof(x)); littleEndian(x); return *this;
- }
-
- InIter pos() const { return in; }
-
- private:
-
- template <class T> Decoder& networkByteOrder(T& x) {
- raw(&x, sizeof(x)); bigEndian(x); return *this;
- }
-
- InIter in;
- };
-
-
- class Size : public EncoderBase<Size> {
- public:
- Size() : size(0) {}
-
- operator size_t() const { return size; }
-
- using EncoderBase<Size>::operator();
-
- // FIXME aconway 2008-03-10: wrong encoding, need packing support
- Size& operator()(bool x) { size += sizeof(x); return *this; }
-
- Size& operator()(char x) { size += sizeof(x); return *this; }
- Size& operator()(int8_t x) { size += sizeof(x); return *this; }
- Size& operator()(uint8_t x) { size += sizeof(x); return *this; }
-
- Size& operator()(int16_t x) { size += sizeof(x); return *this; }
- Size& operator()(int32_t x) { size += sizeof(x); return *this; }
- Size& operator()(int64_t x) { size += sizeof(x); return *this; }
-
- Size& operator()(uint16_t x) { size += sizeof(x); return *this; }
- Size& operator()(uint32_t x) { size += sizeof(x); return *this; }
- Size& operator()(uint64_t x) { size += sizeof(x); return *this; }
-
- Size& operator()(float x) { size += sizeof(x); return *this; }
- Size& operator()(double x) { size += sizeof(x); return *this; }
-
- // FIXME aconway 2008-04-03: optimize op()(Iter,Iter)
- // for Iter with fixed-size value_type:
- // distance(begin,end)*sizeof(value_type)
-
- void raw(const void*, size_t n){ size += n; }
-
- template <class T> Size& littleEnd(T) { size+= sizeof(T); return *this; }
-
- private:
- size_t size;
- };
-
- // FIXME aconway 2008-03-11: rename to encoder(), decoder()
- template <class InIter> static Decoder<InIter> decode(const InIter &i) {
- return Decoder<InIter>(i);
- }
-
- template <class OutIter> static Encoder<OutIter> encode(OutIter i) {
- return Encoder<OutIter>(i);
- }
-
- template <class T> static size_t size(const T& x) { return Size()(x); }
- template <class Iter> static size_t size(const Iter& a, const Iter& z) { return Size()(a,z); }
-};
-
-}} // namespace qpid::amqp_0_10
-
-#endif /*!QPID_AMQP_0_10_CODEC_H*/
diff --git a/qpid/cpp/src/qpid/amqp_0_10/Command.h b/qpid/cpp/src/qpid/amqp_0_10/Command.h
deleted file mode 100644
index b1d3607a84..0000000000
--- a/qpid/cpp/src/qpid/amqp_0_10/Command.h
+++ /dev/null
@@ -1,62 +0,0 @@
-#ifndef QPID_AMQP_0_10_COMMAND_H
-#define QPID_AMQP_0_10_COMMAND_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/amqp_0_10/Control.h"
-#include "qpid/amqp_0_10/structs.h"
-
-namespace qpid {
-namespace amqp_0_10 {
-
-struct CommandVisitor;
-struct ConstCommandVisitor;
-struct CommandHolder;
-struct Command
- : public Action,
- public Visitable<CommandVisitor, ConstCommandVisitor, CommandHolder>
-{
- using Action::getCommand;
- Command* getCommand() { return this; }
- uint8_t getCode() const;
- uint8_t getClassCode() const;
- const char* getName() const;
- const char* getClassName() const;
-
- session::Header sessionHeader;
-};
-
-std::ostream& operator<<(std::ostream&, const Command&);
-
-template <class T>
-struct CommandPacker : Packer<T> {
- CommandPacker(T& t) : Packer<T>(t) {}
-
- template <class S> void serialize(S& s) {
- s(this->data.sessionHeader);
- Packer<T>::serialize(s);
- }
-};
-
-}} // namespace qpid::amqp_0_10
-
-#endif /*!QPID_AMQP_0_10_COMMAND_H*/
diff --git a/qpid/cpp/src/qpid/amqp_0_10/CommmandPacker.h b/qpid/cpp/src/qpid/amqp_0_10/CommmandPacker.h
deleted file mode 100644
index 51ebfe8186..0000000000
--- a/qpid/cpp/src/qpid/amqp_0_10/CommmandPacker.h
+++ /dev/null
@@ -1,60 +0,0 @@
-#ifndef QPID_AMQP_0_10_COMMMANDPACKER_H
-#define QPID_AMQP_0_10_COMMMANDPACKER_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/amqp_0_10/structs.h"
-
-namespace qpid {
-namespace amqp_0_10 {
-
-/**
- * Packer for commands - serialize session.header before pack bits.
- */
-template <class T>
-class CommmandPacker : public Packer<T>
-{
- public:
- CommmandPacker(T& t) : Packer<T>(t) {}
- template <class S> void serialize(S& s) { s.split(*this); }
-
- template <class S> void encode(S& s) const {
- s.sessionHeader(
- Packer<T>::encode(s);
- }
-
- template <class S> void decode(S& s) {
- Bits bits;
- s.littleEnd(bits);
- PackedDecoder<S, Bits> decode(s, bits);
- data.serialize(decode);
- }
-
-
- protected:
- T& data;
-
-
-};
-}} // namespace qpid::amqp_0_10
-
-#endif /*!QPID_AMQP_0_10_COMMMANDPACKER_H*/
diff --git a/qpid/cpp/src/qpid/amqp_0_10/Connection.cpp b/qpid/cpp/src/qpid/amqp_0_10/Connection.cpp
index 751ca15b74..5ff73b2d4d 100644
--- a/qpid/cpp/src/qpid/amqp_0_10/Connection.cpp
+++ b/qpid/cpp/src/qpid/amqp_0_10/Connection.cpp
@@ -20,7 +20,7 @@
*/
#include "qpid/amqp_0_10/Connection.h"
#include "qpid/log/Statement.h"
-#include "qpid/amqp_0_10/exceptions.h"
+#include "qpid/framing/reply_exceptions.h"
#include "qpid/framing/AMQFrame.h"
#include "qpid/framing/Buffer.h"
#include "qpid/framing/ProtocolInitiation.h"
@@ -28,6 +28,7 @@
namespace qpid {
namespace amqp_0_10 {
+using framing::InternalErrorException;
using sys::Mutex;
Connection::Connection(sys::OutputControl& o, const std::string& id, bool _isClient)
diff --git a/qpid/cpp/src/qpid/amqp_0_10/Control.h b/qpid/cpp/src/qpid/amqp_0_10/Control.h
deleted file mode 100644
index ce188ae6d8..0000000000
--- a/qpid/cpp/src/qpid/amqp_0_10/Control.h
+++ /dev/null
@@ -1,70 +0,0 @@
-#ifndef QPID_AMQP_0_10_CONTROL_H
-#define QPID_AMQP_0_10_CONTROL_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/amqp_0_10/Struct.h"
-
-namespace qpid {
-namespace amqp_0_10 {
-
-struct Command;
-struct Control;
-
-struct Action { // Base for commands & controls
- virtual ~Action() {}
- virtual Command* getCommand() { return 0; }
- virtual Control* getControl() { return 0; }
-
- virtual const Command* getCommand() const {
- return const_cast<Action*>(this)->getCommand();
- }
- virtual const Control* getControl() const {
- return const_cast<Action*>(this)->getControl();
- }
- static const uint8_t SIZE=0;
- static const uint8_t PACK=2;
-};
-
-struct ControlVisitor;
-struct ConstControlVisitor;
-struct ControlHolder;
-struct Control
- : public Action,
- public Visitable<ControlVisitor, ConstControlVisitor, ControlHolder>
-{
- using Action::getControl;
- Control* getControl() { return this; }
- uint8_t getCode() const;
- uint8_t getClassCode() const;
- const char* getName() const;
- const char* getClassName() const;
-};
-std::ostream& operator<<(std::ostream&, const Control&);
-
-template <SegmentType E> struct ActionType;
-template <> struct ActionType<CONTROL> { typedef Control type; };
-template <> struct ActionType<COMMAND> { typedef Command type; };
-
-}} // namespace qpid::amqp_0_10
-
-#endif /*!QPID_AMQP_0_10_CONTROL_H*/
diff --git a/qpid/cpp/src/qpid/amqp_0_10/Decimal.h b/qpid/cpp/src/qpid/amqp_0_10/Decimal.h
deleted file mode 100644
index 50fc457c76..0000000000
--- a/qpid/cpp/src/qpid/amqp_0_10/Decimal.h
+++ /dev/null
@@ -1,51 +0,0 @@
-#ifndef TESTS_DECIMAL_H
-#define TESTS_DECIMAL_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include <ostream>
-
-namespace qpid {
-namespace amqp_0_10 {
-
-template <class E, class M> struct Decimal {
- E exponent;
- M mantissa;
-
- Decimal(E exp=0, M man=0) : exponent(exp), mantissa(man) {}
-
- bool operator==(const Decimal& d) const {
- return exponent == d.exponent && mantissa == d.mantissa;
- }
-
- // TODO aconway 2008-02-20: We could provide arithmetic operators
- // if anybody really cares about this type.
-
- template <class S> void serialize(S& s) { s(exponent)(mantissa); }
-};
-
-template<class E, class M>
-inline std::ostream& operator<<(std::ostream& o, const Decimal<E,M>& d) {
- return o << "Decimal{" << d.mantissa << "/10^" << (int)d.exponent << "}";
-}
-}}
-
-#endif /*!TESTS_DECIMAL_H*/
diff --git a/qpid/cpp/src/qpid/amqp_0_10/Exception.h b/qpid/cpp/src/qpid/amqp_0_10/Exception.h
deleted file mode 100644
index 6d526c1706..0000000000
--- a/qpid/cpp/src/qpid/amqp_0_10/Exception.h
+++ /dev/null
@@ -1,96 +0,0 @@
-#ifndef QPID_AMQP_0_10_EXCEPTION_H
-#define QPID_AMQP_0_10_EXCEPTION_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/Exception.h"
-#include "qpid/amqp_0_10/specification_fwd.h"
-
-namespace qpid {
-namespace amqp_0_10 {
-
-/**
- * Raised when the connection is unexpectedly closed. Sessions with
- * non-0 timeout may be available for re-attachment on another connection.
- */
-struct ConnectionException : public qpid::Exception {
- // FIXME aconway 2008-04-04: Merge qpid::ConnectionException
- // into this when the old code is removed.
- typedef connection::CloseCode Code;
- ConnectionException(Code c, const std::string m)
- : qpid::Exception(m), code(c) {}
- Code code;
-};
-
-/**
- * Raised when a session is unexpectedly detached for any reason, or
- * if an attempt is made to use a session that is not attached.
- */
-struct SessionException : public qpid::Exception {
- // FIXME aconway 2008-04-04: should not have a code at this level.
- // Leave in place till old preview code is gone.
- SessionException(int /*code*/, const std::string& msg) : qpid::Exception(msg) {}
-};
-
-/** Raised when the state of a session has been destroyed */
-struct SessionDestroyedException : public SessionException {
- // FIXME aconway 2008-04-04: should not have a code at this level.
- // Leave in place till old preview code is gone.
- SessionDestroyedException(int code, const std::string& msg) : SessionException(code, msg){}
-};
-
-/** Raised when a session is destroyed due to an execution.exception */
-struct SessionAbortedException : public SessionDestroyedException {
- typedef execution::ErrorCode Code;
- SessionAbortedException(Code c, const std::string m)
- : SessionDestroyedException(c, m), code(c) {}
- Code code;
-};
-
-/**
- * Raised when a session with 0 timeout is unexpectedly detached
- * and therefore expires and is destroyed.
- */
-struct SessionExpiredException : public SessionDestroyedException {
- typedef session::DetachCode Code;
- SessionExpiredException(Code c, const std::string m)
- : SessionDestroyedException(c, m), code(c) {}
- Code code;
-};
-
-/**
- * Raised when a session with non-0 timeout is unexpectedly detached
- * or if an attempt is made to use a session that is not attached.
- *
- * The session is not necessarily destroyed, it may be possible to
- * re-attach.
- */
-struct SessionDetachedException : public SessionException {
- typedef session::DetachCode Code;
- SessionDetachedException(Code c, const std::string m)
- : SessionException(c, m), code(c) {}
- Code code;
-};
-
-}} // namespace qpid::amqp_0_10
-
-#endif /*!QPID_AMQP_0_10_EXCEPTION_H*/
diff --git a/qpid/cpp/src/qpid/amqp_0_10/FrameHeader.cpp b/qpid/cpp/src/qpid/amqp_0_10/FrameHeader.cpp
deleted file mode 100644
index 371e3c1bcb..0000000000
--- a/qpid/cpp/src/qpid/amqp_0_10/FrameHeader.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "qpid/amqp_0_10/FrameHeader.h"
-#include <ios>
-#include <iomanip>
-#include <ostream>
-
-using namespace std;
-
-namespace qpid {
-namespace amqp_0_10 {
-
-bool FrameHeader::operator==(const FrameHeader& x) const {
- return flags == x.flags &&
- type == x.type &&
- size == x.size &&
- track == x.track &&
- channel == x.channel;
-}
-
-std::ostream& operator<<(std::ostream& o, const FrameHeader& f) {
- std::ios::fmtflags saveFlags = o.flags();
- return o << "Frame["
- << "flags=" << std::hex << std::showbase << int(f.getFlags()) << std::setiosflags(saveFlags)
- << " type=" << f.getType()
- << " size=" << f.getSize()
- << " track=" << int(f.getTrack())
- << " channel=" << f.getChannel()
- << "]";
-}
-
-}} // namespace qpid::amqp_0_10
diff --git a/qpid/cpp/src/qpid/amqp_0_10/FrameHeader.h b/qpid/cpp/src/qpid/amqp_0_10/FrameHeader.h
deleted file mode 100644
index b2f0619f9b..0000000000
--- a/qpid/cpp/src/qpid/amqp_0_10/FrameHeader.h
+++ /dev/null
@@ -1,90 +0,0 @@
-#ifndef QPID_AMQP_0_10_FRAMEHEADER_H
-#define QPID_AMQP_0_10_FRAMEHEADER_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/amqp_0_10/built_in_types.h"
-#include <boost/shared_array.hpp>
-#include <string.h>
-#include <assert.h>
-#include <iosfwd>
-
-namespace qpid {
-namespace amqp_0_10 {
-
-enum FrameFlags { FIRST_SEGMENT=8, LAST_SEGMENT=4, FIRST_FRAME=2, LAST_FRAME=1 };
-
-class FrameHeader {
- public:
- static const size_t SIZE=12;
- static uint8_t trackFor(SegmentType type) { return type == 0 ? 0 : 1; }
-
- FrameHeader(uint8_t flags_=0, SegmentType type_=SegmentType(), uint16_t size_=0, uint8_t track_=0, uint16_t channel_=0)
- : flags(flags_), type(type_), size(size_), track(track_), channel(channel_)
- {}
-
- uint8_t getFlags() const { return flags; }
- SegmentType getType() const { return type; }
- /** @return size total size of of frame, including frame header. */
- uint16_t getSize() const { return size; }
- /** @return size of frame data, excluding frame header. */
- uint16_t getDataSize() const { return size - SIZE; }
- uint8_t getTrack() const { return track; }
- uint16_t getChannel() const { return channel; }
-
- void setFlags(uint8_t flags_) { flags=flags_; }
- /** Also sets the track. There is no setTrack() */
- void setType(SegmentType type_) { type=type_; track=trackFor(type); }
- /** @param size total size of of frame, including frame header. */
- void setSize(uint16_t size_) { size = size_; }
- /** @param size size of frame data, excluding frame header. */
- void setDataSize(uint16_t size_) { size = size_+SIZE; }
- void setChannel(uint8_t channel_) { channel=channel_; }
-
- bool allFlags(uint8_t f) const { return (flags & f) == f; }
- bool anyFlags(uint8_t f) const { return (flags & f); }
-
- void raiseFlags(uint8_t f) { flags |= f; }
- void clearFlags(uint8_t f) { flags &= ~f; }
-
- bool isComplete() const { return allFlags(FIRST_FRAME | LAST_FRAME); }
-
- bool operator==(const FrameHeader&) const;
-
- template <class S> void serialize(S& s) {
- uint8_t pad8=0; uint32_t pad32=0;
- s(flags)(type)(size)(pad8)(track)(channel)(pad32);
- }
-
- private:
- uint8_t flags;
- SegmentType type;
- uint16_t size;
- uint8_t track;
- uint16_t channel;
-};
-
-std::ostream& operator<<(std::ostream&, const FrameHeader&);
-
-}} // namespace qpid::amqp_0_10
-
-#endif /*!QPID_AMQP_0_10_FRAMEHEADER_H*/
diff --git a/qpid/cpp/src/qpid/amqp_0_10/Header.cpp b/qpid/cpp/src/qpid/amqp_0_10/Header.cpp
deleted file mode 100644
index d83814e969..0000000000
--- a/qpid/cpp/src/qpid/amqp_0_10/Header.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "qpid/amqp_0_10/Header.h"
-
-namespace qpid {
-namespace amqp_0_10 {
-
-std::ostream& operator<<(std::ostream& o, const Header& h) {
- o << "Header[";
- std::ostream_iterator<Struct32> i(o, " ");
- std::copy(h.begin(), h.end(), i);
- o << "]";
- return o;
-}
-
-}} // namespace qpid::amqp_0_10
diff --git a/qpid/cpp/src/qpid/amqp_0_10/Header.h b/qpid/cpp/src/qpid/amqp_0_10/Header.h
deleted file mode 100644
index 0ce6ad9135..0000000000
--- a/qpid/cpp/src/qpid/amqp_0_10/Header.h
+++ /dev/null
@@ -1,53 +0,0 @@
-#ifndef QPID_AMQP_0_10_HEADER_H
-#define QPID_AMQP_0_10_HEADER_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "qpid/amqp_0_10/built_in_types.h"
-#include "qpid/amqp_0_10/Struct32.h"
-#include <vector>
-#include <ostream>
-
-namespace qpid {
-namespace amqp_0_10 {
-
-class Header : public std::vector<Struct32> {
- public:
- Header() {}
-
- template <class S> void serialize(S& s) { s.split(*this); }
- template <class S> void encode(S& s) const { s(this->begin(), this->end()); }
- template <class S> void decode(S& s);
-};
-
-template <class S> void Header::decode(S& s) {
- this->clear();
- while (s.bytesRemaining() > 0) {
- this->push_back(Struct32());
- s(this->back());
- }
-}
-
-std::ostream& operator<<(std::ostream& o, const Header&);
-
-}} // namespace qpid::amqp_0_10
-
-#endif /*!QPID_AMQP_0_10_HEADER_H*/
diff --git a/qpid/cpp/src/qpid/amqp_0_10/Holder.h b/qpid/cpp/src/qpid/amqp_0_10/Holder.h
deleted file mode 100644
index 605d2e0ed5..0000000000
--- a/qpid/cpp/src/qpid/amqp_0_10/Holder.h
+++ /dev/null
@@ -1,103 +0,0 @@
-#ifndef QPID_AMQP_0_10_HOLDER_H
-#define QPID_AMQP_0_10_HOLDER_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "qpid/framing/Blob.h"
-#include "qpid/amqp_0_10/apply.h"
-
-namespace qpid {
-namespace amqp_0_10 {
-
-using framing::in_place;
-
-template <class Invokable> struct InvokeVisitor {
- typedef void result_type;
- Invokable& target;
- InvokeVisitor(Invokable& i) : target(i) {}
-
- template <class Action>
- void operator()(const Action& action) { action.invoke(target); }
-};
-
-template <class DerivedHolder, class BaseHeld, size_t Size>
-class Holder : public framing::Blob<Size, BaseHeld> {
- typedef framing::Blob<Size, BaseHeld> Base;
-
- public:
-
- Holder() {}
- template <class T> explicit Holder(const T& value) : Base(value) {}
-
- using Base::operator=;
- Holder& operator=(const BaseHeld& rhs);
-
- uint8_t getCode() const { return this->get()->getCode(); }
- uint8_t getClassCode() const { return this->get()->getClassCode(); }
-
- template <class Invokable> void invoke(Invokable& i) const {
- InvokeVisitor<Invokable> v(i);
- apply(v, *this->get());
- }
-
- template <class S> void encode(S& s) const {
- s(getClassCode())(getCode());
- }
-
- template <class S> void decode(S& s) {
- uint8_t code, classCode;
- s(classCode)(code);
- static_cast<DerivedHolder*>(this)->set(classCode, code);
- }
-
- template <class S> void serialize(S& s) {
- s.split(*this);
- qpid::amqp_0_10::apply(s, *this->get());
- }
-
- template <class T> T* getIf() {
- return (getClassCode()==T::CLASS_CODE && getCode()==T::CODE) ? static_cast<T*>(this->get()) : 0;
- }
-
- template <class T> const T* getIf() const {
- return (getClassCode()==T::CLASS_CODE && getCode()==T::CODE) ? static_cast<T*>(this->get()) : 0;
- }
-
- private:
- struct Assign : public ApplyFunctor<void> {
- Holder& holder;
- Assign(Holder& x) : holder(x) {}
- template <class T> void operator()(const T& rhs) { holder=rhs; }
- };
-};
-
-template <class D, class B, size_t S>
-Holder<D,B,S>& Holder<D,B,S>::operator=(const B& rhs) {
- Assign assign(*this);
- qpid::amqp_0_10::apply(assign, rhs);
- return *this;
-}
-
-
-
-}} // namespace qpid::amqp_0_10
-
-#endif /*!QPID_AMQP_0_10_HOLDER_H*/
diff --git a/qpid/cpp/src/qpid/amqp_0_10/Map.cpp b/qpid/cpp/src/qpid/amqp_0_10/Map.cpp
deleted file mode 100644
index af3b302d25..0000000000
--- a/qpid/cpp/src/qpid/amqp_0_10/Map.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "qpid/amqp_0_10/Map.h"
-#include "qpid/amqp_0_10/Struct32.h"
-#include "qpid/amqp_0_10/Array.h"
-#include <ostream>
-
-namespace qpid {
-namespace amqp_0_10 {
-
-MapValue::MapValue() : code(codeFor(uint8_t(0))), blob(in_place<uint8_t>(0)) {}
-
-MapValue::MapValue(const MapValue& x) : code(x.code), blob(x.blob) {}
-
-bool MapValue::operator==(const MapValue& x) const {
- return code == x.code; // FIXME aconway 2008-04-01: incomplete
-}
-
-struct OstreamVisitor : public MapValue::Visitor<std::ostream&> {
- std::ostream& out;
- OstreamVisitor(std::ostream& o) : out(o) {}
- template <class T> std::ostream& operator()(const T& t) {
- return out << t;
- }
-};
-
-std::ostream& operator<<(std::ostream& o, const MapValue& m) {
- o << typeName(m.getCode()) << ":";
- const_cast<MapValue&>(m).apply_visitor(OstreamVisitor(o));
- return o;
-}
-
-std::ostream& operator<<(std::ostream& o, const Map::value_type& v) {
- return o << v.first << "=" << v.second;
-}
-std::ostream& operator<<(std::ostream& o, const Map& map) {
- o << "map[";
- std::ostream_iterator<Map::value_type> i(o, " ");
- std::copy(map.begin(), map.end(), i);
- return o << "]";
-}
-
-uint32_t Map::contentSize() const {
- // FIXME aconway 2008-04-03: preview to 0-10 mapping: +4 for count.
- return /*4 +*/ Codec::Size()(begin(), end());
-}
-
-}} // namespace qpid::amqp_0_10
diff --git a/qpid/cpp/src/qpid/amqp_0_10/Map.h b/qpid/cpp/src/qpid/amqp_0_10/Map.h
deleted file mode 100644
index 4093b1a0aa..0000000000
--- a/qpid/cpp/src/qpid/amqp_0_10/Map.h
+++ /dev/null
@@ -1,188 +0,0 @@
-#ifndef QPID_AMQP_0_10_MAP_H
-#define QPID_AMQP_0_10_MAP_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on ang
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/Exception.h"
-#include "qpid/amqp_0_10/built_in_types.h"
-#include "qpid/amqp_0_10/UnknownType.h"
-#include "qpid/amqp_0_10/CodeForType.h"
-#include "qpid/amqp_0_10/TypeForCode.h"
-#include "qpid/amqp_0_10/Codec.h"
-#include "qpid/framing/Blob.h"
-#include <map>
-#include <string>
-#include <iosfwd>
-
-namespace qpid {
-namespace amqp_0_10 {
-
-class Map;
-
-class MapValue {
- public:
- struct BadTypeException : public Exception {};
-
- template <class R> struct Visitor { typedef R result_type; };
-
- MapValue();
- MapValue(const MapValue& x);
- template <class T> explicit MapValue(const T& t);
- template <class T> MapValue& operator=(const T& t);
-
- template <class T> T* get();
- template <class T> const T* get() const;
-
- template <class V> typename V::result_type apply_visitor(V&);
- template <class V> typename V::result_type apply_visitor(const V&);
-
- uint8_t getCode() const { return code; }
-
- bool operator==(const MapValue&) const;
-
- template <class S> void serialize(S& s) { s(code); s.split(*this); }
- template <class S> void encode(S& s) const {
- const_cast<MapValue*>(this)->apply_visitor(s);
- }
- template <class S> void decode(S& s) {
- DecodeVisitor<S> dv(blob, s);
- qpid::amqp_0_10::apply_visitor(dv, code);
- }
-
-
- private:
- // TODO aconway 2008-04-15: Estimate required size, we will get a
- // compile error from static_assert in Blob.h if the estimate is too
- // low. We can't use sizeof() directly because #include Struct32.h
- // creates a circular dependency. Needs a better solution.
- static const size_t SIZE=256;
- typedef framing::Blob<SIZE> Blob;
-
- template <class V> struct VisitVisitor;
- template <class T> struct GetVisitor;
- template <class D> struct DecodeVisitor;
-
- uint8_t code;
- Blob blob;
-};
-
-class Map : public std::map<Str8, MapValue> {
- public:
- template <class S> void serialize(S& s) { s.split(*this); }
- template <class S> void encode(S& s) const;
- // Shortcut calculation for size.
- void encode(Codec::Size& s) const { s.raw(0, contentSize() + 4/*size*/); }
-
- template <class S> void decode(S& s);
-
- private:
- uint32_t contentSize() const;
-};
-
-std::ostream& operator<<(std::ostream&, const MapValue&);
-std::ostream& operator<<(std::ostream&, const Map::value_type&);
-std::ostream& operator<<(std::ostream&, const Map&);
-
-using framing::in_place;
-
-template <class T> MapValue::MapValue(const T& t) : code(codeFor(t)), blob(in_place<t>()) {}
-
-template <class T> MapValue& MapValue::operator=(const T& t) {
- code=codeFor(t);
- blob=t;
- return *this;
-}
-
-template <class V> struct MapValue::VisitVisitor {
- typedef typename V::result_type result_type;
- V& visitor;
- Blob& blob;
- VisitVisitor(V& v, Blob& b) : visitor(v), blob(b) {}
-
- template <class T> result_type operator()(T*) {
- return visitor(*reinterpret_cast<T*>(blob.get()));
- }
-};
-
-template <class V> typename V::result_type MapValue::apply_visitor(V& v) {
- VisitVisitor<V> visitor(v, blob);
- return qpid::amqp_0_10::apply_visitor(visitor, code);
-}
-
-template <class R> struct MapValue::GetVisitor {
- typedef R* result_type;
- const MapValue::Blob& blob;
-
- GetVisitor(const MapValue::Blob& b) : blob(b) {}
-
- R* operator()(R& r) { return &r; }
- template <class T> R* operator()(T&) { return 0; }
-};
-
-template <class D> struct MapValue::DecodeVisitor {
- typedef void result_type;
- MapValue::Blob& blob;
- D& decoder;
- DecodeVisitor(Blob& b, D& d) : blob(b), decoder(d) {}
-
- template <class T> void operator()(T*) {
- T t;
- decoder(t);
- blob = t;
- }
-};
-
-template <class T> T* MapValue::get() { return apply_visitor(GetVisitor<T>(blob)); }
-template <class T> const T* MapValue::get() const { return apply_visitor(GetVisitor<const T>()); }
-
-template <class V> typename V::result_type MapValue::apply_visitor(const V& v) {
- return apply_visitor(const_cast<V&>(v));
-}
-
-template <class S> void Map::encode(S& s) const {
- // FIXME aconway 2008-04-03: replace preview mapping with 0-10 mapping:
- // s(contentSize())(uint32_t(size())); // size, count
- s(contentSize());
- for (const_iterator i = begin(); i != end(); ++i)
- s(i->first)(i->second); // key (type value)
-}
-
-template <class S> void Map::decode(S& s) {
- uint32_t decodedSize /*, count*/;
- // FIXME aconway 2008-04-03: replace preview mapping with 0-10 mapping:
- // s(contentSize())(uint32_t(size())); // size, count
- // s(decodedSize)(count);
- s(decodedSize);
- typename S::ScopedLimit l(s, decodedSize); // Make sure we don't overrun.
- // FIXME aconway 2008-04-03: replace preview with 0-10:
- // for ( ; count > 0; --count) {
- while (s.bytesRemaining() > 0) {
- key_type k; MapValue v;
- s(k)(v);
- insert(value_type(k,v));
- }
-}
-
-
-}} // namespace qpid::amqp_0_10
-
-#endif /*!QPID_AMQP_0_10_MAP_H*/
diff --git a/qpid/cpp/src/qpid/amqp_0_10/Packer.h b/qpid/cpp/src/qpid/amqp_0_10/Packer.h
deleted file mode 100644
index c38e3a7efa..0000000000
--- a/qpid/cpp/src/qpid/amqp_0_10/Packer.h
+++ /dev/null
@@ -1,195 +0,0 @@
-#ifndef QPID_PACKER_H
-#define QPID_PACKER_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include <boost/optional.hpp>
-#include <boost/none.hpp>
-#include "qpid/amqp_0_10/built_in_types.h"
-
-namespace qpid {
-namespace amqp_0_10 {
-
-/** Serialization for optional values */
-template <class T> struct SerializableOptional {
- boost::optional<T>& optional;
- SerializableOptional(boost::optional<T>& x) : optional(x) {}
- template <class S> void serialize(S& s) {
- if (optional)
- s(*optional);
- }
-};
-
-}}
-
-
-namespace boost { // For argument dependent lookup.
-
-template <class T>
-qpid::amqp_0_10::SerializableOptional<T> serializable(boost::optional<T>& x) {
- return qpid::amqp_0_10::SerializableOptional<T>(x);
-}
-
-} // namespace boost
-
-namespace qpid {
-namespace amqp_0_10 {
-
-/** "Encoder" that encodes a struct as a set of bit flags
- * for all non-empty members.
- */
-class PackBits {
- public:
- PackBits() : bit(1), bits(0) {}
-
- void setBit(bool b) { if (b) bits |= bit; bit <<= 1; }
- uint32_t getBits() { return bits; }
-
- /** The bit is always set for non-optional values. */
- template <class T>
- PackBits& operator()(const T&) { setBit(1); return *this; }
-
- /** For optional values the bit is set if the value is present. */
- template <class T> PackBits& operator()(const boost::optional<T>& opt) {
- setBit(opt); return *this;
- }
-
- /** Bits are special optional values */
- PackBits& operator()(Bit b) { setBit(b); return *this; }
-
- private:
- uint32_t bit;
- uint32_t bits;
-};
-
-/** Bit mask to encode a packable struct */
-template<class T> uint32_t packBits(const T& t) {
- PackBits pack;
- const_cast<T&>(t).serialize(pack);
- return pack.getBits();
-}
-
-/** Decode members enabled by Bits */
-template <class Decoder, class Bits>
-class PackedDecoder {
- public:
- PackedDecoder(Decoder& d, Bits b) : decode(d), bits(b) {}
-
- template <class T> PackedDecoder& operator()(T& t) {
- if (bits & 1)
- decode(t);
- else
- t = T();
- // FIXME aconway 2008-04-10: When we have all optionals
- // represented by boost::optional the line above should be:
- // throw CommandInvalidException("A required value was omitted.");
- bits >>= 1;
- return *this;
- }
-
- template <class T> PackedDecoder& operator()(boost::optional<T>& opt) {
- if (bits & 1) {
- opt = T();
- decode(*opt);
- }
- else
- opt = boost::none;
- bits >>= 1;
- return *this;
- }
-
- private:
- Decoder& decode;
- Bits bits;
-};
-
-/** Metafunction to compute type to contain pack bits. */
-template <int Bytes> struct UintOfSize;
-template <> struct UintOfSize<1> { typedef uint8_t type; };
-template <> struct UintOfSize<2> { typedef uint16_t type; };
-template <> struct UintOfSize<4> { typedef uint32_t type; };
-
-/**
- * Helper to serialize packed structs.
- */
-template <class T> class Packer
-{
- public:
- typedef typename UintOfSize<T::PACK>::type Bits;
-
- Packer(T& t) : data(t) {}
-
- template <class S> void serialize(S& s) { s.split(*this); }
-
- template <class S> void encode(S& s) const {
- Bits bits = packBits(data);
- s.littleEnd(bits);
- data.serialize(s);
- }
-
- template <class S> void decode(S& s) {
- Bits bits;
- s.littleEnd(bits);
- PackedDecoder<S, Bits> decode(s, bits);
- data.serialize(decode);
- }
-
-
- protected:
- T& data;
-};
-
-template <class T, uint8_t=T::SIZE> struct SizedPacker : public Packer<T> {
- typedef typename UintOfSize<T::SIZE>::type Size;
-
- SizedPacker(T& t) : Packer<T>(t) {}
-
- template <class S> void serialize(S& s) {
- s.split(*this);
- }
-
- template <class S> void encode(S& s) const {
- Codec::Size sizer;
- this->data.serialize(sizer);
- Size size=size_t(sizer)+T::PACK; // Size with pack bits.
- s(size);
- Packer<T>::encode(s);
- }
-
- template <class S> void decode(S& s) {
- Size size;
- s(size);
- typename S::ScopedLimit l(s, size);
- Packer<T>::decode(s);
- }
-
-};
-
-template <class T> struct SizedPacker<T,0> : public Packer<T> {
- SizedPacker(T& t) : Packer<T>(t) {}
-};
-
-}} // namespace qpid::amqp_0_10
-
-
-
-#endif /*!QPID_PACKER_H*/
diff --git a/qpid/cpp/src/qpid/amqp_0_10/SerializableString.h b/qpid/cpp/src/qpid/amqp_0_10/SerializableString.h
deleted file mode 100644
index 485b7ca6a8..0000000000
--- a/qpid/cpp/src/qpid/amqp_0_10/SerializableString.h
+++ /dev/null
@@ -1,62 +0,0 @@
-#ifndef QPID_AMQP_0_10_SERIALIZABLESTRING_H
-#define QPID_AMQP_0_10_SERIALIZABLESTRING_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-namespace qpid {
-namespace amqp_0_10 {
-
-/** Template for length-prefixed strings/arrays.
- * Unique parameter allows creation of distinct SerializableString
- * types with the smae T/SizeType
- */
-template <class T, class SizeType, int Unique=0>
-struct SerializableString : public std::basic_string<T> {
- SerializableString() {}
- template <class U> SerializableString(const U& u) : std::basic_string<T>(u) {}
- template <class I> SerializableString(const I& i, const I& j) : std::basic_string<T>(i,j) {}
-
- using std::basic_string<T>::operator=;
-
- template <class S> void serialize(S& s) { s.split(*this); }
-
- template <class S> void encode(S& s) const {
- s(SizeType(this->size()))(this->begin(), this->end());
- }
-
- template <class S> void decode(S& s) {
- SizeType newSize;
- s(newSize);
- this->resize(newSize);
- s(this->begin(), this->end());
- }
-};
-
-// TODO aconway 2008-02-29: separate ostream ops
-template <class T, class SizeType>
-std::ostream& operator<<(std::ostream& o, const SerializableString<T,SizeType>& s) {
- const std::basic_string<T> str(s);
- return o << str.c_str(); // TODO aconway 2008-02-29: why doesn't o<<str work?
-}
-
-}} // namespace qpid::amqp_0_10
-
-#endif /*!QPID_AMQP_0_10_SERIALIZABLESTRING_H*/
diff --git a/qpid/cpp/src/qpid/amqp_0_10/Struct.h b/qpid/cpp/src/qpid/amqp_0_10/Struct.h
deleted file mode 100644
index 29ece84f6e..0000000000
--- a/qpid/cpp/src/qpid/amqp_0_10/Struct.h
+++ /dev/null
@@ -1,60 +0,0 @@
-#ifndef QPID_AMQP_0_10_STRUCT_H
-#define QPID_AMQP_0_10_STRUCT_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/amqp_0_10/built_in_types.h"
-#include <iosfwd>
-
-namespace qpid {
-namespace amqp_0_10 {
-
-// Base classes for complex types.
-
-template <class V, class CV, class H> struct Visitable {
- typedef V Visitor;
- typedef CV ConstVisitor;
- typedef H Holder;
-
- virtual ~Visitable() {}
- virtual void accept(Visitor&) = 0;
- virtual void accept(ConstVisitor&) const = 0;
-};
-
-
-// Note: only coded structs inherit from Struct.
-struct StructVisitor;
-struct ConstStructVisitor;
-struct StructHolder;
-struct Struct
- : public Visitable<StructVisitor, ConstStructVisitor, StructHolder>
-{
- uint8_t getCode() const;
- uint8_t getPack() const;
- uint8_t getSize() const;
- uint8_t getClassCode() const;
-};
-std::ostream& operator<<(std::ostream&, const Struct&);
-
-}} // namespace qpid::amqp_0_10
-
-#endif /*!QPID_AMQP_0_10_STRUCT_H*/
diff --git a/qpid/cpp/src/qpid/amqp_0_10/Struct32.cpp b/qpid/cpp/src/qpid/amqp_0_10/Struct32.cpp
deleted file mode 100644
index 2d38c09c21..0000000000
--- a/qpid/cpp/src/qpid/amqp_0_10/Struct32.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/amqp_0_10/Struct32.h"
-
-namespace qpid {
-namespace amqp_0_10 {
-
-Struct32::Struct32() {
- // FIXME aconway 2008-04-16: this is only here to force a valid
- // default-constructed Struct32 for serialize tests, clean up.
- *this = in_place<message::MessageResumeResult>();
-}
-
-std::ostream& operator<<(std::ostream& o, const Struct32& s) {
- return o << static_cast<const StructHolder&>(s);
-}
-
-}} // namespace qpid::amqp_0_10
diff --git a/qpid/cpp/src/qpid/amqp_0_10/Struct32.h b/qpid/cpp/src/qpid/amqp_0_10/Struct32.h
deleted file mode 100644
index 2ed73e0b4c..0000000000
--- a/qpid/cpp/src/qpid/amqp_0_10/Struct32.h
+++ /dev/null
@@ -1,64 +0,0 @@
-#ifndef QPID_AMQP_0_10_STRUCT32_H
-#define QPID_AMQP_0_10_STRUCT32_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/amqp_0_10/StructHolder.h"
-
-namespace qpid {
-namespace amqp_0_10 {
-
-class Struct32 : public StructHolder
-{
- public:
- Struct32();
-
- template <class T> explicit Struct32(const T& t) : StructHolder(t) {}
-
- template <class S> void serialize(S& s) { s.split(*this); }
-
- using StructHolder::operator=;
-
- template <class S> void encode(S& s) const {
- s(contentSize());
- const_cast<Struct32*>(this)->StructHolder::serialize(s);
- }
-
- template <class S> void decode(S& s) {
- uint32_t contentSz;
- s(contentSz);
- typename S::ScopedLimit l(s, contentSz);
- StructHolder::serialize(s);
- }
-
- private:
- uint32_t contentSize() const {
- return Codec::size(static_cast<const StructHolder&>(*this));
- }
-
-};
-
-std::ostream& operator<<(std::ostream&, const Struct32&);
-
-}} // namespace qpid::amqp_0_10
-
-#endif /*!QPID_AMQP_0_10_STRUCT32_H*/
diff --git a/qpid/cpp/src/qpid/amqp_0_10/Unit.cpp b/qpid/cpp/src/qpid/amqp_0_10/Unit.cpp
deleted file mode 100644
index 381de76dcc..0000000000
--- a/qpid/cpp/src/qpid/amqp_0_10/Unit.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "qpid/amqp_0_10/Unit.h"
-#include "qpid/amqp_0_10/Codec.h"
-
-namespace qpid {
-namespace amqp_0_10 {
-
-void Unit::updateVariant() {
- switch (header.getType()) {
- case CONTROL: variant=ControlHolder(); break;
- case COMMAND: variant=CommandHolder(); break;
- case HEADER: variant=Header(); break;
- case BODY: variant=Body(header.getDataSize()); break;
- default: assert(0); // FIXME aconway 2008-04-14: exception?
- }
-}
-
-struct GetTypeVisitor : public boost::static_visitor<SegmentType> {
- SegmentType operator()(const CommandHolder& ) const { return COMMAND; }
- SegmentType operator()(const ControlHolder& ) const { return CONTROL; }
- SegmentType operator()(const Header& ) const { return HEADER; }
- SegmentType operator()(const Body&) const { return BODY; }
-};
-
-struct GetFlagsVisitor : public boost::static_visitor<uint8_t> {
- uint8_t operator()(const CommandHolder& ) const { return FIRST_FRAME|LAST_FRAME|FIRST_SEGMENT; }
- uint8_t operator()(const ControlHolder& ) const { return FIRST_FRAME|LAST_FRAME|FIRST_SEGMENT; }
- uint8_t operator()(const Header& ) const { return FIRST_FRAME|LAST_FRAME; }
- uint8_t operator()(const Body&) const { return 0; }
-};
-
-void Unit::updateHeader(uint8_t flags) {
- GetFlagsVisitor flagger;
- header.setFlags(flags | variant.apply_visitor(flagger));
- GetTypeVisitor getter;
- header.setType(variant.apply_visitor(getter));
- header.setDataSize(Codec::size(*this));
- // track automatically set from type.
- // no channel specified at this point.
-}
-
-std::ostream& operator<<(std::ostream& o, const Unit& u) {
- return o << u.getHeader() << " " << u.variant.type().name() << "[" << u.variant << "]";
-}
-
-}} // namespace qpid::amqp_0_10
diff --git a/qpid/cpp/src/qpid/amqp_0_10/Unit.h b/qpid/cpp/src/qpid/amqp_0_10/Unit.h
deleted file mode 100644
index 0229e07419..0000000000
--- a/qpid/cpp/src/qpid/amqp_0_10/Unit.h
+++ /dev/null
@@ -1,82 +0,0 @@
-#ifndef QPID_AMQP_0_10_UNIT_H
-#define QPID_AMQP_0_10_UNIT_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/amqp_0_10/ControlHolder.h"
-#include "qpid/amqp_0_10/CommandHolder.h"
-#include "qpid/amqp_0_10/Header.h"
-#include "qpid/amqp_0_10/Body.h"
-#include "qpid/amqp_0_10/FrameHeader.h"
-
-#include <boost/variant.hpp>
-#include <ostream>
-
-namespace qpid {
-namespace amqp_0_10 {
-
-/**
- * A Unit contains a frame header and associated value.
- * For all types except BODY the frame header is for a complete segment.
- */
-class Unit {
- public:
- explicit Unit(const FrameHeader& h=FrameHeader()) : header(h) { updateVariant(); }
-
- /**
- *@param flags: is ORed with the required flags for type T.
- */
- template <class T>
- explicit Unit(const T& t, uint8_t flags=0) : variant(t) { updateHeader(flags); }
-
- void setHeader(FrameHeader& h) { header = h; updateVariant(); }
- const FrameHeader& getHeader() const { return header; }
-
- template<class T> const T* get() const { return boost::get<T>(&variant); }
- template<class T> T* get() { return boost::get<T>(&variant); }
- template<class T> Unit& operator=(const T& t) { variant=t; return *this; }
-
- template <class V> typename V::result_type applyVisitor(V& v) const {
- variant.apply_visitor(v);
- }
-
- template <class S> void serialize(S& s) { variant.apply_visitor(s); s.split(*this); }
- template <class S> void encode(S&) const {}
- template <class S> void decode(S&) { updateHeader(header.getFlags()); }
-
- private:
- typedef boost::variant<ControlHolder, CommandHolder, Header, Body> Variant;
-
- void updateHeader(uint8_t flags);
- void updateVariant();
-
- Variant variant;
- FrameHeader header;
-
- friend std::ostream& operator<<(std::ostream& o, const Unit& u);
-};
-
-std::ostream& operator<<(std::ostream& o, const Unit& u);
-
-}} // namespace qpid::amqp_0_10
-
-#endif /*!QPID_AMQP_0_10_UNIT_H*/
diff --git a/qpid/cpp/src/qpid/amqp_0_10/UnitHandler.h b/qpid/cpp/src/qpid/amqp_0_10/UnitHandler.h
deleted file mode 100644
index 93a8ce573a..0000000000
--- a/qpid/cpp/src/qpid/amqp_0_10/UnitHandler.h
+++ /dev/null
@@ -1,35 +0,0 @@
-#ifndef QPID_AMQP_0_10_UNITHANDLER_H
-#define QPID_AMQP_0_10_UNITHANDLER_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/framing/Handler.h"
-
-namespace qpid {
-namespace amqp_0_10 {
-
-class Unit;
-typedef framing::Handler<const Unit&> UnitHandler;
-
-}} // namespace qpid::amqp_0_10
-
-#endif /*!QPID_AMQP_0_10_UNITHANDLER_H*/
diff --git a/qpid/cpp/src/qpid/amqp_0_10/UnknownStruct.cpp b/qpid/cpp/src/qpid/amqp_0_10/UnknownStruct.cpp
deleted file mode 100644
index 35445054c9..0000000000
--- a/qpid/cpp/src/qpid/amqp_0_10/UnknownStruct.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/amqp_0_10/StructVisitor.h"
-#include "qpid/amqp_0_10/UnknownStruct.h"
-
-namespace qpid {
-namespace amqp_0_10 {
-
-void UnknownStruct::accept(Visitor& v) { v.visit(*this); }
-void UnknownStruct::accept(ConstVisitor& v) const { v.visit(*this); }
-std::ostream& operator<<(std::ostream& o, const UnknownStruct& u) {
- return o << "UnknownStruct[class=" << u.getClassCode() << " code=" << u.getCode() << "]";
-}
-
-}} // namespace qpid::amqp_0_10
diff --git a/qpid/cpp/src/qpid/amqp_0_10/UnknownStruct.h b/qpid/cpp/src/qpid/amqp_0_10/UnknownStruct.h
deleted file mode 100644
index 1c66d8e6af..0000000000
--- a/qpid/cpp/src/qpid/amqp_0_10/UnknownStruct.h
+++ /dev/null
@@ -1,55 +0,0 @@
-#ifndef QPID_AMQP_0_10_UNKNOWNSTRUCT_H
-#define QPID_AMQP_0_10_UNKNOWNSTRUCT_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "qpid/amqp_0_10/Struct.h"
-#include <string>
-
-namespace qpid {
-namespace amqp_0_10 {
-
-class UnknownStruct : public Struct {
- public:
- static const uint8_t SIZE=4;
- static const uint8_t PACK=2;
-
- template <class S> void serialize(S& s) { s.split(*this); s(data.begin(), data.end()); }
- template <class S> void encode(S&) const { }
- template <class S> void decode(S& s) { data.resize(s.bytesRemaining()); }
-
- UnknownStruct(uint8_t cc=0, uint8_t c=0) : classCode(cc), code(c) {}
- void accept(Visitor&);
- void accept(ConstVisitor&) const;
-
- uint8_t getClassCode() const { return classCode; }
- uint8_t getCode() const { return code; }
-
- private:
- uint8_t classCode, code;
- std::string data;
-};
-
-std::ostream& operator<<(std::ostream&, const UnknownStruct&);
-
-}} // namespace qpid::amqp_0_10
-
-#endif /*!QPID_AMQP_0_10_UNKNOWNSTRUCT_H*/
diff --git a/qpid/cpp/src/qpid/amqp_0_10/UnknownType.cpp b/qpid/cpp/src/qpid/amqp_0_10/UnknownType.cpp
deleted file mode 100644
index cd45dd76db..0000000000
--- a/qpid/cpp/src/qpid/amqp_0_10/UnknownType.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "qpid/amqp_0_10/UnknownType.h"
-#include <boost/range/iterator_range.hpp>
-#include <ostream>
-
-namespace qpid {
-namespace amqp_0_10 {
-
-UnknownType::Width UnknownType::WidthTable[16] = {
- { 1, 0 },
- { 2, 0 },
- { 4, 0 },
- { 8, 0 },
- { 16, 0 },
- { 32, 0 },
- { 64, 0 },
- { 128, 0 },
- { 0, 1 },
- { 0, 2 },
- { 0, 4 },
- { -1, -1 }, // Invalid
- { 5, 0 },
- { 9, 0 },
- { -1, -1 }, // Invalid
- { 0, 0 }
-};
-
-int UnknownType::fixed() const { return WidthTable[code>>4].fixed; }
-int UnknownType::variable() const { return WidthTable[code>>4].variable; }
-UnknownType::UnknownType(uint8_t c) : code(c) { data.resize(fixed()); }
-
-std::ostream& operator<<(std::ostream& o, const UnknownType& u) {
- return o << boost::make_iterator_range(u.begin(), u.end()) << std::endl;
-}
-
-}} // namespace qpid::amqp_0_10
-
diff --git a/qpid/cpp/src/qpid/amqp_0_10/UnknownType.h b/qpid/cpp/src/qpid/amqp_0_10/UnknownType.h
deleted file mode 100644
index 77498871b3..0000000000
--- a/qpid/cpp/src/qpid/amqp_0_10/UnknownType.h
+++ /dev/null
@@ -1,87 +0,0 @@
-#ifndef QPID_AMQP_0_10_UNKNOWNTYPE_H
-#define QPID_AMQP_0_10_UNKNOWNTYPE_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include "qpid/sys/IntegerTypes.h"
-#include <vector>
-#include <iosfwd>
-
-namespace qpid {
-namespace amqp_0_10 {
-
-/** Encode/decode an unknown type based on typecode. */
-class UnknownType {
- public:
- UnknownType(uint8_t code=0);
- uint8_t getCode() const { return code; }
- /** Size of fixed type or 0 if not fixed/0-length. -1 invalid */
- int fixed() const;
- /** Bytes in size type for variable width. -1 invalid */
- int variable() const;
-
- typedef std::vector<char>::const_iterator const_iterator;
- const_iterator begin() const { return data.begin(); }
- const_iterator end() const { return data.end(); }
- size_t size() const { return data.size(); }
-
- template <class S> void serialize(S& s) { s.split(*this); }
- template <class S> void encode(S& s) const;
- template <class S> void decode(S& s);
-
- private:
- uint8_t code;
- struct Width { int fixed; int variable; };
- static Width WidthTable[16];
-
- std::vector<char> data;
-};
-
-template <class S> void UnknownType::encode(S& s) const {
- switch (variable()) {
- case 0: break;
- case 1: s(uint8_t(data.size())); break;
- case 2: s(uint16_t(data.size())); break;
- case 4: s(uint32_t(data.size())); break;
- }
- s(data.begin(), data.end());
-}
-
-template <class S> void UnknownType::decode(S& s) {
- uint32_t s8;
- uint32_t s16;
- uint32_t s32;
- switch (variable()) {
- case 0: break;
- case 1: s(s8); data.resize(s8); break;
- case 2: s(s16); data.resize(s16); break;
- case 4: s(s32); data.resize(s32); break;
- }
- s(data.begin(), data.end());
-}
-
-inline uint8_t codeFor(const UnknownType& u) { return u.getCode(); }
-
-std::ostream& operator<<(std::ostream&, const UnknownType&);
-
-}} // namespace qpid::amqp_0_10
-
-#endif /*!QPID_AMQP_0_10_UNKNOWNTYPE_H*/
diff --git a/qpid/cpp/src/qpid/amqp_0_10/apply.h b/qpid/cpp/src/qpid/amqp_0_10/apply.h
deleted file mode 100644
index f32b3482ef..0000000000
--- a/qpid/cpp/src/qpid/amqp_0_10/apply.h
+++ /dev/null
@@ -1,86 +0,0 @@
-#ifndef QPID_AMQP_0_10_APPLY_H
-#define QPID_AMQP_0_10_APPLY_H
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include <boost/optional.hpp>
-
-namespace qpid {
-namespace amqp_0_10 {
-
-template <class F, class R=typename F::result_type> struct FunctionAndResult {
- F* functor;
- boost::optional<R> result;
-
- FunctionAndResult() : functor(0) {}
- template <class T> void invoke(T& t) { result=(*functor)(t); }
- template <class T> void invoke(const T& t) { result=(*functor)(t); }
- R getResult() { return *result; }
-};
-
-// void result is special case.
-template <class F> struct FunctionAndResult<F, void> {
- F* functor;
-
- FunctionAndResult() : functor(0) {}
- template <class T> void invoke(T& t) { (*functor)(t); }
- void getResult() {}
-};
-
-// Metafunction returning correct abstract visitor for Visitable type.
-template <class Visitable> struct VisitorType {
- typedef typename Visitable::Visitor type;
-};
-template <class Visitable> struct VisitorType<const Visitable> {
- typedef typename Visitable::ConstVisitor type;
-};
-
-template <class Visitor, class F>
-struct ApplyVisitorBase : public Visitor, public FunctionAndResult<F> {};
-
-// Specialize for each visitor type
-template <class Visitable, class F> struct ApplyVisitor;
-
-/** Apply a functor to a visitable object.
- * The functor can have operator() overloads for each visitable type
- * and/or templated operator().
- */
-template <class F, class Visitable>
-typename F::result_type apply(F& functor, Visitable& visitable) {
- ApplyVisitor<typename VisitorType<Visitable>::type, F> visitor;
- visitor.functor=&functor;
- visitable.accept(visitor);
- return visitor.getResult();
-}
-
-template <class F, class Visitable>
-typename F::result_type apply(const F& functor, Visitable& visitable) {
- ApplyVisitor<typename VisitorType<Visitable>::type, const F> visitor;
- visitor.functor=&functor;
- visitable.accept(visitor);
- return visitor.getResult();
-}
-
-template <class R> struct ApplyFunctor { typedef R result_type; };
-
-}} // namespace qpid::amqp_0_10
-
-#endif /*!QPID_AMQP_0_10_APPLY_H*/
diff --git a/qpid/cpp/src/qpid/amqp_0_10/built_in_types.h b/qpid/cpp/src/qpid/amqp_0_10/built_in_types.h
deleted file mode 100644
index e95d1cf3e9..0000000000
--- a/qpid/cpp/src/qpid/amqp_0_10/built_in_types.h
+++ /dev/null
@@ -1,171 +0,0 @@
-#ifndef QPID_AMQP_0_10_BUILT_IN_TYPES_H
-#define QPID_AMQP_0_10_BUILT_IN_TYPES_H
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/Serializer.h"
-#include "qpid/framing/Uuid.h"
-#include "qpid/sys/IntegerTypes.h"
-#include "qpid/sys/Time.h"
-#include "qpid/amqp_0_10/Decimal.h"
-#include "qpid/amqp_0_10/SerializableString.h"
-#include <boost/array.hpp>
-#include <boost/range/iterator_range.hpp>
-#include <string>
-#include <ostream>
-#include <vector>
-
-/**@file Mapping from built-in AMQP types to C++ types */
-
-namespace qpid {
-
-namespace framing {
-class SequenceNumber;
-class SequenceSet;
-}
-
-namespace amqp_0_10 {
-
-/** Wrapper that behaves like type T but is a distinct type for
- * overloading purposes. Unique allows multiple distinc wrappers.
- */
-template <class T, int Unique=0> struct Wrapper {
- T value;
- Wrapper() {}
- Wrapper(const T& x) : value(x) {}
- Wrapper& operator=(const T& x) { value=x; return *this; }
- operator T&() { return value; }
- operator const T&() const { return value; }
- template <class S> void serialize(S& s) { s(value); }
-};
-
-template<class T>
-inline std::ostream& operator<<(std::ostream& o, const Wrapper<T>& w) {
- return o << w.value;
-}
-
-/** Void type */
-struct Void { template <class S> void serialize(S&) {} };
-inline std::ostream& operator<<(std::ostream& o, const Void&) { return o; }
-
-/** Bit is a presence indicator - an optional value with no encoding. */
-struct Bit : public Wrapper<bool> {
- Bit(bool b=false) : Wrapper<bool>(b) {}
- using Wrapper<bool>::operator=;
- template <class S> void serialize(S& s) { s.split(*this); }
- template <class S> void encode(S&) const { }
- template <class S> void decode(S&) { *this = true; }
-};
-
-inline std::ostream& operator<<(std::ostream& o, const Bit& b) {
- return o << bool(b);
-}
-
-// Fixed size types
-typedef bool Boolean;
-typedef char Char;
-typedef int8_t Int8;
-typedef int16_t Int16;
-typedef int32_t Int32;
-typedef int64_t Int64;
-typedef uint8_t Uint8;
-typedef uint16_t Uint16;
-typedef uint32_t Uint32;
-typedef uint64_t Uint64;
-typedef Wrapper<uint32_t> CharUtf32;
-
-template <size_t N> struct Bin : public boost::array<char, N> {
- template <class S> void serialize(S& s) { s.raw(this->begin(), this->size()); }
-};
-
-template <size_t N> std::ostream& operator<<(std::ostream& o, const Bin<N>& b) {
- return o << boost::make_iterator_range(b.begin(), b.end());
-}
-
-template <> struct Bin<1> : public boost::array<char, 1> {
- Bin(char c=0) { this->front() = c; }
- operator char() { return this->front(); }
- template <class S> void serialize(S& s) { s(front()); }
-};
-
-typedef Bin<1> Bin8;
-typedef Bin<128> Bin1024;
-typedef Bin<16> Bin128;
-typedef Bin<2> Bin16;
-typedef Bin<32> Bin256;
-typedef Bin<4> Bin32;
-typedef Bin<5> Bin40;
-typedef Bin<64> Bin512;
-typedef Bin<8> Bin64;
-typedef Bin<9> Bin72;
-
-typedef double Double;
-typedef float Float;
-typedef framing::SequenceNumber SequenceNo;
-using framing::Uuid;
-typedef sys::AbsTime Datetime;
-
-typedef Decimal<Uint8, Int32> Dec32;
-typedef Decimal<Uint8, Int64> Dec64;
-
-// Variable width types
-
-typedef SerializableString<Uint8, Uint8> Vbin8;
-typedef SerializableString<char, Uint8, 1> Str8Latin;
-typedef SerializableString<char, Uint8> Str8;
-typedef SerializableString<Uint16, Uint8> Str8Utf16;
-
-typedef SerializableString<Uint8, Uint16> Vbin16;
-typedef SerializableString<char, Uint16, 1> Str16Latin;
-typedef SerializableString<char, Uint16> Str16;
-typedef SerializableString<Uint16, Uint16> Str16Utf16;
-
-typedef SerializableString<Uint8, Uint32> Vbin32;
-
-typedef framing::SequenceSet SequenceSet;
-
-// Forward declare class types.
-class Map;
-class Struct32;
-class UnknownType;
-
-template <class T> struct ArrayDomain;
-typedef ArrayDomain<UnknownType> Array;
-
-// FIXME aconway 2008-04-08: TODO
-struct ByteRanges { template <class S> void serialize(S&) {} };
-struct List { template <class S> void serialize(S&) {} };
-
-// FIXME aconway 2008-03-10: dummy ostream operators
-inline std::ostream& operator<<(std::ostream& o, const ByteRanges&) { return o; }
-inline std::ostream& operator<<(std::ostream& o, const SequenceSet&) { return o; }
-inline std::ostream& operator<<(std::ostream& o, const List&) { return o; }
-
-enum SegmentType { CONTROL, COMMAND, HEADER, BODY };
-
-inline SerializeAs<SegmentType, uint8_t> serializable(SegmentType& st) {
- return SerializeAs<SegmentType, uint8_t>(st);
-}
-
-
-}} // namespace qpid::amqp_0_10
-
-#endif
diff --git a/qpid/cpp/src/qpid/amqp_0_10/complex_types.cpp b/qpid/cpp/src/qpid/amqp_0_10/complex_types.cpp
deleted file mode 100644
index 656d363ba6..0000000000
--- a/qpid/cpp/src/qpid/amqp_0_10/complex_types.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include "qpid/amqp_0_10/UnknownStruct.h"
-#include "qpid/amqp_0_10/ApplyCommand.h"
-#include "qpid/amqp_0_10/ApplyControl.h"
-#include "qpid/amqp_0_10/ApplyStruct.h"
-#include "qpid/amqp_0_10/apply.h"
-#include <iostream>
-
-namespace qpid {
-namespace amqp_0_10 {
-// Functors for getting static values from a visitable base type.
-
-#define QPID_STATIC_VALUE_GETTER(NAME, TYPE, VALUE) \
- struct NAME : public ApplyFunctor<TYPE> { \
- template <class T> TYPE operator()(const T&) const { return T::VALUE; }\
- }
-
-QPID_STATIC_VALUE_GETTER(GetCode, uint8_t, CODE);
-QPID_STATIC_VALUE_GETTER(GetSize, uint8_t, SIZE);
-QPID_STATIC_VALUE_GETTER(GetPack, uint8_t, PACK);
-QPID_STATIC_VALUE_GETTER(GetClassCode, uint8_t, CLASS_CODE);
-QPID_STATIC_VALUE_GETTER(GetName, const char*, NAME);
-QPID_STATIC_VALUE_GETTER(GetClassName, const char*, CLASS_NAME);
-
-
-uint8_t Command::getCode() const { return apply(GetCode(), *this); }
-uint8_t Command::getClassCode() const { return apply(GetClassCode(), *this); }
-const char* Command::getName() const { return apply(GetName(), *this); }
-const char* Command::getClassName() const { return apply(GetClassName(), *this); }
-
-uint8_t Control::getCode() const { return apply(GetCode(), *this); }
-uint8_t Control::getClassCode() const { return apply(GetClassCode(), *this); }
-const char* Control::getName() const { return apply(GetName(), *this); }
-const char* Control::getClassName() const { return apply(GetClassName(), *this); }
-
-// Special cases for UnknownStruct
-struct GetStructCode : public GetCode {
- using GetCode::operator();
- uint8_t operator()(const UnknownStruct& u) const { return u.getCode(); }
-};
-
-struct GetStructClassCode : public GetClassCode {
- using GetClassCode::operator();
- uint8_t operator()(const UnknownStruct& u) const { return u.getClassCode(); }
-};
-
-uint8_t Struct::getCode() const { return apply(GetStructCode(), *this); }
-uint8_t Struct::getClassCode() const { return apply(GetStructClassCode(), *this); }
-uint8_t Struct::getPack() const { return apply(GetPack(), *this); }
-uint8_t Struct::getSize() const { return apply(GetSize(), *this); }
-
-struct PrintVisitor {
- typedef std::ostream& result_type;
- std::ostream& out;
- PrintVisitor(std::ostream& o) : out(o) {}
- template <class T> result_type operator()(const T& t) const { return out << t; }
-};
-
-std::ostream& operator<<(std::ostream& o, const Command& x) { return apply(PrintVisitor(o), x); }
-std::ostream& operator<<(std::ostream& o, const Control& x) { return apply(PrintVisitor(o), x); }
-std::ostream& operator<<(std::ostream& o, const Struct& x) { return apply(PrintVisitor(o), x); }
-
-}} // namespace qpid::amqp_0_10
-
diff --git a/qpid/cpp/src/qpid/framing/TemplateVisitor.h b/qpid/cpp/src/qpid/framing/TemplateVisitor.h
deleted file mode 100644
index d6d59603f7..0000000000
--- a/qpid/cpp/src/qpid/framing/TemplateVisitor.h
+++ /dev/null
@@ -1,89 +0,0 @@
-#ifndef QPID_FRAMING_TEMPLATEVISITOR_H
-#define QPID_FRAMING_TEMPLATEVISITOR_H
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-#include <boost/mpl/fold.hpp>
-#include <boost/utility/value_init.hpp>
-
-namespace qpid {
-namespace framing {
-
-/**
- * Metafunction to generate a visitor class derived from Base, with a
- * visit for each type in TypeList calling functor F. TypeList may be
- * any boost::mpl type collection e.g. mpl::list.
- *
- * Generated class is: TemplateVisitor<Base, F, TypeList>::type
- *
- * @see make_visitor
- */
-template <class VisitTemplate, class TypeList, class F>
-class TemplateVisitor
-{
- struct Base : public VisitorBase {
- F action;
- Base(F f) : action(f) {}
- using VisitorBase::visit;
- };
-
- template <class B, class T> struct Visit : public B {
- Visit(F action) : B(action) {}
- using B::visit;
- void visit(const T& body) { action(body); }
- };
-
- typedef typename boost::mpl::fold<
- TypeList, Base, Visit<boost::mpl::placeholders::_1,
- boost::mpl::placeholders::_2>
- >::type type;
-};
-
-/**
- * Construct a TemplateVisitor to perform the given action,
- * for example:
- * @code
- */
-template <class VisitorBase, class TypeList, class F>
-TemplateVisitor<VisitorBase,TypeList,F>::type make_visitor(F action) {
- return TemplateVisitor<VisitorBase,TypeList,F>::type(action);
-};
-
-/**
- * For method body classes in TypeList, invoke the corresponding function
- * on Target and return true. For other body types return false.
- */
-template <class TypeList, class Target>
-bool invoke(const AMQBody& body, Target& target) {
- typename InvokeVisitor<TypeList, Target>::type v(target);
- body.accept(v);
- return v.target;
-}
-
-}} // namespace qpid::framing
-
-
-#endif /*!QPID_FRAMING_INVOKEVISITOR_H*/
-
-}} // namespace qpid::framing
-
-
-
-#endif /*!QPID_FRAMING_TEMPLATEVISITOR_H*/
diff --git a/qpid/cpp/src/qpid/framing/Visitor.h b/qpid/cpp/src/qpid/framing/Visitor.h
deleted file mode 100644
index 759ee65914..0000000000
--- a/qpid/cpp/src/qpid/framing/Visitor.h
+++ /dev/null
@@ -1,92 +0,0 @@
-#ifndef QPID_FRAMING_VISITOR_H
-#define QPID_FRAMING_VISITOR_H
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-#include <boost/mpl/vector.hpp>
-#include <boost/type_traits/remove_reference.hpp>
-#include <boost/preprocessor/seq/for_each.hpp>
-
-namespace qpid {
-namespace framing {
-
-/** @file Generic visitor pattern. */
-
-/** visit() interface for type T (optional return type R, default is void.)
- * To create a visitor for a set of types T1, T2 ... do this:
- * struct MyVisitor : public Visit<T1>, public Visit<T2> ... {};
- *@param T Type to visit. This must be forward declared, and need not be defined.
- */
-template <class T, class R=void> struct Visit {
- typedef R ReturnType;
- typedef T VisitType;
-
- virtual ~Visit() {}
- virtual R visit(T&) = 0;
-};
-
-
-#define QPID_VISITOR_DECL(_1,_2,T) class T;
-
-#define QPID_VISITOR_BASE(_1,_2,T) , public ::qpid::framing::Visit<T>
-
-/** Convenience macro to generate a visitor interface.
- * QPID_VISITOR(MyVisitor,(A)(B)(C)); is equivalent to:
- * @code
- * class A; class B; class C;
- * class MyVisitor : public Visit<A> , public Visit<B> , public Visit<C> {};
- * @endcode
- * @param visitor name of the generated visitor class.
- * @param bases a sequence of visitable types in the form (T1)(T2)...
- * Any parenthesized notations are due to quirks of the preprocesser.
- */
-#define QPID_VISITOR(visitor,types) \
- BOOST_PP_SEQ_FOR_EACH(QPID_VISITOR_DECL, _, types) \
- class visitor : public ::qpid::framing::Visit<BOOST_PP_SEQ_HEAD(types)> \
- BOOST_PP_SEQ_FOR_EACH(QPID_VISITOR_BASE, _, BOOST_PP_SEQ_TAIL(types)) \
- {}
-
-/** The root class for the hierarchy of objects visitable by Visitor V.
- * Defines virtual accept().
- */
-template <class V, class R=void>
-struct VisitableRoot {
- typedef V VisitorType;
- typedef R ReturnType;
- virtual ~VisitableRoot() {}
- virtual R accept(V& v) = 0;
-};
-
-/** The base class for concrete visitable classes.
- * Implements accept().
- * @param T type of visitable class (CRTP).
- * @param Base base class to inherit from.
- */
-template <class T, class Base>
-struct Visitable : public Base {
- void accept(typename Base::VisitorType& v) {
- static_cast<Visit<T>& >(v).visit(static_cast<T&>(*this));
- }
-};
-
-}} // namespace qpid::framing
-
-#endif /*!QPID_FRAMING_VISITOR_H*/