activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r600969 - in /activemq/activemq-cpp/decaf/trunk/src: main/ main/decaf/internal/nio/ main/decaf/internal/util/ test/ test/decaf/internal/util/
Date Tue, 04 Dec 2007 14:42:45 GMT
Author: tabish
Date: Tue Dec  4 06:42:43 2007
New Revision: 600969

URL: http://svn.apache.org/viewvc?rev=600969&view=rev
Log:
http://issues.apache.org/activemq/browse/AMQCPP-153

Working on implementing the NIO package

Added:
    activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/util/ByteArrayAdapter.cpp
      - copied, changed from r600926, activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/util/ByteArray.cpp
    activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/util/ByteArrayAdapter.h
      - copied, changed from r600926, activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/util/ByteArray.h
    activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/util/ByteArrayAdapterTest.cpp
      - copied, changed from r600350, activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/util/ByteArrayTest.cpp
    activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/util/ByteArrayAdapterTest.h
      - copied, changed from r600350, activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/util/ByteArrayTest.h
Removed:
    activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/util/ByteArray.cpp
    activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/util/ByteArray.h
    activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/util/ByteArrayTest.cpp
    activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/util/ByteArrayTest.h
Modified:
    activemq/activemq-cpp/decaf/trunk/src/main/Makefile.am
    activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/ByteArrayPerspective.cpp
    activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/ByteArrayPerspective.h
    activemq/activemq-cpp/decaf/trunk/src/test/Makefile.am
    activemq/activemq-cpp/decaf/trunk/src/test/testRegistry.cpp

Modified: activemq/activemq-cpp/decaf/trunk/src/main/Makefile.am
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/Makefile.am?rev=600969&r1=600968&r2=600969&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/Makefile.am (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/Makefile.am Tue Dec  4 06:42:43 2007
@@ -22,8 +22,8 @@
    decaf/internal/util/BitOps.cpp \
    decaf/internal/util/NumberConverter.cpp \
    decaf/internal/util/FloatingPointParser.cpp \
+   decaf/internal/util/ByteArrayAdapter.cpp \
    decaf/internal/util/HexStringParser.cpp \
-   decaf/internal/util/ByteArray.cpp \
    decaf/internal/nio/BufferFactory.cpp \
    decaf/internal/nio/ByteArrayPerspective.cpp \
    decaf/internal/nio/ByteArrayBuffer.cpp \
@@ -195,7 +195,7 @@
    decaf/internal/util/HexStringParser.h \
    decaf/internal/util/BitOps.h \
    decaf/internal/util/BigInt.h \
-   decaf/internal/util/ByteArray.h \
+   decaf/internal/util/ByteArrayAdapter.h \
    decaf/internal/nio/BufferFactory.h \
    decaf/internal/nio/ByteArrayPerspective.h \
    decaf/internal/nio/ByteArrayBuffer.h \

Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/ByteArrayPerspective.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/ByteArrayPerspective.cpp?rev=600969&r1=600968&r2=600969&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/ByteArrayPerspective.cpp (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/ByteArrayPerspective.cpp Tue Dec  4 06:42:43 2007
@@ -23,14 +23,14 @@
 using namespace decaf::internal::util;
 
 ////////////////////////////////////////////////////////////////////////////////
-ByteArrayPerspective::ByteArrayPerspective( int capacity ) : ByteArray( capacity ){
+ByteArrayPerspective::ByteArrayPerspective( int capacity ) : ByteArrayAdapter( capacity ){
     this->references = 1;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 ByteArrayPerspective::ByteArrayPerspective( unsigned char* array, std::size_t capacity, bool own )
     throw( lang::exceptions::NullPointerException ) :
-        ByteArray( array, capacity, own ) {
+        ByteArrayAdapter( array, capacity, own ) {
 
     this->references = 1;
 }

Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/ByteArrayPerspective.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/ByteArrayPerspective.h?rev=600969&r1=600968&r2=600969&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/ByteArrayPerspective.h (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/ByteArrayPerspective.h Tue Dec  4 06:42:43 2007
@@ -18,7 +18,7 @@
 #ifndef _DECAF_INTERNAL_NIO_BYTEARRAYPERSPECTIVE_H_
 #define _DECAF_INTERNAL_NIO_BYTEARRAYPERSPECTIVE_H_
 
-#include <decaf/internal/util/ByteArray.h>
+#include <decaf/internal/util/ByteArrayAdapter.h>
 
 namespace decaf{
 namespace internal{
@@ -32,7 +32,7 @@
      * Creating an instance of this class implicity takes a reference to it, so
      * a creator must return its ref before the count will be zero.
      */
-    class ByteArrayPerspective : public util::ByteArray {
+    class ByteArrayPerspective : public util::ByteArrayAdapter {
     private:
 
         // Count of the number of perspectives into this array.

Copied: activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/util/ByteArrayAdapter.cpp (from r600926, activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/util/ByteArray.cpp)
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/util/ByteArrayAdapter.cpp?p2=activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/util/ByteArrayAdapter.cpp&p1=activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/util/ByteArray.cpp&r1=600926&r2=600969&rev=600969&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/util/ByteArray.cpp (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/util/ByteArrayAdapter.cpp Tue Dec  4 06:42:43 2007
@@ -15,11 +15,13 @@
  * limitations under the License.
  */
 
-#include "ByteArray.h"
+#include "ByteArrayAdapter.h"
 
 #include <string.h>
 #include <stdio.h>
 #include <decaf/lang/Math.h>
+#include <decaf/lang/Float.h>
+#include <decaf/lang/Double.h>
 
 using namespace decaf;
 using namespace decaf::nio;
@@ -29,43 +31,116 @@
 using namespace decaf::lang::exceptions;
 
 ////////////////////////////////////////////////////////////////////////////////
-ByteArray::ByteArray( std::size_t capacity ) {
+ByteArrayAdapter::ByteArrayAdapter( std::size_t capacity ) {
 
     try{
 
-        this->capacity = capacity;
         this->array = new unsigned char[capacity];
-        this->own = true;
-
-        // Ensure memory is clear
         memset( this->array, 0, capacity );
+        this->initialize( array, capacity, true );
     }
     DECAF_CATCH_RETHROW( Exception )
     DECAF_CATCHALL_THROW( Exception )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-ByteArray::ByteArray( unsigned char* array, std::size_t capacity, bool own )
+ByteArrayAdapter::ByteArrayAdapter( unsigned char* array, std::size_t capacity, bool own )
+    throw( lang::exceptions::NullPointerException ) {
+
+    try{
+        this->initialize( array, capacity, own );
+    }
+    DECAF_CATCH_RETHROW( NullPointerException )
+    DECAF_CATCHALL_THROW( NullPointerException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ByteArrayAdapter::ByteArrayAdapter( char* array, std::size_t capacity, bool own )
+    throw( lang::exceptions::NullPointerException ) {
+
+    try{
+        this->initialize( reinterpret_cast<unsigned char*>( array ), capacity, own );
+    }
+    DECAF_CATCH_RETHROW( NullPointerException )
+    DECAF_CATCHALL_THROW( NullPointerException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ByteArrayAdapter::ByteArrayAdapter( double* array, std::size_t capacity, bool own )
+    throw( lang::exceptions::NullPointerException ) {
+
+    try{
+        this->initialize( reinterpret_cast<unsigned char*>( array ), capacity, own );
+    }
+    DECAF_CATCH_RETHROW( NullPointerException )
+    DECAF_CATCHALL_THROW( NullPointerException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ByteArrayAdapter::ByteArrayAdapter( float* array, std::size_t capacity, bool own )
+    throw( lang::exceptions::NullPointerException ) {
+
+    try{
+        this->initialize( reinterpret_cast<unsigned char*>( array ), capacity, own );
+    }
+    DECAF_CATCH_RETHROW( NullPointerException )
+    DECAF_CATCHALL_THROW( NullPointerException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ByteArrayAdapter::ByteArrayAdapter( long long* array, std::size_t capacity, bool own )
+    throw( lang::exceptions::NullPointerException ) {
+
+    try{
+        this->initialize( reinterpret_cast<unsigned char*>( array ), capacity, own );
+    }
+    DECAF_CATCH_RETHROW( NullPointerException )
+    DECAF_CATCHALL_THROW( NullPointerException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ByteArrayAdapter::ByteArrayAdapter( int* array, std::size_t capacity, bool own )
+    throw( lang::exceptions::NullPointerException ) {
+
+    try{
+        this->initialize( reinterpret_cast<unsigned char*>( array ), capacity, own );
+    }
+    DECAF_CATCH_RETHROW( NullPointerException )
+    DECAF_CATCHALL_THROW( NullPointerException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ByteArrayAdapter::ByteArrayAdapter( short* array, std::size_t capacity, bool own )
     throw( lang::exceptions::NullPointerException ) {
 
     try{
+        this->initialize( reinterpret_cast<unsigned char*>( array ), capacity, own );
+    }
+    DECAF_CATCH_RETHROW( NullPointerException )
+    DECAF_CATCHALL_THROW( NullPointerException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ByteArrayAdapter::initialize( unsigned char* array, std::size_t capacity, bool own ) {
+
+    try{
 
         if( array == NULL ) {
             throw NullPointerException(
                 __FILE__, __LINE__,
-                "ByteArray::ByteArray - Passed Buffer is null" );
+                "ByteArrayAdapter::initialize - Passed Buffer is null" );
         }
 
         this->array = array;
         this->capacity = capacity;
         this->own = own;
     }
-    DECAF_CATCH_RETHROW( NullPointerException )
-    DECAF_CATCHALL_THROW( NullPointerException )
+    DECAF_CATCH_RETHROW( Exception )
+    DECAF_CATCHALL_THROW( Exception )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-ByteArray::~ByteArray() {
+ByteArrayAdapter::~ByteArrayAdapter() {
 
     try{
 
@@ -78,7 +153,7 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ByteArray::read( unsigned char* buffer, std::size_t offset, std::size_t length ) const
+void ByteArrayAdapter::read( unsigned char* buffer, std::size_t offset, std::size_t length ) const
     throw( NullPointerException, BufferUnderflowException ) {
 
     try{
@@ -90,13 +165,13 @@
         if( buffer == NULL ) {
             throw NullPointerException(
                 __FILE__, __LINE__,
-                "ByteArray::write - Passed buffer is null" );
+                "ByteArrayAdapter::write - Passed buffer is null" );
         }
 
         if( ( offset + length ) > this->capacity ) {
             throw BufferUnderflowException(
                 __FILE__, __LINE__,
-                "ByteArray::read - Not enough data to fill request." );
+                "ByteArrayAdapter::read - Not enough data to fill request." );
         }
 
         // Read, starting at offset, length number of bytes to Buffer
@@ -109,7 +184,7 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ByteArray::write( unsigned char* buffer, std::size_t offset, std::size_t length )
+void ByteArrayAdapter::write( unsigned char* buffer, std::size_t offset, std::size_t length )
     throw( NullPointerException, BufferOverflowException ) {
 
     try{
@@ -121,13 +196,13 @@
         if( buffer == NULL ) {
             throw NullPointerException(
                 __FILE__, __LINE__,
-                "ByteArray::write - Passed buffer is null" );
+                "ByteArrayAdapter::write - Passed buffer is null" );
         }
 
         if( ( offset + length ) > this->capacity ) {
             throw BufferOverflowException(
                 __FILE__, __LINE__,
-                "ByteArray::read - Not room in array to hold request." );
+                "ByteArrayAdapter::read - Not room in array to hold request." );
         }
 
         // Write, starting at offset, length number of bytes from buffer.
@@ -140,7 +215,7 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ByteArray::resize( std::size_t capacity )
+void ByteArrayAdapter::resize( std::size_t capacity )
     throw ( lang::exceptions::InvalidStateException ) {
 
     try{
@@ -148,7 +223,7 @@
         if( !own ) {
             throw InvalidStateException(
                 __FILE__, __LINE__,
-                "ByteArray::resize - Not the array owner, can't resize" );
+                "ByteArrayAdapter::resize - Not the array owner, can't resize" );
         }
 
         // Save old state
@@ -166,12 +241,12 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ByteArray::clear() {
+void ByteArrayAdapter::clear() {
     memset( this->array, 0, this->capacity );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-unsigned char& ByteArray::operator[]( std::size_t index )
+unsigned char& ByteArrayAdapter::operator[]( std::size_t index )
     throw ( IndexOutOfBoundsException ) {
 
     try{
@@ -179,7 +254,7 @@
         if( index > this->capacity ) {
             throw IndexOutOfBoundsException(
                 __FILE__, __LINE__,
-                "ByteArray::operator[] - Index %d is out of bounds", index );
+                "ByteArrayAdapter::operator[] - Index %d is out of bounds", index );
         }
 
         return this->array[index];
@@ -189,7 +264,7 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-const unsigned char& ByteArray::operator[]( std::size_t index ) const
+const unsigned char& ByteArrayAdapter::operator[]( std::size_t index ) const
     throw ( decaf::lang::exceptions::IndexOutOfBoundsException ) {
 
     try{
@@ -197,11 +272,275 @@
         if( index > this->capacity ) {
             throw IndexOutOfBoundsException(
                 __FILE__, __LINE__,
-                "ByteArray::operator[] - Index %d is out of bounds", index );
+                "ByteArrayAdapter::operator[] - Index %d is out of bounds", index );
         }
 
         return this->array[index];
     }
     DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
+    DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+unsigned char ByteArrayAdapter::get( std::size_t index ) const
+    throw ( lang::exceptions::IndexOutOfBoundsException ) {
+
+    try{
+
+        if( index >= this->getCapacity() ) {
+            throw IndexOutOfBoundsException(
+                __FILE__, __LINE__,
+                "ByteArrayAdapter::get - Not enough data to fill request." );
+        }
+
+        return (*this)[index];
+    }
+    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
+    DECAF_CATCH_EXCEPTION_CONVERT( Exception, IndexOutOfBoundsException )
+    DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+double ByteArrayAdapter::getDouble( std::size_t index ) const
+    throw ( lang::exceptions::IndexOutOfBoundsException ) {
+
+    try{
+
+        unsigned long long lvalue = this->getLong( index );
+        return Double::longBitsToDouble( lvalue );
+    }
+    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
+    DECAF_CATCH_EXCEPTION_CONVERT( Exception, IndexOutOfBoundsException )
+    DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+float ByteArrayAdapter::getFloat( std::size_t index ) const
+    throw ( lang::exceptions::IndexOutOfBoundsException ) {
+
+    try{
+
+        unsigned int ivalue = this->getInt( index );
+        return Float::intBitsToFloat( ivalue );
+    }
+    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
+    DECAF_CATCH_EXCEPTION_CONVERT( Exception, IndexOutOfBoundsException )
+    DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+long long ByteArrayAdapter::getLong( std::size_t index ) const
+    throw ( lang::exceptions::IndexOutOfBoundsException ) {
+
+    try{
+
+        if( ( index + sizeof(long long) ) > this->getCapacity() ) {
+            throw IndexOutOfBoundsException(
+                __FILE__, __LINE__,
+                "ByteArrayAdapter::getLong(i) - Not enough data to fill a long long." );
+        }
+
+        unsigned long long value = 0;
+        unsigned char buffer[sizeof(value)] = {0};
+        this->read( buffer, index + sizeof(value), sizeof(value) );
+
+        // Have to do it this way because on Solaris and Cygwin we get all
+        // kinds of warnings when shifting a byte up into a long long.
+        unsigned long long byte1 = buffer[0] & 0x00000000000000FFULL;
+        unsigned long long byte2 = buffer[1] & 0x00000000000000FFULL;
+        unsigned long long byte3 = buffer[2] & 0x00000000000000FFULL;
+        unsigned long long byte4 = buffer[3] & 0x00000000000000FFULL;
+        unsigned long long byte5 = buffer[4] & 0x00000000000000FFULL;
+        unsigned long long byte6 = buffer[5] & 0x00000000000000FFULL;
+        unsigned long long byte7 = buffer[6] & 0x00000000000000FFULL;
+        unsigned long long byte8 = buffer[7] & 0x00000000000000FFULL;
+
+        value = ( byte1 << 56 | byte2 << 48 | byte3 << 40 | byte4 << 32 |
+                  byte5 << 24 | byte6 << 16 | byte7 << 8  | byte8 << 0 );
+
+        return value;
+    }
+    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
+    DECAF_CATCH_EXCEPTION_CONVERT( Exception, IndexOutOfBoundsException )
+    DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+int ByteArrayAdapter::getInt( std::size_t index ) const
+    throw ( lang::exceptions::IndexOutOfBoundsException ) {
+
+    try{
+
+        if( ( index + sizeof(int) ) > this->getCapacity() ) {
+            throw IndexOutOfBoundsException(
+                __FILE__, __LINE__,
+                "ByteArrayAdapter::getInt(i) - Not enough data to fill an int." );
+        }
+
+        unsigned int value = 0;
+        unsigned char buffer[sizeof(value)] = {0};
+        this->read( buffer, index + sizeof(value), sizeof(value) );
+        value |= (buffer[0] << 24 | buffer[1] << 16 |
+                  buffer[2] << 8 | buffer[3] << 0);
+
+        return value;
+    }
+    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
+    DECAF_CATCH_EXCEPTION_CONVERT( Exception, IndexOutOfBoundsException )
+    DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+short ByteArrayAdapter::getShort( std::size_t index ) const
+    throw ( lang::exceptions::IndexOutOfBoundsException )  {
+
+    try{
+
+        if( ( index + sizeof(short) ) > this->getCapacity() ) {
+            throw IndexOutOfBoundsException(
+                __FILE__, __LINE__,
+                "ByteArrayAdapter::getShort(i) - Not enough data to fill a short." );
+        }
+
+        short value = 0;
+        unsigned char buffer[sizeof(value)] = {0};
+        this->read( buffer, index + sizeof(value), sizeof(value) );
+        value |= (buffer[0] << 8 | buffer[1] << 0);
+
+        return value;
+    }
+    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
+    DECAF_CATCH_EXCEPTION_CONVERT( Exception, IndexOutOfBoundsException )
+    DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ByteArrayAdapter& ByteArrayAdapter::put( std::size_t index, unsigned char value )
+    throw( lang::exceptions::IndexOutOfBoundsException ) {
+
+    try{
+
+        if( index >= this->getCapacity() ) {
+            throw IndexOutOfBoundsException(
+                __FILE__, __LINE__,
+                "ByteArrayAdapter::put(i,i) - Not enough data to fill request." );
+        }
+
+        (*this)[index] = value;
+
+        return *this;
+    }
+    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
+    DECAF_CATCH_EXCEPTION_CONVERT( Exception, IndexOutOfBoundsException )
+    DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ByteArrayAdapter& ByteArrayAdapter::putChar( std::size_t index, char value )
+    throw( lang::exceptions::IndexOutOfBoundsException ) {
+
+    try{
+
+        this->put( index, value );
+        return *this;
+    }
+    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
+    DECAF_CATCH_EXCEPTION_CONVERT( Exception, IndexOutOfBoundsException )
+    DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ByteArrayAdapter& ByteArrayAdapter::putDouble( std::size_t index, double value )
+    throw( lang::exceptions::IndexOutOfBoundsException ) {
+
+    try{
+
+        this->putLong( index, Double::doubleToLongBits( value ) );
+        return *this;
+    }
+    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
+    DECAF_CATCH_EXCEPTION_CONVERT( Exception, IndexOutOfBoundsException )
+    DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ByteArrayAdapter& ByteArrayAdapter::putFloat( std::size_t index, float value )
+    throw( lang::exceptions::IndexOutOfBoundsException ) {
+
+    try{
+
+        this->putInt( index, Float::floatToIntBits( value ) );
+        return *this;
+    }
+    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
+    DECAF_CATCH_EXCEPTION_CONVERT( Exception, IndexOutOfBoundsException )
+    DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ByteArrayAdapter& ByteArrayAdapter::putLong( std::size_t index, long long value )
+    throw( lang::exceptions::IndexOutOfBoundsException ) {
+
+    try{
+
+        unsigned char buffer[sizeof(value)];
+
+        buffer[0] = (unsigned char)((value & 0xFF00000000000000ULL) >> 56);
+        buffer[1] = (unsigned char)((value & 0x00FF000000000000ULL) >> 48);
+        buffer[2] = (unsigned char)((value & 0x0000FF0000000000ULL) >> 40);
+        buffer[3] = (unsigned char)((value & 0x000000FF00000000ULL) >> 32);
+        buffer[4] = (unsigned char)((value & 0x00000000FF000000ULL) >> 24);
+        buffer[5] = (unsigned char)((value & 0x0000000000FF0000ULL) >> 16);
+        buffer[6] = (unsigned char)((value & 0x000000000000FF00ULL) >> 8);
+        buffer[7] = (unsigned char)((value & 0x00000000000000FFULL) >> 0);
+
+        this->write( buffer, index + sizeof(value), sizeof(value) );
+
+        return *this;
+    }
+    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
+    DECAF_CATCH_EXCEPTION_CONVERT( Exception, IndexOutOfBoundsException )
+    DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ByteArrayAdapter& ByteArrayAdapter::putInt( std::size_t index, int value )
+    throw( lang::exceptions::IndexOutOfBoundsException ) {
+
+    try{
+
+        unsigned char buffer[sizeof(value)];
+
+        buffer[0] = (value & 0xFF000000) >> 24;
+        buffer[1] = (value & 0x00FF0000) >> 16;
+        buffer[2] = (value & 0x0000FF00) >> 8;
+        buffer[3] = (value & 0x000000FF) >> 0;
+
+        this->write( buffer, index + sizeof(value), sizeof(value) );
+
+        return *this;
+    }
+    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
+    DECAF_CATCH_EXCEPTION_CONVERT( Exception, IndexOutOfBoundsException )
+    DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ByteArrayAdapter& ByteArrayAdapter::putShort( std::size_t index, short value )
+    throw( lang::exceptions::IndexOutOfBoundsException ) {
+
+    try{
+
+        unsigned char buffer[sizeof(value)];
+
+        buffer[0] = (value & 0xFF00) >> 8;
+        buffer[1] = (value & 0x00FF) >> 0;
+
+        this->write( buffer, index + sizeof(value), sizeof(value) );
+
+        return *this;
+    }
+    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
+    DECAF_CATCH_EXCEPTION_CONVERT( Exception, IndexOutOfBoundsException )
     DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
 }

Copied: activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/util/ByteArrayAdapter.h (from r600926, activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/util/ByteArray.h)
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/util/ByteArrayAdapter.h?p2=activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/util/ByteArrayAdapter.h&p1=activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/util/ByteArray.h&r1=600926&r2=600969&rev=600969&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/util/ByteArray.h (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/util/ByteArrayAdapter.h Tue Dec  4 06:42:43 2007
@@ -15,8 +15,8 @@
  * limitations under the License.
  */
 
-#ifndef _DECAF_INTERNAL_UTIL_BYTEARRAY_H_
-#define _DECAF_INTERNAL_UTIL_BYTEARRAY_H_
+#ifndef _DECAF_INTERNAL_UTIL_BYTEARRAYADAPTER_H_
+#define _DECAF_INTERNAL_UTIL_BYTEARRAYADAPTER_H_
 
 #include <decaf/lang/exceptions/InvalidStateException.h>
 #include <decaf/lang/exceptions/IndexOutOfBoundsException.h>
@@ -29,11 +29,15 @@
 namespace util{
 
     /**
-     * Wrapper around an unsigned char* that allows perspectives to be created
-     * that reference this ByteArray.  The ByteArray will be deleted only when all
-     * referencing perspectives are deleted.
+     * This class adapts primitve type arrays to a base byte array so that the
+     * classes can interoperate on the same base byte array without copying data.
+     * All the array types are mapped down to a byte array and methods are
+     * supplied for accesing the data in any of the primitve type forms.
+     * <p>
+     * Methods in this class that do not return a specifc value return a
+     * reference to this object so that calls can be chained.
      */
-    class ByteArray {
+    class ByteArrayAdapter {
     private:
 
         // Buffer to read and write to, may be shared with other instances.
@@ -53,7 +57,7 @@
          * with all elements initialized to zero.
          * @param capacity - size of the array, this is the limit we read and write to.
          */
-        ByteArray( std::size_t capacity );
+        ByteArrayAdapter( std::size_t capacity );
 
         /**
          * Creates a byte array object that wraps the given array.  If the own flag
@@ -63,10 +67,76 @@
          * @param own - is this class now the owner of the pointer.
          * @throws NullPointerException if buffer is NULL
          */
-        ByteArray( unsigned char* array, std::size_t capacity, bool own = false )
+        ByteArrayAdapter( unsigned char* array, std::size_t capacity, bool own = false )
             throw( lang::exceptions::NullPointerException );
 
-        virtual ~ByteArray();
+        /**
+         * Creates a byte array object that wraps the given array.  If the own flag
+         * is set then it will delete this array when this object is deleted.
+         * @param array - array to wrap
+         * @param capacity - size of the array, this is the limit we read and write to.
+         * @param own - is this class now the owner of the pointer.
+         * @throws NullPointerException if buffer is NULL
+         */
+        ByteArrayAdapter( char* array, std::size_t capacity, bool own = false )
+            throw( lang::exceptions::NullPointerException );
+
+        /**
+         * Creates a byte array object that wraps the given array.  If the own flag
+         * is set then it will delete this array when this object is deleted.
+         * @param array - array to wrap
+         * @param capacity - size of the array, this is the limit we read and write to.
+         * @param own - is this class now the owner of the pointer.
+         * @throws NullPointerException if buffer is NULL
+         */
+        ByteArrayAdapter( double* array, std::size_t capacity, bool own = false )
+            throw( lang::exceptions::NullPointerException );
+
+        /**
+         * Creates a byte array object that wraps the given array.  If the own flag
+         * is set then it will delete this array when this object is deleted.
+         * @param array - array to wrap
+         * @param capacity - size of the array, this is the limit we read and write to.
+         * @param own - is this class now the owner of the pointer.
+         * @throws NullPointerException if buffer is NULL
+         */
+        ByteArrayAdapter( float* array, std::size_t capacity, bool own = false )
+            throw( lang::exceptions::NullPointerException );
+
+        /**
+         * Creates a byte array object that wraps the given array.  If the own flag
+         * is set then it will delete this array when this object is deleted.
+         * @param array - array to wrap
+         * @param capacity - size of the array, this is the limit we read and write to.
+         * @param own - is this class now the owner of the pointer.
+         * @throws NullPointerException if buffer is NULL
+         */
+        ByteArrayAdapter( long long* array, std::size_t capacity, bool own = false )
+            throw( lang::exceptions::NullPointerException );
+
+        /**
+         * Creates a byte array object that wraps the given array.  If the own flag
+         * is set then it will delete this array when this object is deleted.
+         * @param array - array to wrap
+         * @param capacity - size of the array, this is the limit we read and write to.
+         * @param own - is this class now the owner of the pointer.
+         * @throws NullPointerException if buffer is NULL
+         */
+        ByteArrayAdapter( int* array, std::size_t capacity, bool own = false )
+            throw( lang::exceptions::NullPointerException );
+
+        /**
+         * Creates a byte array object that wraps the given array.  If the own flag
+         * is set then it will delete this array when this object is deleted.
+         * @param array - array to wrap
+         * @param capacity - size of the array, this is the limit we read and write to.
+         * @param own - is this class now the owner of the pointer.
+         * @throws NullPointerException if buffer is NULL
+         */
+        ByteArrayAdapter( short* array, std::size_t capacity, bool own = false )
+            throw( lang::exceptions::NullPointerException );
+
+        virtual ~ByteArrayAdapter();
 
         /**
          * Gets the capacity of the underlying array.
@@ -78,7 +148,7 @@
 
         /**
          * Gets the pointer to the array we are wrapping.  Changes to the data in this
-         * array are reflected by all ByteArray objects that point to this array.
+         * array are reflected by all ByteArrayAdapter objects that point to this array.
          * @returns an unsigned char* pointer to the array this object wraps.
          */
         virtual unsigned char* getByteArray() {
@@ -122,7 +192,7 @@
          * current size in which case only the data that will fit into the new array is
          * preserved.
          * <p>
-         * A ByteArray can only be resized when it owns the underlying array, if it does
+         * A ByteArrayAdapter can only be resized when it owns the underlying array, if it does
          * not then it will throw an IllegalStateException.
          * @param capacity - the new capacity of the array.
          * @throws InvalidStateException if this object does not own the buffer.
@@ -136,7 +206,7 @@
         virtual void clear();
 
         /**
-         * Allows the ByteArray to be indexed as a standard array.  calling the
+         * Allows the ByteArrayAdapter to be indexed as a standard array.  calling the
          * non const version allows the user to change the value at index
          * @param index - the position in the array to access
          * @throws IndexOutOfBoundsException
@@ -146,8 +216,168 @@
         const unsigned char& operator[]( std::size_t index ) const
             throw ( decaf::lang::exceptions::IndexOutOfBoundsException );
 
+        /**
+         * Absolute get method. Reads the byte at the given index.
+         * @param index - the index in the Buffer where the byte is to be read
+         * @returns the byte that is located at the given index
+         * @throws IndexOutOfBoundsException - If index is not smaller than the
+         * buffer's limit
+         */
+        virtual unsigned char get( std::size_t index ) const
+            throw ( lang::exceptions::IndexOutOfBoundsException );
+
+        /**
+         * Reads one byte at the given index and returns it
+         * @param index - the index in the Buffer where the byte is to be read
+         * @returns the char at the given index in the buffer
+         * @throws IndexOutOfBoundsException - If index is not smaller than the
+         * buffer's limit
+         */
+        virtual char getChar( std::size_t index ) const
+            throw ( lang::exceptions::IndexOutOfBoundsException ) {
+
+            return (char)this->get( index );
+        }
+
+        /**
+         * Reads eight bytes at the given index and returns it
+         * @param index - the index in the Buffer where the bytes are to be read
+         * @returns the double at the given index in the buffer
+         * @throws IndexOutOfBoundsException - If there are not enough bytes
+         * remaining to fill the requested Data Type
+         */
+        virtual double getDouble( std::size_t index ) const
+            throw ( lang::exceptions::IndexOutOfBoundsException );
+
+        /**
+         * Reads four bytes at the given index and returns it
+         * @param index - the index in the Buffer where the bytes are to be read
+         * @returns the float at the given index in the buffer
+         * @throws IndexOutOfBoundsException - If there are not enough bytes
+         * remaining to fill the requested Data Type
+         */
+        virtual float getFloat( std::size_t index ) const
+            throw ( lang::exceptions::IndexOutOfBoundsException );
+
+        /**
+         * Reads eight bytes at the given index and returns it
+         * @param index - the index in the Buffer where the bytes are to be read
+         * @returns the long long at the given index in the buffer
+         * @throws IndexOutOfBoundsException - If there are not enough bytes
+         * remaining to fill the requested Data Type
+         */
+        virtual long long getLong( std::size_t index ) const
+            throw ( lang::exceptions::IndexOutOfBoundsException );
+
+        /**
+         * Reads four bytes at the given index and returns it
+         * @param index - the index in the Buffer where the bytes are to be read
+         * @returns the int at the given index in the buffer
+         * @throws IndexOutOfBoundsException - If there are not enough bytes
+         * remaining to fill the requested Data Type
+         */
+        virtual int getInt( std::size_t index ) const
+            throw ( lang::exceptions::IndexOutOfBoundsException );
+
+        /**
+         * Reads two bytes at the given index and returns it
+         * @param index - the index in the Buffer where the bytes are to be read
+         * @returns the short at the given index in the buffer
+         * @throws IndexOutOfBoundsException - If there are not enough bytes
+         * remaining to fill the requested Data Type
+         */
+        virtual short getShort( std::size_t index ) const
+            throw ( lang::exceptions::IndexOutOfBoundsException );
+
+        /**
+         * Writes the given byte into this buffer at the given index.
+         * @param index - position in the Buffer to write the data
+         * @param value - the byte to write.
+         * @returns a reference to this buffer
+         * @throw IndexOutOfBoundsException - If index greater than the buffer's limit
+         * minus the size of the type being written.
+         */
+        virtual ByteArrayAdapter& put( std::size_t index, unsigned char value )
+            throw( lang::exceptions::IndexOutOfBoundsException );
+
+        /**
+         * Writes one byte containing the given value, into this buffer at the
+         * given index.
+         * @param index - position in the Buffer to write the data
+         * @param value - the value to write.
+         * @returns a reference to this buffer
+         * @throw IndexOutOfBoundsException - If index greater than the buffer's limit
+         * minus the size of the type being written.
+         */
+        virtual ByteArrayAdapter& putChar( std::size_t index, char value )
+            throw( lang::exceptions::IndexOutOfBoundsException );
+
+        /**
+         * Writes eight bytes containing the given value, into this buffer at the
+         * given index.
+         * @param index - position in the Buffer to write the data
+         * @param value - the value to write.
+         * @returns a reference to this buffer
+         * @throw IndexOutOfBoundsException - If index greater than the buffer's limit
+         * minus the size of the type being written.
+         */
+        virtual ByteArrayAdapter& putDouble( std::size_t index, double value )
+            throw( lang::exceptions::IndexOutOfBoundsException );
+
+        /**
+         * Writes four bytes containing the given value, into this buffer at the
+         * given index.
+         * @param index - position in the Buffer to write the data
+         * @param value - the value to write.
+         * @returns a reference to this buffer
+         * @throw IndexOutOfBoundsException - If index greater than the buffer's limit
+         * minus the size of the type being written.
+         */
+        virtual ByteArrayAdapter& putFloat( std::size_t index, float value )
+            throw( lang::exceptions::IndexOutOfBoundsException );
+
+        /**
+         * Writes eight bytes containing the given value, into this buffer at the
+         * given index.
+         * @param index - position in the Buffer to write the data
+         * @param value - the value to write.
+         * @returns a reference to this buffer
+         * @throw IndexOutOfBoundsException - If index greater than the buffer's limit
+         * minus the size of the type being written.
+         */
+        virtual ByteArrayAdapter& putLong( std::size_t index, long long value )
+            throw( lang::exceptions::IndexOutOfBoundsException );
+
+        /**
+         * Writes four bytes containing the given value, into this buffer at the
+         * given index.
+         * @param index - position in the Buffer to write the data
+         * @param value - the value to write.
+         * @returns a reference to this buffer
+         * @throw IndexOutOfBoundsException - If index greater than the buffer's limit
+         * minus the size of the type being written.
+         */
+        virtual ByteArrayAdapter& putInt( std::size_t index, int value )
+            throw( lang::exceptions::IndexOutOfBoundsException );
+
+        /**
+         * Writes two bytes containing the given value, into this buffer at the
+         * given index.
+         * @param index - position in the Buffer to write the data
+         * @param value - the value to write.
+         * @returns a reference to this buffer
+         * @throw IndexOutOfBoundsException - If index greater than the buffer's limit
+         * minus the size of the type being written.
+         */
+        virtual ByteArrayAdapter& putShort( std::size_t index, short value )
+            throw( lang::exceptions::IndexOutOfBoundsException );
+
+    private:
+
+        void initialize( unsigned char* buffer, std::size_t capacity, bool own );
+
     };
 
 }}}
 
-#endif /*_DECAF_INTERNAL_UTIL_BYTEARRAY_H_*/
+#endif /*_DECAF_INTERNAL_UTIL_BYTEARRAYADAPTER_H_*/

Modified: activemq/activemq-cpp/decaf/trunk/src/test/Makefile.am
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/test/Makefile.am?rev=600969&r1=600968&r2=600969&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/test/Makefile.am (original)
+++ activemq/activemq-cpp/decaf/trunk/src/test/Makefile.am Tue Dec  4 06:42:43 2007
@@ -16,7 +16,7 @@
 # ---------------------------------------------------------------------------
 
 cc_sources = \
-  decaf/internal/util/ByteArrayTest.cpp \
+  decaf/internal/util/ByteArrayAdapterTest.cpp \
   decaf/internal/nio/ByteArrayPerspectiveTest.cpp \
   decaf/internal/nio/ByteArrayBufferTest.cpp \
   decaf/internal/nio/BufferFactoryTest.cpp \
@@ -60,7 +60,7 @@
   main.cpp
 
 h_sources = \
-  decaf/internal/util/ByteArrayTest.h \
+  decaf/internal/util/ByteArrayAdapterTest.h \
   decaf/internal/nio/ByteArrayPerspectiveTest.h \
   decaf/internal/nio/ByteArrayBufferTest.h \
   decaf/internal/nio/BufferFactoryTest.cpp \

Copied: activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/util/ByteArrayAdapterTest.cpp (from r600350, activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/util/ByteArrayTest.cpp)
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/util/ByteArrayAdapterTest.cpp?p2=activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/util/ByteArrayAdapterTest.cpp&p1=activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/util/ByteArrayTest.cpp&r1=600350&r2=600969&rev=600969&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/util/ByteArrayTest.cpp (original)
+++ activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/util/ByteArrayAdapterTest.cpp Tue Dec  4 06:42:43 2007
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-#include "ByteArrayTest.h"
+#include "ByteArrayAdapterTest.h"
 
 using namespace decaf;
 using namespace decaf::internal;
@@ -25,14 +25,14 @@
 using namespace decaf::lang::exceptions;
 
 ////////////////////////////////////////////////////////////////////////////////
-void ByteArrayTest::testRead(){
+void ByteArrayAdapterTest::testRead(){
 
     unsigned char* data = new unsigned char[256];
     for( int i = 0; i < 256; ++i ) {
         data[i] = i;
     }
 
-    ByteArray array( data, 256 );
+    ByteArrayAdapter array( data, 256 );
 
     CPPUNIT_ASSERT( array.getCapacity() == 256 );
 
@@ -48,14 +48,14 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ByteArrayTest::testWrite(){
+void ByteArrayAdapterTest::testWrite(){
 
     unsigned char* data = new unsigned char[256];
     for( int i = 0; i < 256; ++i ) {
         data[i] = i;
     }
 
-    ByteArray array( (std::size_t)256 );
+    ByteArrayAdapter array( (std::size_t)256 );
 
     CPPUNIT_ASSERT( array.getCapacity() == 256 );
 
@@ -72,30 +72,30 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ByteArrayTest::testCtor1(){
+void ByteArrayAdapterTest::testCtor1(){
 
-    ByteArray array1( (std::size_t)256 );
+    ByteArrayAdapter array1( (std::size_t)256 );
     CPPUNIT_ASSERT( array1.getCapacity() == 256 );
-    ByteArray array2( (std::size_t)54 );
+    ByteArrayAdapter array2( (std::size_t)54 );
     CPPUNIT_ASSERT( array2.getCapacity() == 54 );
-    ByteArray array3( (std::size_t)5555 );
+    ByteArrayAdapter array3( (std::size_t)5555 );
     CPPUNIT_ASSERT( array3.getCapacity() == 5555 );
-    ByteArray array4( (std::size_t)0 );
+    ByteArrayAdapter array4( (std::size_t)0 );
     CPPUNIT_ASSERT( array4.getCapacity() == 0 );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ByteArrayTest::testCtor2(){
+void ByteArrayAdapterTest::testCtor2(){
 
     unsigned char* data1 = new unsigned char[256];
     unsigned char* data2 = new unsigned char[999];
     unsigned char* data3 = new unsigned char[12];
     unsigned char* data4 = new unsigned char[0];
 
-    ByteArray array1( data1, 256, true );
-    ByteArray array2( data2, 999, true );
-    ByteArray array3( data3, 10, true );
-    ByteArray array4( data4, 0, true );
+    ByteArrayAdapter array1( data1, 256, true );
+    ByteArrayAdapter array2( data2, 999, true );
+    ByteArrayAdapter array3( data3, 10, true );
+    ByteArrayAdapter array4( data4, 0, true );
 
     CPPUNIT_ASSERT( array1.getCapacity() == 256 );
     CPPUNIT_ASSERT( array2.getCapacity() == 999 );
@@ -104,14 +104,14 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ByteArrayTest::testClear(){
+void ByteArrayAdapterTest::testClear(){
 
     unsigned char* data = new unsigned char[256];
     for( int i = 0; i < 256; ++i ) {
         data[i] = i;
     }
 
-    ByteArray array( (std::size_t)256 );
+    ByteArrayAdapter array( (std::size_t)256 );
 
     CPPUNIT_ASSERT( array.getCapacity() == 256 );
 
@@ -135,14 +135,14 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ByteArrayTest::testReszie(){
+void ByteArrayAdapterTest::testReszie(){
 
     unsigned char* data = new unsigned char[256];
     for( int i = 0; i < 256; ++i ) {
         data[i] = i;
     }
 
-    ByteArray array( (std::size_t)256 );
+    ByteArrayAdapter array( (std::size_t)256 );
 
     CPPUNIT_ASSERT( array.getCapacity() == 256 );
 
@@ -168,14 +168,14 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ByteArrayTest::testOperators(){
+void ByteArrayAdapterTest::testOperators(){
 
     unsigned char* data = new unsigned char[256];
     for( int i = 0; i < 256; ++i ) {
         data[i] = i;
     }
 
-    ByteArray array( data, 256 );
+    ByteArrayAdapter array( data, 256 );
 
     CPPUNIT_ASSERT( array.getCapacity() == 256 );
 
@@ -187,14 +187,14 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ByteArrayTest::testReadExceptions() {
+void ByteArrayAdapterTest::testReadExceptions() {
 
     unsigned char* data = new unsigned char[256];
     for( int i = 0; i < 256; ++i ) {
         data[i] = i;
     }
 
-    ByteArray array( data, 256, true );
+    ByteArrayAdapter array( data, 256, true );
 
     CPPUNIT_ASSERT_THROW_MESSAGE(
         "Should Throw NullPointerException",
@@ -202,7 +202,7 @@
         NullPointerException );
 
     unsigned char result[5000];
-    ByteArray array2( 256 );
+    ByteArrayAdapter array2( 256 );
 
     CPPUNIT_ASSERT_THROW_MESSAGE(
         "Should Throw BufferUnderflowException",
@@ -212,21 +212,21 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ByteArrayTest::testWriteExceptions() {
+void ByteArrayAdapterTest::testWriteExceptions() {
 
     unsigned char* data = new unsigned char[256];
     for( int i = 0; i < 256; ++i ) {
         data[i] = i;
     }
 
-    ByteArray array( data, 256, true );
+    ByteArrayAdapter array( data, 256, true );
     CPPUNIT_ASSERT_THROW_MESSAGE(
         "Should Throw NullPointerException",
         array.write( NULL, 0, 500 ),
         NullPointerException );
 
     unsigned char result[5000];
-    ByteArray array2( 256 );
+    ByteArrayAdapter array2( 256 );
 
     CPPUNIT_ASSERT_THROW_MESSAGE(
         "Should Throw BufferOverflowException",
@@ -235,14 +235,14 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ByteArrayTest::testOperatorsExceptions() {
+void ByteArrayAdapterTest::testOperatorsExceptions() {
 
     unsigned char* data = new unsigned char[256];
     for( int i = 0; i < 256; ++i ) {
         data[i] = i;
     }
 
-    ByteArray array( data, 256, true );
+    ByteArrayAdapter array( data, 256, true );
     CPPUNIT_ASSERT_THROW_MESSAGE(
         "Should Throw IndexOutOfBoundsException",
         array[9999],

Copied: activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/util/ByteArrayAdapterTest.h (from r600350, activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/util/ByteArrayTest.h)
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/util/ByteArrayAdapterTest.h?p2=activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/util/ByteArrayAdapterTest.h&p1=activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/util/ByteArrayTest.h&r1=600350&r2=600969&rev=600969&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/util/ByteArrayTest.h (original)
+++ activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/util/ByteArrayAdapterTest.h Tue Dec  4 06:42:43 2007
@@ -21,16 +21,16 @@
 #include <cppunit/TestFixture.h>
 #include <cppunit/extensions/HelperMacros.h>
 
-#include <decaf/internal/util/ByteArray.h>
+#include <decaf/internal/util/ByteArrayAdapter.h>
 #include <decaf/util/Config.h>
 
 namespace decaf{
 namespace internal{
 namespace util{
 
-    class ByteArrayTest  : public CppUnit::TestFixture {
+    class ByteArrayAdapterTest  : public CppUnit::TestFixture {
 
-        CPPUNIT_TEST_SUITE( ByteArrayTest );
+        CPPUNIT_TEST_SUITE( ByteArrayAdapterTest );
         CPPUNIT_TEST( testRead );
         CPPUNIT_TEST( testReadExceptions );
         CPPUNIT_TEST( testWrite );
@@ -45,8 +45,8 @@
 
     public:
 
-        ByteArrayTest() {}
-        virtual ~ByteArrayTest() {}
+        ByteArrayAdapterTest() {}
+        virtual ~ByteArrayAdapterTest() {}
 
         virtual void testRead();
         virtual void testWrite();

Modified: activemq/activemq-cpp/decaf/trunk/src/test/testRegistry.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/test/testRegistry.cpp?rev=600969&r1=600968&r2=600969&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/test/testRegistry.cpp (original)
+++ activemq/activemq-cpp/decaf/trunk/src/test/testRegistry.cpp Tue Dec  4 06:42:43 2007
@@ -18,8 +18,8 @@
 // All CPP Unit tests are registered in here so we can disable them and
 // enable them easily in one place.
 
-#include <decaf/internal/util/ByteArrayTest.h>
-CPPUNIT_TEST_SUITE_REGISTRATION( decaf::internal::util::ByteArrayTest );
+#include <decaf/internal/util/ByteArrayAdapterTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( decaf::internal::util::ByteArrayAdapterTest );
 #include <decaf/internal/nio/ByteArrayPerspectiveTest.h>
 CPPUNIT_TEST_SUITE_REGISTRATION( decaf::internal::nio::ByteArrayPerspectiveTest );
 #include <decaf/internal/nio/ByteArrayBufferTest.h>



Mime
View raw message