You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2006/11/17 22:13:40 UTC

svn commit: r476317 - in /incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal: BaseDataStreamMarshaller.cpp BaseDataStreamMarshaller.h

Author: tabish
Date: Fri Nov 17 13:13:39 2006
New Revision: 476317

URL: http://svn.apache.org/viewvc?view=rev&rev=476317
Log:
Changes to support new Openwire Functionality

Modified:
    incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/BaseDataStreamMarshaller.cpp
    incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/BaseDataStreamMarshaller.h

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/BaseDataStreamMarshaller.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/BaseDataStreamMarshaller.cpp?view=diff&rev=476317&r1=476316&r2=476317
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/BaseDataStreamMarshaller.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/BaseDataStreamMarshaller.cpp Fri Nov 17 13:13:39 2006
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-#include <activemq/connector/openwire/marhsal/BaseDataStreamMarshaller.h>
+#include <activemq/connector/openwire/marshal/BaseDataStreamMarshaller.h>
 #include <activemq/connector/openwire/commands/MessageId.h>
 #include <activemq/connector/openwire/commands/ProducerId.h>
 #include <activemq/connector/openwire/commands/TransactionId.h>
@@ -44,7 +44,7 @@
 {
     if( id == NULL ) return "";
     
-    return OpenWireFormat::toString( id->getProducerId() ) + ":" + 
+    return toString( id->getProducerId() ) + ":" + 
            Long::toString( id->getProducerSequenceId() );
 }
 
@@ -74,4 +74,18 @@
     }
 
     return "";
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::string BaseDataStreamMarshaller::toHexFromBytes( 
+    const std::vector<unsigned char>& data )
+{
+    std::string buffer = "";
+    
+    for( int i = 0; i < data.size(); i++ )
+    {
+        buffer.append( hexTable[ data[i] ] );
+    }
+    
+    return buffer;
 }

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/BaseDataStreamMarshaller.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/BaseDataStreamMarshaller.h?view=diff&rev=476317&r1=476316&r2=476317
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/BaseDataStreamMarshaller.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/BaseDataStreamMarshaller.h Fri Nov 17 13:13:39 2006
@@ -22,14 +22,24 @@
 #include <activemq/connector/openwire/commands/MessageId.h>
 #include <activemq/connector/openwire/commands/ProducerId.h>
 #include <activemq/connector/openwire/commands/TransactionId.h>
+#include <activemq/connector/openwire/utils/HexTable.h>
 
 namespace activemq{
 namespace connector{
 namespace openwire{
 namespace marshal{
 
+    /**
+     * Base class for all Marshallers that marshal DataStructures to and
+     * from the wire using the OpenWire protocal.  
+     */
     class BaseDataStreamMarshaller : public DataStreamMarshaller
     {
+    private:
+    
+        // Table for converting bytes to Hex Strings.
+        static utils::HexTable hexTable;
+    
     public:
     
     	BaseDataStreamMarshaller();
@@ -121,6 +131,15 @@
          * @returns string representation of the id
          */
         static std::string toString( commands::TransactionId* txnId );
+
+        /**
+         * given an array of bytes, convert that array to a Hexidecimal 
+         * coded string that represents that data.
+         * @param data - unsigned char data array pointer
+         * @returns a string coded in hex that represents the data
+         */
+        static std::string toHexFromBytes( 
+            const std::vector<unsigned char>& data );
 
     protected: