summaryrefslogtreecommitdiff
path: root/cpp/include/qpid/framing/FieldValue.h
diff options
context:
space:
mode:
authorStephen D. Huston <shuston@apache.org>2011-10-21 14:42:12 +0000
committerStephen D. Huston <shuston@apache.org>2011-10-21 14:42:12 +0000
commitf83677056891e436bf5ba99e79240df2a44528cd (patch)
tree625bfd644b948e89105630759cf6decb0435354d /cpp/include/qpid/framing/FieldValue.h
parentebfd9ff053b04ab379acfc0fefedee5a31b6d8a5 (diff)
downloadqpid-python-QPID-2519.tar.gz
Merged out from trunkQPID-2519
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/QPID-2519@1187375 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/include/qpid/framing/FieldValue.h')
-rw-r--r--cpp/include/qpid/framing/FieldValue.h21
1 files changed, 17 insertions, 4 deletions
diff --git a/cpp/include/qpid/framing/FieldValue.h b/cpp/include/qpid/framing/FieldValue.h
index 19220e74d5..458de62fdf 100644
--- a/cpp/include/qpid/framing/FieldValue.h
+++ b/cpp/include/qpid/framing/FieldValue.h
@@ -41,14 +41,14 @@ namespace framing {
*
* \ingroup clientapi
*/
-class FieldValueException : public qpid::Exception {};
+class QPID_COMMON_CLASS_EXTERN FieldValueException : public qpid::Exception {};
/**
* Exception thrown when we can't perform requested conversion
*
* \ingroup clientapi
*/
-struct InvalidConversionException : public FieldValueException {
+struct QPID_COMMON_CLASS_EXTERN InvalidConversionException : public FieldValueException {
InvalidConversionException() {}
};
@@ -59,7 +59,7 @@ class List;
*
* \ingroup clientapi
*/
-class FieldValue {
+class QPID_COMMON_CLASS_EXTERN FieldValue {
public:
/*
* Abstract type for content of different types
@@ -90,7 +90,7 @@ class FieldValue {
void encode(Buffer& buffer);
void decode(Buffer& buffer);
QPID_COMMON_EXTERN bool operator==(const FieldValue&) const;
- QPID_COMMON_EXTERN bool operator!=(const FieldValue& v) const { return !(*this == v); }
+ QPID_COMMON_INLINE_EXTERN bool operator!=(const FieldValue& v) const { return !(*this == v); }
QPID_COMMON_EXTERN void print(std::ostream& out) const;
@@ -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());