activemq-cpp-3.6.0
decaf::internal::nio::DoubleArrayBuffer Class Reference

#include <src/main/decaf/internal/nio/DoubleArrayBuffer.h>

Inheritance diagram for decaf::internal::nio::DoubleArrayBuffer:

Public Member Functions

 DoubleArrayBuffer (int capacity, bool readOnly=false)
 Creates a DoubleArrayBuffer object that has its backing array allocated internally and is then owned and deleted when this object is deleted.
 DoubleArrayBuffer (double *array, int size, int offset, int length, bool readOnly=false)
 Creates a DoubleArrayBuffer object that wraps the given array.
 DoubleArrayBuffer (const decaf::lang::Pointer< ByteArrayAdapter > &array, int offset, int length, bool readOnly=false)
 Creates a byte buffer that wraps the passed ByteArrayAdapter and start at the given offset.
 DoubleArrayBuffer (const DoubleArrayBuffer &other)
 Create a DoubleArrayBuffer that mirrors this one, meaning it shares a reference to this buffers ByteArrayAdapter and when changes are made to that data it is reflected in both.
virtual ~DoubleArrayBuffer ()
virtual double * array ()
 Returns the double array that backs this buffer (optional operation).Modifications to this buffer's content will cause the returned array's content to be modified, and vice versa.Invoke the hasArray method before invoking this method in order to ensure that this buffer has an accessible backing array.
Returns
the array that backs this Buffer.
Exceptions
ReadOnlyBufferExceptionif this Buffer is read only.
UnsupportedOperationExceptionif the underlying store has no array.

virtual int arrayOffset ()
 Returns the offset within this buffer's backing array of the first element of the buffer (optional operation).Invoke the hasArray method before invoking this method in order to ensure that this buffer has an accessible backing array.
Returns
The offset into the backing array where index zero starts.
Exceptions
ReadOnlyBufferExceptionif this Buffer is read only.
UnsupportedOperationExceptionif the underlying store has no array.

virtual DoubleBufferasReadOnlyBuffer () const
 Creates a new, read-only double buffer that shares this buffer's content.The content of the new buffer will be that of this buffer. Changes to this buffer's content will be visible in the new buffer; the new buffer itself, however, will be read-only and will not allow the shared content to be modified. The two buffers' position, limit, and mark values will be independent.If this buffer is itself read-only then this method behaves in exactly the same way as the duplicate method.The new buffer's capacity, limit, position, and mark values will be identical to those of this buffer.
Returns
The new, read-only double buffer which the caller then owns.

virtual DoubleBuffercompact ()
 Compacts this buffer.The bytes between the buffer's current position and its limit, if any, are copied to the beginning of the buffer. That is, the byte at index p = position() is copied to index zero, the byte at index p + 1 is copied to index one, and so forth until the byte at index limit() - 1 is copied to index n = limit() - 1 - p. The buffer's position is then set to n+1 and its limit is set to its capacity. The mark, if defined, is discarded.The buffer's position is set to the number of bytes copied, rather than to zero, so that an invocation of this method can be followed immediately by an invocation of another relative put method.
Returns
a reference to this DoubleBuffer.
Exceptions
ReadOnlyBufferExceptionif this buffer is read-only.

virtual DoubleBufferduplicate ()
 Creates a new double buffer that shares this buffer's content.The content of the new buffer will be that of this buffer. Changes to this buffer's content will be visible in the new buffer, and vice versa; the two buffers' position, limit, and mark values will be independent.The new buffer's capacity, limit, position, and mark values will be identical to those of this buffer. The new buffer will be read-only if, and only if, this buffer is read-only.
Returns
a new double Buffer which the caller owns.

virtual double get ()
 Relative get method.Reads the value at this buffer's current position, and then increments the position.
Returns
the double at the current position.
Exceptions
BufferUnderflowExceptionif there no more data to return.

virtual double get (int index) const
 Absolute get method.Reads the value at the given index.
Parameters
indexThe index in the Buffer where the double is to be read.
Returns
the double that is located at the given index.
Exceptions
IndexOutOfBoundsExceptionif index is not smaller than the buffer's limit

virtual bool hasArray () const
 Tells whether or not this buffer is backed by an accessible double array.If this method returns true then the array and arrayOffset methods may safely be invoked. Subclasses should override this method if they do not have a backing array as this class always returns true.
Returns
true if, and only if, this buffer is backed by an array and is not read-only

virtual bool isReadOnly () const
 Tells whether or not this buffer is read-only.
Returns
true if, and only if, this buffer is read-only.

virtual DoubleBufferput (double value)
 Writes the given doubles into this buffer at the current position, and then increments the position.
Parameters
valueThe doubles value to be written.
Returns
a reference to this buffer.
Exceptions
BufferOverflowExceptionif this buffer's current position is not smaller than its limit.
ReadOnlyBufferExceptionif this buffer is read-only.

virtual DoubleBufferput (int index, double value)
 Writes the given doubles into this buffer at the given index.
Parameters
indexThe position in the Buffer to write the data.
valueThe doubles to write.
Returns
a reference to this buffer
Exceptions
IndexOutOfBoundsExceptionif index greater than the buffer's limit minus the size of the type being written, or the index is negative.
ReadOnlyBufferExceptionif this buffer is read-only.

virtual DoubleBufferslice () const
 Creates a new DoubleBuffer whose content is a shared subsequence of this buffer's content.The content of the new buffer will start at this buffer's current position. Changes to this buffer's content will be visible in the new buffer, and vice versa; the two buffers' position, limit, and mark values will be independent.The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer, and its mark will be undefined. The new buffer will be read-only if, and only if, this buffer is read-only.
Returns
the newly create DoubleBuffer which the caller owns.

- Public Member Functions inherited from decaf::nio::DoubleBuffer
virtual ~DoubleBuffer ()
virtual std::string toString () const
DoubleBufferget (std::vector< double > buffer)
 Relative bulk get method.
DoubleBufferget (double *buffer, int size, int offset, int length)
 Relative bulk get method.
DoubleBufferput (DoubleBuffer &src)
 This method transfers the doubles remaining in the given source buffer into this buffer.
DoubleBufferput (const double *buffer, int size, int offset, int length)
 This method transfers doubles into this buffer from the given source array.
DoubleBufferput (std::vector< double > &buffer)
 This method transfers the entire content of the given source doubles array into this buffer.
virtual int compareTo (const DoubleBuffer &value) const
 
virtual bool equals (const DoubleBuffer &value) const
 
virtual bool operator== (const DoubleBuffer &value) const
 
virtual bool operator< (const DoubleBuffer &value) const
 
- Public Member Functions inherited from decaf::nio::Buffer
 Buffer (int capactiy)
 Buffer (const Buffer &other)
virtual ~Buffer ()
virtual int capacity () const
virtual int position () const
virtual Bufferposition (int newPosition)
 Sets this buffer's position.
virtual int limit () const
virtual Bufferlimit (int newLimit)
 Sets this buffer's limit.
virtual Buffermark ()
 Sets this buffer's mark at its position.
virtual Bufferreset ()
 Resets this buffer's position to the previously-marked position.
virtual Bufferclear ()
 Clears this buffer.
virtual Bufferflip ()
 Flips this buffer.
virtual Bufferrewind ()
 Rewinds this buffer.
virtual int remaining () const
 Returns the number of elements between the current position and the limit.
virtual bool hasRemaining () const
 Tells whether there are any elements between the current position and the limit.
- Public Member Functions inherited from decaf::lang::Comparable< DoubleBuffer >
virtual ~Comparable ()
virtual int compareTo (const DoubleBuffer &value) const =0
 Compares this object with the specified object for order.
virtual bool equals (const DoubleBuffer &value) const =0
virtual bool operator== (const DoubleBuffer &value) const =0
 Compares equality between this object and the one passed.
virtual bool operator< (const DoubleBuffer &value) const =0
 Compares this object to another and returns true if this object is considered to be less than the one passed.

Protected Member Functions

virtual void setReadOnly (bool value)
 Sets this DoubleArrayBuffer as Read-Only or not Read-Only.
- Protected Member Functions inherited from decaf::nio::DoubleBuffer
 DoubleBuffer (int capacity)
 Creates a DoubleBuffer object that has its backing array allocated internally and is then owned and deleted when this object is deleted.

Additional Inherited Members

- Static Public Member Functions inherited from decaf::nio::DoubleBuffer
static DoubleBufferallocate (int capacity)
 Allocates a new DoubleBuffer.
static DoubleBufferwrap (double *array, int size, int offset, int length)
 Wraps the passed buffer with a new DoubleBuffer.
static DoubleBufferwrap (std::vector< double > &buffer)
 Wraps the passed STL double Vector in a DoubleBuffer.
- Protected Attributes inherited from decaf::nio::Buffer
int _position
int _capacity
int _limit
int _mark
bool _markSet

Constructor & Destructor Documentation

decaf::internal::nio::DoubleArrayBuffer::DoubleArrayBuffer ( int  capacity,
bool  readOnly = false 
)

Creates a DoubleArrayBuffer object that has its backing array allocated internally and is then owned and deleted when this object is deleted.

The array is initially created with all elements initialized to zero.

Parameters
sizeThe size of the array, this is the limit we read and write to.
readOnlyBoolean indicating if this buffer should be read-only, default as false.
Exceptions
IllegalArguementExceptionif the capacity value is negative.
decaf::internal::nio::DoubleArrayBuffer::DoubleArrayBuffer ( double *  array,
int  size,
int  offset,
int  length,
bool  readOnly = false 
)

Creates a DoubleArrayBuffer object that wraps the given array.

If the own flag is set then it will delete this array when this object is deleted.

Parameters
arrayThe actual array to wrap.
sizeThe size of the given array.
offsetThe position that is this buffers start position.
lengthThe limit of how many bytes into the array this Buffer can write.
readOnlyBoolean indicating if this buffer should be read-only, default as false.
Exceptions
NullPointerExceptionif buffer is NULL
IndexOutOfBoundsExceptionif offset is greater than array capacity.
decaf::internal::nio::DoubleArrayBuffer::DoubleArrayBuffer ( const decaf::lang::Pointer< ByteArrayAdapter > &  array,
int  offset,
int  length,
bool  readOnly = false 
)

Creates a byte buffer that wraps the passed ByteArrayAdapter and start at the given offset.

The capacity and limit of the new DoubleArrayBuffer will be that of the remaining capacity of the passed buffer.

Parameters
arrayThe ByteArrayAdapter to wrap.
offsetThe position that is this buffers start position.
lengthThe limit of how many bytes into the array this Buffer can write.
readOnlyBoolean indicating if this buffer should be read-only, default as false.
Exceptions
NullPointerExceptionif array is NULL
IndexOutOfBoundsExceptionif offset + length is greater than array size.
decaf::internal::nio::DoubleArrayBuffer::DoubleArrayBuffer ( const DoubleArrayBuffer other)

Create a DoubleArrayBuffer that mirrors this one, meaning it shares a reference to this buffers ByteArrayAdapter and when changes are made to that data it is reflected in both.

Parameters
otherThe DoubleArrayBuffer this one is to mirror.
virtual decaf::internal::nio::DoubleArrayBuffer::~DoubleArrayBuffer ( )
virtual

Member Function Documentation

virtual double* decaf::internal::nio::DoubleArrayBuffer::array ( )
virtual

Returns the double array that backs this buffer (optional operation).Modifications to this buffer's content will cause the returned array's content to be modified, and vice versa.Invoke the hasArray method before invoking this method in order to ensure that this buffer has an accessible backing array.

Returns
the array that backs this Buffer.
Exceptions
ReadOnlyBufferExceptionif this Buffer is read only.
UnsupportedOperationExceptionif the underlying store has no array.

Implements decaf::nio::DoubleBuffer.

virtual int decaf::internal::nio::DoubleArrayBuffer::arrayOffset ( )
virtual

Returns the offset within this buffer's backing array of the first element of the buffer (optional operation).Invoke the hasArray method before invoking this method in order to ensure that this buffer has an accessible backing array.

Returns
The offset into the backing array where index zero starts.
Exceptions
ReadOnlyBufferExceptionif this Buffer is read only.
UnsupportedOperationExceptionif the underlying store has no array.

Implements decaf::nio::DoubleBuffer.

virtual DoubleBuffer* decaf::internal::nio::DoubleArrayBuffer::asReadOnlyBuffer ( ) const
virtual

Creates a new, read-only double buffer that shares this buffer's content.The content of the new buffer will be that of this buffer. Changes to this buffer's content will be visible in the new buffer; the new buffer itself, however, will be read-only and will not allow the shared content to be modified. The two buffers' position, limit, and mark values will be independent.If this buffer is itself read-only then this method behaves in exactly the same way as the duplicate method.The new buffer's capacity, limit, position, and mark values will be identical to those of this buffer.

Returns
The new, read-only double buffer which the caller then owns.

Implements decaf::nio::DoubleBuffer.

virtual DoubleBuffer& decaf::internal::nio::DoubleArrayBuffer::compact ( )
virtual

Compacts this buffer.The bytes between the buffer's current position and its limit, if any, are copied to the beginning of the buffer. That is, the byte at index p = position() is copied to index zero, the byte at index p + 1 is copied to index one, and so forth until the byte at index limit() - 1 is copied to index n = limit() - 1 - p. The buffer's position is then set to n+1 and its limit is set to its capacity. The mark, if defined, is discarded.The buffer's position is set to the number of bytes copied, rather than to zero, so that an invocation of this method can be followed immediately by an invocation of another relative put method.

Returns
a reference to this DoubleBuffer.
Exceptions
ReadOnlyBufferExceptionif this buffer is read-only.

Implements decaf::nio::DoubleBuffer.

virtual DoubleBuffer* decaf::internal::nio::DoubleArrayBuffer::duplicate ( )
virtual

Creates a new double buffer that shares this buffer's content.The content of the new buffer will be that of this buffer. Changes to this buffer's content will be visible in the new buffer, and vice versa; the two buffers' position, limit, and mark values will be independent.The new buffer's capacity, limit, position, and mark values will be identical to those of this buffer. The new buffer will be read-only if, and only if, this buffer is read-only.

Returns
a new double Buffer which the caller owns.

Implements decaf::nio::DoubleBuffer.

virtual double decaf::internal::nio::DoubleArrayBuffer::get ( )
virtual

Relative get method.Reads the value at this buffer's current position, and then increments the position.

Returns
the double at the current position.
Exceptions
BufferUnderflowExceptionif there no more data to return.

Implements decaf::nio::DoubleBuffer.

virtual double decaf::internal::nio::DoubleArrayBuffer::get ( int  index) const
virtual

Absolute get method.Reads the value at the given index.

Parameters
indexThe index in the Buffer where the double is to be read.
Returns
the double that is located at the given index.
Exceptions
IndexOutOfBoundsExceptionif index is not smaller than the buffer's limit

Implements decaf::nio::DoubleBuffer.

virtual bool decaf::internal::nio::DoubleArrayBuffer::hasArray ( ) const
inlinevirtual

Tells whether or not this buffer is backed by an accessible double array.If this method returns true then the array and arrayOffset methods may safely be invoked. Subclasses should override this method if they do not have a backing array as this class always returns true.

Returns
true if, and only if, this buffer is backed by an array and is not read-only

Implements decaf::nio::DoubleBuffer.

virtual bool decaf::internal::nio::DoubleArrayBuffer::isReadOnly ( ) const
inlinevirtual

Tells whether or not this buffer is read-only.

Returns
true if, and only if, this buffer is read-only.

Implements decaf::nio::Buffer.

virtual DoubleBuffer& decaf::internal::nio::DoubleArrayBuffer::put ( double  value)
virtual

Writes the given doubles into this buffer at the current position, and then increments the position.

Parameters
valueThe doubles value to be written.
Returns
a reference to this buffer.
Exceptions
BufferOverflowExceptionif this buffer's current position is not smaller than its limit.
ReadOnlyBufferExceptionif this buffer is read-only.

Implements decaf::nio::DoubleBuffer.

virtual DoubleBuffer& decaf::internal::nio::DoubleArrayBuffer::put ( int  index,
double  value 
)
virtual

Writes the given doubles into this buffer at the given index.

Parameters
indexThe position in the Buffer to write the data.
valueThe doubles to write.
Returns
a reference to this buffer
Exceptions
IndexOutOfBoundsExceptionif index greater than the buffer's limit minus the size of the type being written, or the index is negative.
ReadOnlyBufferExceptionif this buffer is read-only.

Implements decaf::nio::DoubleBuffer.

virtual void decaf::internal::nio::DoubleArrayBuffer::setReadOnly ( bool  value)
inlineprotectedvirtual

Sets this DoubleArrayBuffer as Read-Only or not Read-Only.

Parameters
valueBoolean value, true if this buffer is to be read-only, false otherwise.
virtual DoubleBuffer* decaf::internal::nio::DoubleArrayBuffer::slice ( ) const
virtual

Creates a new DoubleBuffer whose content is a shared subsequence of this buffer's content.The content of the new buffer will start at this buffer's current position. Changes to this buffer's content will be visible in the new buffer, and vice versa; the two buffers' position, limit, and mark values will be independent.The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer, and its mark will be undefined. The new buffer will be read-only if, and only if, this buffer is read-only.

Returns
the newly create DoubleBuffer which the caller owns.

Implements decaf::nio::DoubleBuffer.


The documentation for this class was generated from the following file: