|
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_FLOATBUFFER_H_ 00019 #define _DECAF_NIO_FLOATBUFFER_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 00050 class DECAF_API FloatBuffer : public Buffer, 00051 public lang::Comparable<FloatBuffer> { 00052 protected: 00053 00064 FloatBuffer( int capacity ); 00065 00066 public: 00067 00068 virtual ~FloatBuffer() {} 00069 00073 virtual std::string toString() const; 00074 00089 virtual float* array() = 0; 00090 00103 virtual int arrayOffset() = 0; 00104 00122 virtual FloatBuffer* asReadOnlyBuffer() const = 0; 00123 00142 virtual FloatBuffer& compact() = 0; 00143 00157 virtual FloatBuffer* duplicate() = 0; 00158 00167 virtual float get() = 0; 00168 00180 virtual float get( int index ) const = 0; 00181 00196 FloatBuffer& get( std::vector<float> buffer ); 00197 00227 FloatBuffer& get( float* buffer, int size, int offset, int length ); 00228 00238 virtual bool hasArray() const = 0; 00239 00260 FloatBuffer& put( FloatBuffer& src ); 00261 00289 FloatBuffer& put( const float* buffer, int size, int offset, int length ); 00290 00303 FloatBuffer& put( std::vector<float>& buffer ); 00304 00318 virtual FloatBuffer& put( float value ) = 0; 00319 00334 virtual FloatBuffer& put( int index, float value ) = 0; 00335 00349 virtual FloatBuffer* slice() const = 0; 00350 00351 public: // Comparable 00352 00356 virtual int compareTo( const FloatBuffer& value ) const; 00357 00361 virtual bool equals( const FloatBuffer& value ) const; 00362 00366 virtual bool operator==( const FloatBuffer& value ) const; 00367 00371 virtual bool operator<( const FloatBuffer& value ) const; 00372 00373 public: // Statics 00374 00387 static FloatBuffer* allocate( int capacity ); 00388 00413 static FloatBuffer* wrap( float* array, int size, int offset, int length ); 00414 00427 static FloatBuffer* wrap( std::vector<float>& buffer ); 00428 00429 }; 00430 00431 }} 00432 00433 #endif /*_DECAF_NIO_FLOATBUFFER_H_*/