diff options
| author | Gordon Sim <gsim@apache.org> | 2007-11-07 20:55:35 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2007-11-07 20:55:35 +0000 |
| commit | 0a6761806f55ad18d65e2c22cd18a08e2ec5a149 (patch) | |
| tree | e68f5ba20c7096cd1740131d4ab1a9326dfe0053 /cpp/src/qpid/framing/AMQHeaderBody.h | |
| parent | c9900041bf70ac76a4eb8753965fe24426ba8cd4 (diff) | |
| download | qpid-python-0a6761806f55ad18d65e2c22cd18a08e2ec5a149.tar.gz | |
Fix for QPID-639: c++ now includes sizes for all structs (enabled the same in python & java)
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@592895 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/framing/AMQHeaderBody.h')
| -rw-r--r-- | cpp/src/qpid/framing/AMQHeaderBody.h | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/cpp/src/qpid/framing/AMQHeaderBody.h b/cpp/src/qpid/framing/AMQHeaderBody.h index 76bd60559e..9fd99bd2d9 100644 --- a/cpp/src/qpid/framing/AMQHeaderBody.h +++ b/cpp/src/qpid/framing/AMQHeaderBody.h @@ -41,8 +41,13 @@ class AMQHeaderBody : public AMQBody PropertyList properties; + void decode(BasicHeaderProperties s, Buffer& b, uint32_t size) { + s.decode(b, size); + properties.push_back(s); + } + template <class T> void decode(T t, Buffer& b, uint32_t size) { - t.decode(b, size); + t.decodeStructBody(b, size); properties.push_back(t); } @@ -52,10 +57,14 @@ class AMQHeaderBody : public AMQBody Encode(Buffer& b) : buffer(b) {} template <class T> void operator()(T& t) const { - buffer.putLong(t.size() + 2/*typecode*/); - buffer.putShort(T::TYPE); t.encode(buffer); } + + void operator()(const BasicHeaderProperties& s) const { + buffer.putLong(s.size() + 2/*typecode*/); + buffer.putShort(BasicHeaderProperties::TYPE); + s.encode(buffer); + } }; class CalculateSize : public boost::static_visitor<> { @@ -67,6 +76,10 @@ class AMQHeaderBody : public AMQBody size += t.size(); } + void operator()(const BasicHeaderProperties& s) { + size += s.size() + 2/*typecode*/ + 4/*size field*/; + } + uint32_t totalSize() { return size; } |
