|
activemq-cpp-3.3.0
|
00001 /* 00002 * Licensed to the Apache Software Foundation (ASF) under one or more 00003 * contributor license agreements. See the NOTICE file distributed with 00004 * this work for additional information regarding copyright ownership. 00005 * The ASF licenses this file to You under the Apache License, Version 2.0 00006 * (the "License"); you may not use this file except in compliance with 00007 * the License. You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 00018 #ifndef _DECAF_NIO_DOUBLEBUFFER_H_ 00019 #define _DECAF_NIO_DOUBLEBUFFER_H_ 00020 00021 #include <decaf/nio/Buffer.h> 00022 #include <decaf/lang/Comparable.h> 00023 #include <decaf/lang/exceptions/NullPointerException.h> 00024 #include <decaf/lang/exceptions/IndexOutOfBoundsException.h> 00025 #include <decaf/nio/BufferUnderflowException.h> 00026 #include <decaf/nio/BufferOverflowException.h> 00027 #include <decaf/nio/ReadOnlyBufferException.h> 00028 00029 namespace decaf{ 00030 namespace nio{ 00031 00052 class DECAF_API DoubleBuffer : public Buffer, 00053 public lang::Comparable<DoubleBuffer> { 00054 protected: 00055 00066 DoubleBuffer( int capacity ); 00067 00068 public: 00069 00070 virtual ~DoubleBuffer() {} 00071 00075 virtual std::string toString() const; 00076 00091 virtual double* array() = 0; 00092 00105 virtual int arrayOffset() = 0; 00106 00124 virtual DoubleBuffer* asReadOnlyBuffer() const = 0; 00125 00144 virtual DoubleBuffer& compact() = 0; 00145 00159 virtual DoubleBuffer* duplicate() = 0; 00160 00169 virtual double get() = 0; 00170 00182 virtual double get( int index ) const = 0; 00183 00198 DoubleBuffer& get( std::vector<double> buffer ); 00199 00229 DoubleBuffer& get( double* buffer, int size, int offset, int length ); 00230 00240 virtual bool hasArray() const = 0; 00241 00262 DoubleBuffer& put( DoubleBuffer& src ); 00263 00291 DoubleBuffer& put( const double* buffer, int size, int offset, int length ); 00292 00305 DoubleBuffer& put( std::vector<double>& buffer ); 00306 00320 virtual DoubleBuffer& put( double value ) = 0; 00321 00336 virtual DoubleBuffer& put( int index, double value ) = 0; 00337 00351 virtual DoubleBuffer* slice() const = 0; 00352 00353 public: // Comparable 00354 00358 virtual int compareTo( const DoubleBuffer& value ) const; 00359 00363 virtual bool equals( const DoubleBuffer& value ) const; 00364 00368 virtual bool operator==( const DoubleBuffer& value ) const; 00369 00373 virtual bool operator<( const DoubleBuffer& value ) const; 00374 00375 public: // Statics 00376 00391 static DoubleBuffer* allocate( int capacity ); 00392 00417 static DoubleBuffer* wrap( double* array, int size, int offset, int length ); 00418 00434 static DoubleBuffer* wrap( std::vector<double>& buffer ); 00435 00436 }; 00437 00438 }} 00439 00440 #endif /*_DECAF_NIO_DOUBLEBUFFER_H_*/