activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r453606 - in /incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal: HexTable.cpp HexTable.h
Date Fri, 06 Oct 2006 14:15:53 GMT
Author: tabish
Date: Fri Oct  6 07:15:53 2006
New Revision: 453606

URL: http://svn.apache.org/viewvc?view=rev&rev=453606
Log:
Adding new code for Openwire Support

Added:
    incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/HexTable.cpp
  (with props)
    incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/HexTable.h
  (with props)

Added: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/HexTable.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/HexTable.cpp?view=auto&rev=453606
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/HexTable.cpp
(added)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/HexTable.cpp
Fri Oct  6 07:15:53 2006
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "HexTable.h"
+
+#include <activemq/util/Integer.h>
+
+using namespace std;
+using namespace activemq;
+using namespace activemq::util;
+using namespace activemq::exceptions;
+using namespace activemq::connector;
+using namespace activemq::connector::openwire;
+using namespace activemq::connector::openwire::marshal;
+
+////////////////////////////////////////////////////////////////////////////////
+HexTable::HexTable(){
+    
+    const char values[] = { 'a', 'b', 'c' };
+    table.push_back( "00" );
+    table.push_back( "00" );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+const std::string& HexTable::operator[]( int index ) 
+    throw ( exceptions::IndexOutOfBoundsException ) {
+    if( size() < index ) {
+        throw IndexOutOfBoundsException(
+            __FILE__, __LINE__,
+            ( string( "HexTable::operator[] - Index passed is out of Bounds" ) +
+              Integer::toString( index ) ).c_str() );
+    }
+    
+    return table[index];
+}
+
+////////////////////////////////////////////////////////////////////////////////
+const std::string& HexTable::operator[]( int index ) const 
+    throw ( exceptions::IndexOutOfBoundsException ) {
+        
+    if( size() < index ) {
+        throw IndexOutOfBoundsException(
+            __FILE__, __LINE__,
+            ( string( "HexTable::operator[] - Index passed is out of Bounds" ) +
+              Integer::toString( index ) ).c_str() );
+    }
+    
+    return table[index];
+}

Propchange: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/HexTable.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/HexTable.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/HexTable.h?view=auto&rev=453606
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/HexTable.h
(added)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/HexTable.h
Fri Oct  6 07:15:53 2006
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _ACTIVEMQ_CONNECTOR_OPENWIRE_MARSHAL_HEXTABLE_H_
+#define _ACTIVEMQ_CONNECTOR_OPENWIRE_MARSHAL_HEXTABLE_H_
+
+#include <vector>
+#include <string>
+
+#include <activemq/exceptions/IndexOutOfBoundsException.h>
+
+namespace activemq{
+namespace connector{
+namespace openwire{
+namespace marshal{
+    
+    /**
+     * The HexTable class maps hexidecimal strings to the value of an index
+     * into the table, i.e. the class will return "FF" for the index 255 in
+     * the table.  
+     */
+    class HexTable
+    {
+    public:
+    
+    	HexTable();
+    	virtual ~HexTable() {}
+        
+        /**
+         * Index operator for this Table, will throw an exeption if the
+         * index requested is out of bounds for this table.
+         * @param int - index to fetch
+         * @returns string contianing the hex value if the index
+         * @throws IndexOutOfBoundsException
+         */
+        virtual const std::string& operator[]( int index ) throw ( exceptions::IndexOutOfBoundsException
);
+        virtual const std::string& operator[]( int index ) const throw ( exceptions::IndexOutOfBoundsException
);
+        
+        /**
+         * Returns the max size of this Table.
+         * @returns int size value
+         */
+        virtual int size() const{
+            return table.size();
+        }
+        
+    private:
+    
+        // Vector of Strings mapping hex to the value of the index.
+        std::vector<std::string> table;
+        
+    };
+
+}}}}
+
+#endif /*_ACTIVEMQ_CONNECTOR_OPENWIRE_MARSHAL_HEXTABLE_H_*/

Propchange: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/marshal/HexTable.h
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message