diff options
| author | Carl C. Trieloff <cctrieloff@apache.org> | 2008-10-13 18:07:07 +0000 |
|---|---|---|
| committer | Carl C. Trieloff <cctrieloff@apache.org> | 2008-10-13 18:07:07 +0000 |
| commit | 604b624676c20770d6b6b30be3b2fb357892982e (patch) | |
| tree | d9cf003df5760f7815f94e9181df5429b1bbeaf4 /cpp/src/qpid/framing | |
| parent | 02b136ad60558724e77cb1d72d9ca06679c7df87 (diff) | |
| download | qpid-python-604b624676c20770d6b6b30be3b2fb357892982e.tar.gz | |
QPID-1351
-Support for sequencing messages through an exchange
-Related changes
- Bug fix for ptr saftey in Headers & FanOut exchange
- Added support for int64 and uint64 in fieldvalue / fieldtable
- Added tests for fieldtable
- Added tests for sequencing message feature.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@704192 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/framing')
| -rw-r--r-- | cpp/src/qpid/framing/FieldTable.cpp | 16 | ||||
| -rw-r--r-- | cpp/src/qpid/framing/FieldTable.h | 6 | ||||
| -rw-r--r-- | cpp/src/qpid/framing/FieldValue.cpp | 14 | ||||
| -rw-r--r-- | cpp/src/qpid/framing/FieldValue.h | 16 |
4 files changed, 48 insertions, 4 deletions
diff --git a/cpp/src/qpid/framing/FieldTable.cpp b/cpp/src/qpid/framing/FieldTable.cpp index 290983e304..013bcd1797 100644 --- a/cpp/src/qpid/framing/FieldTable.cpp +++ b/cpp/src/qpid/framing/FieldTable.cpp @@ -74,10 +74,18 @@ void FieldTable::setInt(const std::string& name, int value){ values[name] = ValuePtr(new IntegerValue(value)); } +void FieldTable::setInt64(const std::string& name, int64_t value){ + values[name] = ValuePtr(new Integer64Value(value)); +} + void FieldTable::setTimestamp(const std::string& name, uint64_t value){ values[name] = ValuePtr(new TimeValue(value)); } +void FieldTable::setUInt64(const std::string& name, uint64_t value){ + values[name] = ValuePtr(new Unsigned64Value(value)); +} + void FieldTable::setTable(const std::string& name, const FieldTable& value) { values[name] = ValuePtr(new FieldTableValue(value)); @@ -131,6 +139,14 @@ int FieldTable::getInt(const std::string& name) const { // return getValue<uint64_t>(name); //} +uint64_t FieldTable::getAsUInt64(const std::string& name) const { + return static_cast<uint64_t>( getValue<int64_t>(get(name))); +} + +int64_t FieldTable::getAsInt64(const std::string& name) const { + return getValue<int64_t>(get(name)); +} + bool FieldTable::getTable(const std::string& name, FieldTable& value) const { return getEncodedValue<FieldTable>(get(name), value); } diff --git a/cpp/src/qpid/framing/FieldTable.h b/cpp/src/qpid/framing/FieldTable.h index 6dcc2ea7b4..f4f130743b 100644 --- a/cpp/src/qpid/framing/FieldTable.h +++ b/cpp/src/qpid/framing/FieldTable.h @@ -63,7 +63,9 @@ class FieldTable void setString(const std::string& name, const std::string& value); void setInt(const std::string& name, int value); + void setInt64(const std::string& name, int64_t value); void setTimestamp(const std::string& name, uint64_t value); + void setUInt64(const std::string& name, uint64_t value); void setTable(const std::string& name, const FieldTable& value); void setArray(const std::string& name, const Array& value); void setFloat(const std::string& name, float value); @@ -73,11 +75,13 @@ class FieldTable std::string getString(const std::string& name) const; int getInt(const std::string& name) const; // uint64_t getTimestamp(const std::string& name) const; + uint64_t getAsUInt64(const std::string& name) const; + int64_t getAsInt64(const std::string& name) const; bool getTable(const std::string& name, FieldTable& value) const; bool getArray(const std::string& name, Array& value) const; bool getFloat(const std::string& name, float& value) const; bool getDouble(const std::string& name, double& value) const; -// //void getDecimal(string& name, xxx& value); +// void getDecimal(string& name, xxx& value); void erase(const std::string& name); diff --git a/cpp/src/qpid/framing/FieldValue.cpp b/cpp/src/qpid/framing/FieldValue.cpp index bbef9ebceb..5fbfe7d0c1 100644 --- a/cpp/src/qpid/framing/FieldValue.cpp +++ b/cpp/src/qpid/framing/FieldValue.cpp @@ -135,8 +135,7 @@ Struct32Value::Struct32Value(const std::string& v) : IntegerValue::IntegerValue(int v) : FieldValue(0x21, new FixedWidthValue<4>(v)) -{ -} +{} FloatValue::FloatValue(float v) : FieldValue(0x23, new FixedWidthValue<4>(reinterpret_cast<uint8_t*>(&v))) @@ -146,8 +145,17 @@ DoubleValue::DoubleValue(double v) : FieldValue(0x33, new FixedWidthValue<8>(reinterpret_cast<uint8_t*>(&v))) {} -TimeValue::TimeValue(uint64_t v) : +Integer64Value::Integer64Value(int64_t v) : + FieldValue(0x31, new FixedWidthValue<8>(v)) +{} + +Unsigned64Value::Unsigned64Value(uint64_t v) : FieldValue(0x32, new FixedWidthValue<8>(v)) +{} + + +TimeValue::TimeValue(uint64_t v) : + FieldValue(0x38, new FixedWidthValue<8>(v)) { } diff --git a/cpp/src/qpid/framing/FieldValue.h b/cpp/src/qpid/framing/FieldValue.h index 17f858989e..0a70360cbd 100644 --- a/cpp/src/qpid/framing/FieldValue.h +++ b/cpp/src/qpid/framing/FieldValue.h @@ -106,12 +106,18 @@ template <> inline bool FieldValue::convertsTo<int>() const { return data->convertsToInt(); } template <> +inline bool FieldValue::convertsTo<int64_t>() const { return data->convertsToInt(); } + +template <> inline bool FieldValue::convertsTo<std::string>() const { return data->convertsToString(); } template <> inline int FieldValue::get<int>() const { return data->getInt(); } template <> +inline int64_t FieldValue::get<int64_t>() const { return data->getInt(); } + +template <> inline std::string FieldValue::get<std::string>() const { return data->getString(); } inline std::ostream& operator<<(std::ostream& out, const FieldValue& v) { @@ -278,6 +284,16 @@ class TimeValue : public FieldValue { TimeValue(uint64_t v); }; +class Integer64Value : public FieldValue { + public: + Integer64Value(int64_t v); +}; + +class Unsigned64Value : public FieldValue { + public: + Unsigned64Value(uint64_t v); +}; + class FieldTableValue : public FieldValue { public: FieldTableValue(const FieldTable&); |
