diff options
author | Alan Conway <aconway@apache.org> | 2008-10-07 17:24:24 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2008-10-07 17:24:24 +0000 |
commit | a653ebe5bdfad1d44a576d2ab23f7e6ea80ba96f (patch) | |
tree | cf778054e9316b643d84c95dbe88ba72810f49cf /cpp/src/qpid/framing/Array.cpp | |
parent | 4eb2dca5b9ae07228f542cd798b44cc44ea96c09 (diff) | |
download | qpid-python-a653ebe5bdfad1d44a576d2ab23f7e6ea80ba96f.tar.gz |
Rename size() to encodedSize() for encoded types to allow std collection interfaces for types like FieldTable and Array.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@702551 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/framing/Array.cpp')
-rw-r--r-- | cpp/src/qpid/framing/Array.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/cpp/src/qpid/framing/Array.cpp b/cpp/src/qpid/framing/Array.cpp index f0b6331ff3..bcee85f472 100644 --- a/cpp/src/qpid/framing/Array.cpp +++ b/cpp/src/qpid/framing/Array.cpp @@ -42,11 +42,11 @@ Array::Array(const std::vector<std::string>& in) } -uint32_t Array::size() const { +uint32_t Array::encodedSize() const { //note: size is only included when used as a 'top level' type uint32_t len(4/*size*/ + 1/*type*/ + 4/*count*/); for(ValueVector::const_iterator i = values.begin(); i != values.end(); ++i) { - len += (*i)->getData().size(); + len += (*i)->getData().encodedSize(); } return len; } @@ -65,7 +65,7 @@ std::ostream& operator<<(std::ostream& out, const Array& t) { } void Array::encode(Buffer& buffer) const{ - buffer.putLong(size() - 4);//size added only when array is a top-level type + buffer.putLong(encodedSize() - 4);//size added only when array is a top-level type buffer.putOctet(typeOctet); buffer.putLong(count()); for (ValueVector::const_iterator i = values.begin(); i!=values.end(); ++i) { @@ -87,9 +87,9 @@ void Array::decode(Buffer& buffer){ FieldValue dummy; dummy.setType(typeOctet); available = buffer.available(); - if (available < count * dummy.getData().size()) { + if (available < count * dummy.getData().encodedSize()) { throw IllegalArgumentException(QPID_MSG("Not enough data for array, expected " - << count << " items of " << dummy.getData().size() + << count << " items of " << dummy.getData().encodedSize() << " bytes each but only " << available << " bytes available")); } |