qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From astitc...@apache.org
Subject svn commit: r1101183 - in /qpid/trunk/qpid/cpp: include/qpid/framing/FieldValue.h src/qpid/amqp_0_10/Codecs.cpp src/qpid/management/ManagementAgent.cpp
Date Mon, 09 May 2011 19:56:11 GMT
Author: astitcher
Date: Mon May  9 19:56:11 2011
New Revision: 1101183

URL: http://svn.apache.org/viewvc?rev=1101183&view=rev
Log:
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.

Modified:
    qpid/trunk/qpid/cpp/include/qpid/framing/FieldValue.h
    qpid/trunk/qpid/cpp/src/qpid/amqp_0_10/Codecs.cpp
    qpid/trunk/qpid/cpp/src/qpid/management/ManagementAgent.cpp

Modified: qpid/trunk/qpid/cpp/include/qpid/framing/FieldValue.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/include/qpid/framing/FieldValue.h?rev=1101183&r1=1101182&r2=1101183&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/include/qpid/framing/FieldValue.h (original)
+++ qpid/trunk/qpid/cpp/include/qpid/framing/FieldValue.h Mon May  9 19:56:11 2011
@@ -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() c
     }
 }
 
+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());

Modified: qpid/trunk/qpid/cpp/src/qpid/amqp_0_10/Codecs.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/amqp_0_10/Codecs.cpp?rev=1101183&r1=1101182&r2=1101183&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/amqp_0_10/Codecs.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/amqp_0_10/Codecs.cpp Mon May  9 19:56:11 2011
@@ -127,10 +127,10 @@ Variant toVariant(boost::shared_ptr<Fiel
     switch (in->getType()) {
         //Fixed Width types:
       case 0x01: out.setEncoding(amqp0_10_binary);
-      case 0x02: out = in->getIntegerValue<int8_t, 1>(); break;
-      case 0x03: out = in->getIntegerValue<uint8_t, 1>(); break;
+      case 0x02: out = in->getIntegerValue<int8_t>(); break;
+      case 0x03: out = in->getIntegerValue<uint8_t>(); break;
       case 0x04: break; //TODO: iso-8859-15 char
-      case 0x08: out = static_cast<bool>(in->getIntegerValue<uint8_t, 1>());
break;
+      case 0x08: out = static_cast<bool>(in->getIntegerValue<uint8_t>());
break;
       case 0x10: out.setEncoding(amqp0_10_binary);
       case 0x11: out = in->getIntegerValue<int16_t, 2>(); break;
       case 0x12: out = in->getIntegerValue<uint16_t, 2>(); break;

Modified: qpid/trunk/qpid/cpp/src/qpid/management/ManagementAgent.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/management/ManagementAgent.cpp?rev=1101183&r1=1101182&r2=1101183&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/management/ManagementAgent.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/management/ManagementAgent.cpp Mon May  9 19:56:11 2011
@@ -2861,10 +2861,10 @@ Variant ManagementAgent::toVariant(const
         //Fixed Width types:
     case 0x00: //bin8
     case 0x01: out.setEncoding(amqp0_10_binary); // int8
-    case 0x02: out = in->getIntegerValue<int8_t, 1>(); break;  //uint8
-    case 0x03: out = in->getIntegerValue<uint8_t, 1>(); break;  // 
+    case 0x02: out = in->getIntegerValue<int8_t>(); break;  //uint8
+    case 0x03: out = in->getIntegerValue<uint8_t>(); break;  // 
         // case 0x04: break; //TODO: iso-8859-15 char  // char
-    case 0x08: out = static_cast<bool>(in->getIntegerValue<uint8_t, 1>());
break;  // bool int8
+    case 0x08: out = static_cast<bool>(in->getIntegerValue<uint8_t>()); break;
 // bool int8
 
     case 0x10: out.setEncoding(amqp0_10_binary);  // bin16
     case 0x11: out = in->getIntegerValue<int16_t, 2>(); break;  // int16



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message