diff options
| author | Andrew Stitcher <astitcher@apache.org> | 2011-05-09 19:56:11 +0000 |
|---|---|---|
| committer | Andrew Stitcher <astitcher@apache.org> | 2011-05-09 19:56:11 +0000 |
| commit | 35f91f5e74abfc0c0214e5d7eaf1bad69405801b (patch) | |
| tree | 6e9aa97ddf6abdf042a27e33ab7f799cb25f430d /qpid/cpp/include | |
| parent | b66bd995ff224ee7c34fbd1d9eae87d908707a60 (diff) | |
| download | qpid-python-35f91f5e74abfc0c0214e5d7eaf1bad69405801b.tar.gz | |
QPID-3004: Get Clang to compile qpid c++
- Add new template function for FieldValue::getIntegerValue() to avoid
compile error when extracting into 1 byte ints.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1101183 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/include')
| -rw-r--r-- | qpid/cpp/include/qpid/framing/FieldValue.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/qpid/cpp/include/qpid/framing/FieldValue.h b/qpid/cpp/include/qpid/framing/FieldValue.h index 19220e74d5..e6255066c4 100644 --- a/qpid/cpp/include/qpid/framing/FieldValue.h +++ b/qpid/cpp/include/qpid/framing/FieldValue.h @@ -98,6 +98,7 @@ class FieldValue { template <typename T> T get() const { throw InvalidConversionException(); } template <class T, int W> T getIntegerValue() const; + template <class T> T getIntegerValue() const; template <class T, int W> T getFloatingPointValue() const; template <int W> void getFixedWidthValue(unsigned char*) const; template <class T> bool get(T&) const; @@ -196,6 +197,18 @@ inline T FieldValue::getIntegerValue() const } } +template <class T> +inline T FieldValue::getIntegerValue() const +{ + FixedWidthValue<1>* const fwv = dynamic_cast< FixedWidthValue<1>* const>(data.get()); + if (fwv) { + uint8_t* octets = fwv->rawOctets(); + return octets[0]; + } else { + throw InvalidConversionException(); + } +} + template <class T, int W> inline T FieldValue::getFloatingPointValue() const { FixedWidthValue<W>* const fwv = dynamic_cast< FixedWidthValue<W>* const>(data.get()); |
