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 2007/11/30 16:40:52 UTC

svn commit: r599851 - /activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/CharBuffer.h

Author: tabish
Date: Fri Nov 30 07:40:48 2007
New Revision: 599851

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

Starting the NIO implementation; CharBuffer

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

Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/CharBuffer.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/CharBuffer.h?rev=599851&r1=599850&r2=599851&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/CharBuffer.h (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/CharBuffer.h Fri Nov 30 07:40:48 2007
@@ -129,9 +129,9 @@
          * @throws ReadOnlyBufferException if this Buffer is read only.
          * @throws UnsupportedOperationException if the underlying store has no array.
          */
-        char* array()
+        virtual char* array()
             throw( decaf::lang::exceptions::UnsupportedOperationException,
-                   ReadOnlyBufferException );
+                   ReadOnlyBufferException ) = 0;
 
         /**
          * Returns the offset within this buffer's backing array of the first element of
@@ -143,9 +143,9 @@
          * @throws ReadOnlyBufferException if this Buffer is read only.
          * @throws UnsupportedOperationException if the underlying store has no array.
          */
-        std::size_t arrayOffset()
+        virtual std::size_t arrayOffset()
             throw( decaf::lang::exceptions::UnsupportedOperationException,
-                   ReadOnlyBufferException );
+                   ReadOnlyBufferException ) = 0;
 
         /**
          * Creates a new, read-only char buffer that shares this buffer's content.
@@ -163,7 +163,7 @@
          * identical to those of this buffer.
          * @return The new, read-only char buffer which the caller then owns.
          */
-        virtual CharBuffer* asReadOnlyBuffer() const;
+        virtual CharBuffer* asReadOnlyBuffer() const = 0
 
         /**
          * Reads the character at the given index relative to the current position.
@@ -172,7 +172,7 @@
          * @returns The character at index position() + index
          * @throws IndexOutOfBoundsException
          */
-        virtual char charAt( std::size_t index )
+        char charAt( std::size_t index )
             throw( decaf::lang::exceptions::IndexOutOfBoundsException );
 
         /**
@@ -191,7 +191,7 @@
          * @returns a reference to this CharBuffer
          * @throws ReadOnlyBufferException - If this buffer is read-only
          */
-        virtual CharBuffer& compact() throw( ReadOnlyBufferException );
+        virtual CharBuffer& compact() throw( ReadOnlyBufferException ) = 0;
 
         /**
          * Creates a new char buffer that shares this buffer's content.
@@ -205,7 +205,7 @@
          * this buffer is read-only.
          * @returns a new char Buffer which the caller owns.
          */
-        virtual CharBuffer* duplicate();
+        virtual CharBuffer* duplicate() = 0;
 
         /**
          * Relative get method. Reads the character at this buffer's current position,
@@ -213,7 +213,7 @@
          * @returns the char at the current position
          * @throws BufferUnderflowException if there no more data to return
          */
-        char get() throw ( BufferUnderflowException );
+        virtual char get() throw ( BufferUnderflowException ) = 0;
 
         /**
          * Absolute get method. Reads the char at the given index.
@@ -223,7 +223,7 @@
          * buffer's limit
          */
         virtual char get( std::size_t index ) const
-            throw ( lang::exceptions::IndexOutOfBoundsException );
+            throw ( lang::exceptions::IndexOutOfBoundsException ) = 0;
 
         /**
          * Relative bulk get method.
@@ -237,7 +237,7 @@
          * @throws BufferUnderflowException - If there are fewer than length chars
          * remaining in this buffer
          */
-        virtual CharBuffer& get( std::vector<char> buffer )
+        CharBuffer& get( std::vector<char> buffer )
             throw ( BufferUnderflowException );
 
         /**
@@ -260,9 +260,7 @@
          * remaining in this buffer
          * @throws NullPointerException if the passed buffer is null.
          */
-        virtual CharBuffer& get( char* buffer,
-                                 std::size_t offset,
-                                 std::size_t length )
+        CharBuffer& get( char* buffer, std::size_t offset, std::size_t length )
             throw( BufferUnderflowException,
                    lang::exceptions::NullPointerException );
 
@@ -274,13 +272,15 @@
          * @returns true if, and only if, this buffer is backed by an array and is not
          * read-only
          */
-        virtual bool hasArray() const { return true; }
+        virtual bool hasArray() const = 0;
 
         /**
          * Returns the length of this character buffer.
          * @returns the length of this buffer from the position to the limit.
          */
-        int length();
+        int length() {
+            return this->remaining();
+        }
 
         /**
          * This method transfers the chars remaining in the given source buffer into
@@ -298,7 +298,7 @@
          * @throws IllegalArgumentException - If the source buffer is this buffer
          * @throws ReadOnlyBufferException - If this buffer is read-only
          */
-        virtual CharBuffer& put( CharBuffer& src )
+        CharBuffer& put( CharBuffer& src )
             throw( BufferOverflowException, ReadOnlyBufferException,
                    lang::exceptions::IllegalArgumentException );
 
@@ -319,9 +319,7 @@
          * @throws ReadOnlyBufferException - If this buffer is read-only
          * @throws NullPointerException if the passed buffer is null.
          */
-        virtual CharBuffer& put( const char* buffer,
-                                 std::size_t offset,
-                                 std::size_t length )
+        CharBuffer& put( const char* buffer, std::size_t offset, std::size_t length )
             throw( BufferOverflowException, ReadOnlyBufferException,
                    lang::exceptions::NullPointerException );
 
@@ -333,7 +331,7 @@
          * @throws BufferOverflowException - If there is insufficient space in this buffer
          * @throws ReadOnlyBufferException - If this buffer is read-only
          */
-        virtual CharBuffer& put( std::vector<char>& buffer )
+        CharBuffer& put( std::vector<char>& buffer )
             throw( BufferOverflowException, ReadOnlyBufferException );
 
         /**
@@ -346,7 +344,7 @@
          * @throws ReadOnlyBufferException - If this buffer is read-only
          */
         virtual CharBuffer& put( char value )
-            throw( BufferOverflowException, ReadOnlyBufferException );
+            throw( BufferOverflowException, ReadOnlyBufferException ) = 0;
 
         /**
          * Writes the given char into this buffer at the given index.
@@ -359,7 +357,7 @@
          */
         virtual CharBuffer& put( std::size_t index, char value )
             throw( lang::exceptions::IndexOutOfBoundsException,
-                   ReadOnlyBufferException );
+                   ReadOnlyBufferException ) = 0;
 
         /**
          * Relative bulk put method  (optional operation).
@@ -382,8 +380,7 @@
          * minus the size of the type being written.
          * @throws ReadOnlyBufferException - If this buffer is read-only
          */
-        virtual CharBuffer& put( const std::string& src,
-                                 std::size_t start, std::size_t end )
+        CharBuffer& put( const std::string& src, std::size_t start, std::size_t end )
             throw( BufferOverflowException, ReadOnlyBufferException,
                    decaf::lang::exceptions::IndexOutOfBoundsException );
 
@@ -398,7 +395,7 @@
          * @throws BufferOverflowException - If this buffer's current position is not
          * @throws ReadOnlyBufferException - If this buffer is read-only
          */
-        virtual CharBuffer& put( const std::string src )
+        CharBuffer& put( const std::string src )
             throw( BufferOverflowException, ReadOnlyBufferException );
 
         /**
@@ -412,7 +409,7 @@
          * @throws NullPointerException - If target is Null
          * @throws ReadOnlyBufferException - If this buffer is read-only
          */
-        std::size_t read( CharBuffer* target )
+        virtual std::size_t read( CharBuffer* target )
             throw ( decaf::lang::exceptions::NullPointerException,
                     decaf::io::IOException, ReadOnlyBufferException );
 
@@ -434,8 +431,8 @@
          * @return The new character buffer, caller owns
          * @throws IndexOutOfBoundsException - If the preconditions on start and end fail
          */
-        CharSequence* subSequence( std::size_t start, std::size_t end )
-            throw ( decaf::lang::exceptions::IndexOutOfBoundsException );
+        virtual CharSequence* subSequence( std::size_t start, std::size_t end )
+            throw ( decaf::lang::exceptions::IndexOutOfBoundsException ) = 0;
 
         /**
          * Creates a new CharBuffer whose content is a shared subsequence of this
@@ -449,7 +446,7 @@
          * new buffer will be read-only if, and only if, this buffer is read-only.
          * @returns the newly create CharBuffer which the caller owns.
          */
-        virtual CharBuffer* slice() const;
+        virtual CharBuffer* slice() const = 0;
 
     public:  // Comparable