qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From astitc...@apache.org
Subject svn commit: r704255 - in /incubator/qpid/trunk/qpid/cpp: examples/xml-exchange/ src/qpid/broker/ src/qpid/framing/ src/qpid/management/ src/tests/
Date Mon, 13 Oct 2008 21:24:40 GMT
Author: astitcher
Date: Mon Oct 13 14:24:40 2008
New Revision: 704255

URL: http://svn.apache.org/viewvc?rev=704255&view=rev
Log:
Field Table API: changed the getInt() & getString() operations
which are inconsistent with all the other getXXX() functions to
getAsString()/getAsInt() to better indicate their real function.

Modified:
    incubator/qpid/trunk/qpid/cpp/examples/xml-exchange/listener.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Message.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/broker/XmlExchange.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/framing/FieldTable.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/framing/FieldTable.h
    incubator/qpid/trunk/qpid/cpp/src/qpid/management/ManagementBroker.cpp
    incubator/qpid/trunk/qpid/cpp/src/tests/FieldTable.cpp
    incubator/qpid/trunk/qpid/cpp/src/tests/MessageTest.cpp
    incubator/qpid/trunk/qpid/cpp/src/tests/QueueOptionsTest.cpp
    incubator/qpid/trunk/qpid/cpp/src/tests/topic_listener.cpp

Modified: incubator/qpid/trunk/qpid/cpp/examples/xml-exchange/listener.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/examples/xml-exchange/listener.cpp?rev=704255&r1=704254&r2=704255&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/examples/xml-exchange/listener.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/examples/xml-exchange/listener.cpp Mon Oct 13 14:24:40 2008
@@ -50,7 +50,7 @@
 
 void Listener::received(Message& message) {
   std::cout << "Message: " << message.getData() << std::endl;
-  if (message.getHeaders().getString("control") == "end") {
+  if (message.getHeaders().getAsString("control") == "end") {
       std::cout << "Shutting down listener for " << message.getDestination()
                 << std::endl;
       subscriptions.cancel(message.getDestination());

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Message.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Message.cpp?rev=704255&r1=704254&r2=704255&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Message.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Message.cpp Mon Oct 13 14:24:40 2008
@@ -273,7 +273,7 @@
 {
     const FieldTable* headers = getApplicationHeaders();
     if (headers) {
-        std::string traceStr = headers->getString(X_QPID_TRACE);
+        std::string traceStr = headers->getAsString(X_QPID_TRACE);
         if (traceStr.size()) {
             std::vector<std::string> trace = split(traceStr, ", ");
 
@@ -294,7 +294,7 @@
     sys::Mutex::ScopedLock l(lock);
     if (isA<MessageTransferBody>()) {
         FieldTable& headers = getProperties<MessageProperties>()->getApplicationHeaders();
-        std::string trace = headers.getString(X_QPID_TRACE);
+        std::string trace = headers.getAsString(X_QPID_TRACE);
         if (trace.empty()) {
             headers.setString(X_QPID_TRACE, id);
         } else if (trace.find(id) == std::string::npos) {

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp?rev=704255&r1=704254&r2=704255&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp Mon Oct 13 14:24:40 2008
@@ -206,7 +206,7 @@
             || (lastValueQueue && i->position == msg.position && i->payload.get()
== msg.payload.get())) {
             if (lastValueQueue){
                 const framing::FieldTable* ft = msg.payload->getApplicationHeaders();
-                string key = ft->getString(qpidVQMatchProperty);
+                string key = ft->getAsString(qpidVQMatchProperty);
                 lvq.erase(key);
             }
             messages.erase(i);
@@ -461,7 +461,7 @@
 {
     if (lastValueQueue){
     	const framing::FieldTable* ft = qmsg.payload->getApplicationHeaders();
-        string key = ft->getString(qpidVQMatchProperty);
+        string key = ft->getAsString(qpidVQMatchProperty);
         lvq.erase(key);
     }
     messages.pop_front();
@@ -478,7 +478,7 @@
         LVQ::iterator i;
         if (lastValueQueue){
             const framing::FieldTable* ft = msg->getApplicationHeaders();
-            string key = ft->getString(qpidVQMatchProperty);
+            string key = ft->getAsString(qpidVQMatchProperty);
 
             i = lvq.find(key);
             if (i == lvq.end()){
@@ -625,8 +625,8 @@
     persistLastNode= _settings.get(qpidPersistLastNode);
     if (persistLastNode) QPID_LOG(debug, "Configured queue to Persist data if cluster fails
to one node");
 
-    traceId = _settings.getString(qpidTraceIdentity);
-    std::string excludeList = _settings.getString(qpidTraceExclude);
+    traceId = _settings.getAsString(qpidTraceIdentity);
+    std::string excludeList = _settings.getAsString(qpidTraceExclude);
     if (excludeList.size()) {
         split(traceExclude, excludeList, ", ");
     }

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/XmlExchange.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/XmlExchange.cpp?rev=704255&r1=704254&r2=704255&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/XmlExchange.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/XmlExchange.cpp Mon Oct 13 14:24:40 2008
@@ -78,7 +78,7 @@
 
 bool XmlExchange::bind(Queue::shared_ptr queue, const string& routingKey, const FieldTable*
bindingArguments)
 {
-    string queryText = bindingArguments->getString("xquery");
+    string queryText = bindingArguments->getAsString("xquery");
 
     try {
         RWlock::ScopedWlock l(lock);

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/framing/FieldTable.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/framing/FieldTable.cpp?rev=704255&r1=704254&r2=704255&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/framing/FieldTable.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/framing/FieldTable.cpp Mon Oct 13 14:24:40 2008
@@ -127,18 +127,14 @@
     return value->get<T>();
 }
 
-std::string FieldTable::getString(const std::string& name) const {
+std::string FieldTable::getAsString(const std::string& name) const {
     return getValue<std::string>(get(name));
 }
 
-int FieldTable::getInt(const std::string& name) const {
+int FieldTable::getAsInt(const std::string& name) const {
     return getValue<int>(get(name));
 }
 
-//uint64_t FieldTable::getTimestamp(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)));
 }
@@ -176,6 +172,10 @@
     return getRawFixedWidthValue<double, 8, 0x33>(get(name), value);
 }
 
+//uint64_t FieldTable::getTimestamp(const std::string& name) const {
+//    return getValue<uint64_t>(name);
+//}
+
 void FieldTable::encode(Buffer& buffer) const{    
     buffer.putLong(encodedSize() - 4);
     buffer.putLong(values.size());

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/framing/FieldTable.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/framing/FieldTable.h?rev=704255&r1=704254&r2=704255&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/framing/FieldTable.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/framing/FieldTable.h Mon Oct 13 14:24:40 2008
@@ -72,16 +72,17 @@
     void setDouble(const std::string& name, double value);
     //void setDecimal(string& name, xxx& value);
 
-    std::string getString(const std::string& name) const;
-    int getInt(const std::string& name) const;
-//    uint64_t getTimestamp(const std::string& name) const;
+    int getAsInt(const std::string& name) const;
     uint64_t getAsUInt64(const std::string& name) const;
     int64_t getAsInt64(const std::string& name) const;
+    std::string getAsString(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);
+    //bool getTimestamp(const std::string& name, uint64_t& value) const;
+    //bool getDecimal(string& name, xxx& value);
     void erase(const std::string& name);
     
 

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/management/ManagementBroker.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/management/ManagementBroker.cpp?rev=704255&r1=704254&r2=704255&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/management/ManagementBroker.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/management/ManagementBroker.cpp Mon Oct 13 14:24:40
2008
@@ -1083,7 +1083,7 @@
             ft.decode(inBuffer);
             if (!ft.isSet("argCount"))
                 return 0;
-            int argCount = ft.getInt("argCount");
+            int argCount = ft.getAsInt("argCount");
             for (int mIdx = 0; mIdx < argCount; mIdx++) {
                 FieldTable aft;
                 aft.decode(inBuffer);

Modified: incubator/qpid/trunk/qpid/cpp/src/tests/FieldTable.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/FieldTable.cpp?rev=704255&r1=704254&r2=704255&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/FieldTable.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/FieldTable.cpp Mon Oct 13 14:24:40 2008
@@ -34,7 +34,7 @@
 {
     FieldTable ft;
     ft.setString("A", "BCDE");
-    BOOST_CHECK(string("BCDE") == ft.getString("A"));
+    BOOST_CHECK(string("BCDE") == ft.getAsString("A"));
 
     char buff[100];
     Buffer wbuffer(buff, 100);
@@ -43,7 +43,7 @@
     Buffer rbuffer(buff, 100);
     FieldTable ft2;
     rbuffer.get(ft2);
-    BOOST_CHECK(string("BCDE") == ft2.getString("A"));
+    BOOST_CHECK(string("BCDE") == ft2.getAsString("A"));
 
 }
 
@@ -57,10 +57,10 @@
     b = a;
     a.setString("A", "CCCC");
     
-    BOOST_CHECK(string("CCCC") == a.getString("A"));
-    BOOST_CHECK(string("BBBB") == b.getString("A"));
-    BOOST_CHECK_EQUAL(1234, a.getInt("B"));
-    BOOST_CHECK_EQUAL(1234, b.getInt("B"));
+    BOOST_CHECK(string("CCCC") == a.getAsString("A"));
+    BOOST_CHECK(string("BBBB") == b.getAsString("A"));
+    BOOST_CHECK_EQUAL(1234, a.getAsInt("B"));
+    BOOST_CHECK_EQUAL(1234, b.getAsInt("B"));
     BOOST_CHECK(IntegerValue(1234) == *a.get("B"));
     BOOST_CHECK(IntegerValue(1234) == *b.get("B"));
 
@@ -76,10 +76,10 @@
         Buffer rbuffer(buff, c.encodedSize());
         rbuffer.get(d);
         BOOST_CHECK_EQUAL(c, d);
-        BOOST_CHECK(string("CCCC") == c.getString("A"));
+        BOOST_CHECK(string("CCCC") == c.getAsString("A"));
         BOOST_CHECK(IntegerValue(1234) == *c.get("B"));
     }
-    BOOST_CHECK(string("CCCC") == d.getString("A"));
+    BOOST_CHECK(string("CCCC") == d.getAsString("A"));
     BOOST_CHECK(IntegerValue(1234) == *d.get("B"));
 }
 
@@ -110,9 +110,9 @@
         FieldTable b;
         Array c;
         rbuffer.get(a);
-        BOOST_CHECK(string("A") == a.getString("id"));
+        BOOST_CHECK(string("A") == a.getAsString("id"));
         a.getTable("B", b);
-        BOOST_CHECK(string("B") == b.getString("id"));
+        BOOST_CHECK(string("B") == b.getAsString("id"));
         a.getArray("C", c);
         std::vector<std::string> items;
         c.collect(items);
@@ -141,8 +141,8 @@
         Buffer rbuffer(buff, 100);
         FieldTable a;
         rbuffer.get(a);
-        BOOST_CHECK(string("abc") == a.getString("string"));
-        BOOST_CHECK(5672 == a.getInt("int"));
+        BOOST_CHECK(string("abc") == a.getAsString("string"));
+        BOOST_CHECK(5672 == a.getAsInt("int"));
         float f2;
         BOOST_CHECK(!a.getFloat("string", f2));
         BOOST_CHECK(!a.getFloat("int", f2));

Modified: incubator/qpid/trunk/qpid/cpp/src/tests/MessageTest.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/MessageTest.cpp?rev=704255&r1=704254&r2=704255&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/MessageTest.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/MessageTest.cpp Mon Oct 13 14:24:40 2008
@@ -81,7 +81,7 @@
     BOOST_CHECK_EQUAL((uint64_t) data1.size() + data2.size(), msg->contentSize());
     BOOST_CHECK_EQUAL((uint64_t) data1.size() + data2.size(), msg->getProperties<MessageProperties>()->getContentLength());
     BOOST_CHECK_EQUAL(messageId, msg->getProperties<MessageProperties>()->getMessageId());
-    BOOST_CHECK_EQUAL(string("xyz"), msg->getProperties<MessageProperties>()->getApplicationHeaders().getString("abc"));
+    BOOST_CHECK_EQUAL(string("xyz"), msg->getProperties<MessageProperties>()->getApplicationHeaders().getAsString("abc"));
     BOOST_CHECK_EQUAL((uint8_t) PERSISTENT, msg->getProperties<DeliveryProperties>()->getDeliveryMode());
     BOOST_CHECK(msg->isPersistent());
 }

Modified: incubator/qpid/trunk/qpid/cpp/src/tests/QueueOptionsTest.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/QueueOptionsTest.cpp?rev=704255&r1=704254&r2=704255&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/QueueOptionsTest.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/QueueOptionsTest.cpp Mon Oct 13 14:24:40 2008
@@ -36,20 +36,20 @@
 	
 	ft.setSizePolicy(REJECT,1,2);
 	
-    BOOST_CHECK(QueueOptions::strREJECT == ft.getString(QueueOptions::strTypeKey));
-    BOOST_CHECK(1 == ft.getInt(QueueOptions::strMaxSizeKey));
-    BOOST_CHECK(2 == ft.getInt(QueueOptions::strMaxCountKey));
+    BOOST_CHECK(QueueOptions::strREJECT == ft.getAsString(QueueOptions::strTypeKey));
+    BOOST_CHECK(1 == ft.getAsInt(QueueOptions::strMaxSizeKey));
+    BOOST_CHECK(2 == ft.getAsInt(QueueOptions::strMaxCountKey));
 
 	ft.setSizePolicy(FLOW_TO_DISK,0,2);
-    BOOST_CHECK(QueueOptions::strFLOW_TO_DISK == ft.getString(QueueOptions::strTypeKey));
-    BOOST_CHECK(1 == ft.getInt(QueueOptions::strMaxSizeKey));
-    BOOST_CHECK(2 == ft.getInt(QueueOptions::strMaxCountKey));
+    BOOST_CHECK(QueueOptions::strFLOW_TO_DISK == ft.getAsString(QueueOptions::strTypeKey));
+    BOOST_CHECK(1 == ft.getAsInt(QueueOptions::strMaxSizeKey));
+    BOOST_CHECK(2 == ft.getAsInt(QueueOptions::strMaxCountKey));
 
 	ft.setSizePolicy(RING,1,0);
-    BOOST_CHECK(QueueOptions::strRING == ft.getString(QueueOptions::strTypeKey));
+    BOOST_CHECK(QueueOptions::strRING == ft.getAsString(QueueOptions::strTypeKey));
 
 	ft.setSizePolicy(RING_STRICT,1,0);
-    BOOST_CHECK(QueueOptions::strRING_STRICT == ft.getString(QueueOptions::strTypeKey));
+    BOOST_CHECK(QueueOptions::strRING_STRICT == ft.getAsString(QueueOptions::strTypeKey));
 	
 	ft.clearSizePolicy();
 	BOOST_CHECK(!ft.isSet(QueueOptions::strTypeKey));
@@ -65,9 +65,9 @@
 	ft.setPersistLastNode();
     ft.setOrdering(LVQ);
 	
-    BOOST_CHECK(1 == ft.getInt(QueueOptions::strOptimisticConsume));
-    BOOST_CHECK(1 == ft.getInt(QueueOptions::strPersistLastNode));
-    BOOST_CHECK(1 == ft.getInt(QueueOptions::strLastValueQueue));
+    BOOST_CHECK(1 == ft.getAsInt(QueueOptions::strOptimisticConsume));
+    BOOST_CHECK(1 == ft.getAsInt(QueueOptions::strPersistLastNode));
+    BOOST_CHECK(1 == ft.getAsInt(QueueOptions::strLastValueQueue));
 	
 	ft.clearOptimisticConsume();
 	ft.clearPersistLastNode();

Modified: incubator/qpid/trunk/qpid/cpp/src/tests/topic_listener.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/topic_listener.cpp?rev=704255&r1=704254&r2=704255&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/topic_listener.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/topic_listener.cpp Mon Oct 13 14:24:40 2008
@@ -165,7 +165,7 @@
         init = true;
         cout << "Batch started." << endl;
     }
-    string type = message.getHeaders().getString("TYPE");
+    string type = message.getHeaders().getAsString("TYPE");
 
     if(string("TERMINATION_REQUEST") == type){
         shutdown();



Mime
View raw message