[prev in list] [next in list] [prev in thread] [next in thread] 

List:       activemq-commits
Subject:    svn commit: r599158 - in
From:       tabish () apache ! org
Date:       2007-11-28 21:49:19
Message-ID: 20071128214919.AB88F1A9832 () eris ! apache ! org
[Download RAW message or body]

Author: tabish
Date: Wed Nov 28 13:49:18 2007
New Revision: 599158

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

Working on the NIO package

Modified:
    activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/Buffer.cpp
    activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/Buffer.h
    activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/ByteBuffer.cpp
    activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/ByteBuffer.h

Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/Buffer.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/Buffer.cpp?rev=599158&r1=599157&r2=599158&view=diff
 ==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/Buffer.cpp (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/Buffer.cpp Wed Nov 28 \
13:49:18 2007 @@ -26,6 +26,7 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 Buffer::Buffer( std::size_t capacity ) {
+    this->_capacity = capacity;
     this->_limit = capacity;
     this->_position = 0;
     this->_mark = 0;
@@ -35,6 +36,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 Buffer::Buffer( const Buffer& other ) {
 
+    this->_capacity = other._capacity;
     this->_limit = other._limit;
     this->_position = other._position;
     this->_mark = other._mark;

Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/Buffer.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/Buffer.h?rev=599158&r1=599157&r2=599158&view=diff
 ==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/Buffer.h (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/Buffer.h Wed Nov 28 13:49:18 \
2007 @@ -126,6 +126,7 @@
     protected:
 
         mutable std::size_t _position;
+        std::size_t _capacity;
         std::size_t _limit;
         std::size_t _mark;
         bool _markSet;
@@ -141,7 +142,9 @@
         /**
          * @returns this buffer's capacity.
          */
-        virtual std::size_t capacity() const = 0;
+        virtual std::size_t capacity() const {
+            return this->_capacity;
+        }
 
         /**
          * @returns the current position in the buffer

Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/ByteBuffer.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/ByteBuffer.cpp?rev=599158&r1=599157&r2=599158&view=diff
 ==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/ByteBuffer.cpp (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/ByteBuffer.cpp Wed Nov 28 \
13:49:18 2007 @@ -56,9 +56,10 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-ByteBuffer::ByteBuffer( ByteArrayPerspective& array, std::size_t offset, bool \
readOnly ) +ByteBuffer::ByteBuffer( ByteArrayPerspective& array, std::size_t offset,
+                        std::size_t length, bool readOnly )
     throw( decaf::lang::exceptions::IndexOutOfBoundsException )
- :  Buffer( array.getCapacity() - offset ) {
+ :  Buffer( length ) {
 
     try{
         if( offset > array.getCapacity() ) {
@@ -512,7 +513,7 @@
 
     try{
 
-        if( (offset + index) >= this->limit() ) {
+        if( index >= this->limit() ) {
             throw IndexOutOfBoundsException(
                 __FILE__, __LINE__,
                 "ByteBuffer::get - Not enough data to fill request." );
@@ -733,13 +734,13 @@
         if( this->isReadOnly() ) {
             throw ReadOnlyBufferException(
                 __FILE__, __LINE__,
-                "ByteBuffer::put() - Buffer is Read Only." );
+                "ByteBuffer::put(i,i) - Buffer is Read Only." );
         }
 
-        if( (offset + index) >= this->limit() ) {
+        if( index >= this->limit() ) {
             throw IndexOutOfBoundsException(
                 __FILE__, __LINE__,
-                "ByteBuffer::get - Not enough data to fill request." );
+                "ByteBuffer::put(i,i) - Not enough data to fill request." );
         }
 
         (*(this->_array))[this->offset + index] = value;
@@ -991,8 +992,10 @@
 ByteBuffer* ByteBuffer::slice() const {
 
     try{
+
         return new ByteBuffer( *(this->_array),
                                this->offset + this->position(),
+                               this->remaining(),
                                this->isReadOnly() );
     }
     DECAF_CATCH_RETHROW( Exception )

Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/ByteBuffer.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/ByteBuffer.h?rev=599158&r1=599157&r2=599158&view=diff
 ==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/ByteBuffer.h (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/ByteBuffer.h Wed Nov 28 \
13:49:18 2007 @@ -139,12 +139,14 @@
          * will be that of the remaining capacity of the passed buffer.
          * @param array - the ByteArrayPerspective to wrap
          * @param offset - the offset into array where the buffer starts
+         * @param length - the length of the array we are wrapping or limit.
          * @param readOnly - is this a readOnly buffer.
          * @throws NullPointerException if buffer is NULL
          * @throws IndexOutOfBoundsException if offset is greater than array \
                capacity.
          */
         ByteBuffer( internal::nio::ByteArrayPerspective& array,
-                    std::size_t offset, bool readOnly = false )
+                    std::size_t offset, std::size_t length,
+                    bool readOnly = false )
             throw( decaf::lang::exceptions::IndexOutOfBoundsException );
 
         /**
@@ -164,13 +166,6 @@
         virtual std::string toString() const;
 
     public:
-
-        /**
-         * @returns this buffer's capacity.
-         */
-        virtual std::size_t capacity() const {
-            return this->_array->getCapacity() - this->offset;
-        }
 
         /**
          * Tells whether or not this buffer is read-only.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic