activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r594371 - in /activemq/activemq-cpp/decaf/trunk/src/main: Makefile.am decaf/nio/Buffer.cpp decaf/nio/Buffer.h decaf/nio/InvalidMarkException.h
Date Tue, 13 Nov 2007 00:51:07 GMT
Author: tabish
Date: Mon Nov 12 16:51:06 2007
New Revision: 594371

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

Working on the NIO package

Modified:
    activemq/activemq-cpp/decaf/trunk/src/main/Makefile.am
    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/InvalidMarkException.h

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=594371&r1=594370&r2=594371&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/Makefile.am (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/Makefile.am Mon Nov 12 16:51:06 2007
@@ -65,7 +65,8 @@
    decaf/util/logging/Logger.cpp \
    decaf/util/logging/LogWriter.cpp \
    decaf/util/logging/SimpleLogger.cpp \
-   decaf/util/logging/LogManager.cpp
+   decaf/util/logging/LogManager.cpp \
+   decaf/nio/Buffer.cpp
 
 h_sources = \
    decaf/net/BindException.h \
@@ -179,7 +180,13 @@
    decaf/internal/util/FloatingPointParser.h \
    decaf/internal/util/HexStringParser.h \
    decaf/internal/util/BitOps.h \
-   decaf/internal/util/BigInt.h
+   decaf/internal/util/BigInt.h \
+   decaf/nio/Buffer.h \
+   decaf/nio/ByteBuffer.h \
+   decaf/nio/BufferOverflowException.h \
+   decaf/nio/BufferUnderflowException.h \
+   decaf/nio/InvalidMarkException.h \
+   decaf/nio/ReadOnlyBufferException.h
 
 ##
 ## LibTool build step

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=594371&r1=594370&r2=594371&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 Mon Nov 12 16:51:06 2007
@@ -17,7 +17,7 @@
 
 #include "Buffer.h"
 
-#include <decaf/lang/exception/IllegalArgumentException.h>
+#include <decaf/lang/exceptions/IllegalArgumentException.h>
 
 using namespace decaf;
 using namespace decaf::nio;
@@ -26,7 +26,8 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 Buffer::Buffer( std::size_t capacity ) {
-    this->capacity = this->limit = capacity;
+    this->_capacity = capacity;
+    this->_limit = capacity;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -34,18 +35,18 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-Buffer& Buffer::position( int newPosition )
+Buffer& Buffer::position( std::size_t newPosition )
     throw( lang::exceptions::IllegalArgumentException ) {
 
-    if( newPosition > this->limit ) {
+    if( newPosition > this->_limit ) {
         throw IllegalArgumentException(
             __FILE__, __LINE__,
             "Buffer::position - New Position is greater than set limit" );
     }
 
-    this->position = newPosition;
-    if( this->markSet && ( this->mark > newPosition ) ) {
-        this->mark = 0;
+    this->_position = newPosition;
+    if( this->markSet && ( this->_mark > newPosition ) ) {
+        this->_mark = 0;
         this->markSet = false;
     }
 
@@ -53,21 +54,21 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-virtual Buffer& Buffer::limit( std::size_t newLimit ) throw( IllegalArgumentException
) {
+Buffer& Buffer::limit( std::size_t newLimit ) throw( IllegalArgumentException ) {
 
-    if( newLimit > capacity ) {
+    if( newLimit > this->_capacity ) {
         throw IllegalArgumentException(
             __FILE__, __LINE__,
             "Buffer::limit - new limit is larger than the capacity." );
     }
 
-    this->limit = newLimit;
-    if( this->position > newLimit ) {
-        this->position = newLimit;
+    this->_limit = newLimit;
+    if( this->_position > newLimit ) {
+        this->_position = newLimit;
     }
 
-    if( this->markSet && ( this->mark > newLimit ) ) {
-        this->mark = 0;
+    if( this->markSet && ( this->_mark > newLimit ) ) {
+        this->_mark = 0;
         this->markSet = false;
     }
 
@@ -75,50 +76,53 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-virtual Buffer& Buffer::mark() {
+Buffer& Buffer::mark() {
 
-    this->mark = this->position;
-    this->mark = true;
+    this->_mark = this->_position;
+    this->_mark = true;
 
     return *this;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-virtual Buffer& Buffer::reset() throw ( InvalidMarkException ) {
+Buffer& Buffer::reset() throw ( InvalidMarkException ) {
 
     if( !this->markSet ) {
-        throw new InvalidMarkException(
+        throw InvalidMarkException(
             __FILE__, __LINE__,
             "Buffer::reset - Buffer has not been Marked." );
     }
 
-    this->position = this->mark;
+    this->_position = this->_mark;
 
     return *this;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-virtual Buffer& Buffer::clear() {
+Buffer& Buffer::clear() {
 
-    this->position = 0;
-    this->mark = 0;
+    this->_position = 0;
+    this->_mark = 0;
     this->markSet = false;
-    this->limit = this->capacity;
+    this->_limit = this->_capacity;
     return *this;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-virtual Buffer& Buffer::flip() {
+Buffer& Buffer::flip() {
 
-    this->limit = this->position;
-    this->position = 0;
-    this->mark = 0;
+    this->_limit = this->_position;
+    this->_position = 0;
+    this->_mark = 0;
     this->markSet = false;
     return *this;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-virtual Buffer& Buffer::rewind() {
+Buffer& Buffer::rewind() {
 
+    this->_position = 0;
+    this->_mark = 0;
+    this->markSet = false;
     return *this;
 }

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=594371&r1=594370&r2=594371&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 Mon Nov 12 16:51:06 2007
@@ -19,6 +19,7 @@
 #define _DECAF_NIO_BUFFER_H_
 
 #include <decaf/lang/exceptions/IllegalArgumentException.h>
+#include <decaf/nio/InvalidMarkException.h>
 
 namespace decaf{
 namespace nio{
@@ -124,10 +125,10 @@
     class DECAF_API Buffer {
     private:
 
-        std::size_t capacity;
-        std::size_t position;
-        std::size_t limit;
-        std::size_t mark;
+        std::size_t _capacity;
+        std::size_t _position;
+        std::size_t _limit;
+        std::size_t _mark;
         bool markSet;
 
     public:
@@ -141,14 +142,14 @@
          * @returns this buffer's capacity.
          */
         virtual int capacity() const {
-            return this->capacity;
+            return this->_capacity;
         }
 
         /**
          * @returns the current position in the buffer
          */
-        virtual int postion() const {
-            return this->position;
+        virtual std::size_t postion() const {
+            return this->_position;
         }
 
         /**
@@ -158,14 +159,14 @@
          * @returns A reference to This buffer
          * @throws IllegalArgumentException if preconditions on the new pos don't hold.
          */
-        virtual Buffer& position( int newPosition )
+        virtual Buffer& position( std::size_t newPosition )
             throw( lang::exceptions::IllegalArgumentException );
 
         /**
          * @returns this buffers Limit
          */
-        virtual int limit() const {
-            return this->limit;
+        virtual std::size_t limit() const {
+            return this->_limit;
         }
 
         /**
@@ -177,7 +178,7 @@
          * @returns A reference to This buffer
          * @throws IllegalArgumentException if preconditions on the new pos don't hold.
          */
-        virtual Buffer& limit( int newLimit )
+        virtual Buffer& limit( std::size_t newLimit )
             throw( lang::exceptions::IllegalArgumentException );
 
         /**
@@ -191,7 +192,7 @@
          * @returns a reference to this buffer.
          * @throws InvalidMarkException - If the mark has not been set
          */
-        virtual Buffer& reset() throw ( InvalidMarkException );
+        virtual Buffer& reset() throw( InvalidMarkException );
 
         /**
          * Clears this buffer. The position is set to zero, the limit is set to the
@@ -248,7 +249,7 @@
          * @returns The number of elements remaining in this buffer
          */
         virtual int remaining() const {
-            return limit - position;
+            return _limit - _position;
         }
 
         /**

Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/InvalidMarkException.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/InvalidMarkException.h?rev=594371&r1=594370&r2=594371&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/InvalidMarkException.h (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/InvalidMarkException.h Mon Nov 12
16:51:06 2007
@@ -58,8 +58,8 @@
          * @param message to report
          * @param list of primitives that are formatted into the message
          */
-        BindException( const char* file, const int lineNumber,
-                            const char* msg, ... ) throw ()
+        InvalidMarkException( const char* file, const int lineNumber,
+                              const char* msg, ... ) throw ()
         : lang::exceptions::IllegalStateException() {
 
             va_list vargs ;



Mime
View raw message