activemq-cpp-3.9.5
FloatBuffer.h
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef _DECAF_NIO_FLOATBUFFER_H_
19#define _DECAF_NIO_FLOATBUFFER_H_
20
21#include <decaf/nio/Buffer.h>
28
29namespace decaf{
30namespace nio{
31
51 public lang::Comparable<FloatBuffer> {
52 protected:
53
65
66 public:
67
68 virtual ~FloatBuffer() {}
69
73 virtual std::string toString() const;
74
89 virtual float* array() = 0;
90
103 virtual int arrayOffset() = 0;
104
122 virtual FloatBuffer* asReadOnlyBuffer() const = 0;
123
142 virtual FloatBuffer& compact() = 0;
143
157 virtual FloatBuffer* duplicate() = 0;
158
167 virtual float get() = 0;
168
180 virtual float get( int index ) const = 0;
181
196 FloatBuffer& get( std::vector<float> buffer );
197
227 FloatBuffer& get( float* buffer, int size, int offset, int length );
228
238 virtual bool hasArray() const = 0;
239
261
289 FloatBuffer& put( const float* buffer, int size, int offset, int length );
290
303 FloatBuffer& put( std::vector<float>& buffer );
304
318 virtual FloatBuffer& put( float value ) = 0;
319
334 virtual FloatBuffer& put( int index, float value ) = 0;
335
349 virtual FloatBuffer* slice() const = 0;
350
351 public: // Comparable
352
356 virtual int compareTo( const FloatBuffer& value ) const;
357
361 virtual bool equals( const FloatBuffer& value ) const;
362
366 virtual bool operator==( const FloatBuffer& value ) const;
367
371 virtual bool operator<( const FloatBuffer& value ) const;
372
373 public: // Statics
374
388
413 static FloatBuffer* wrap( float* array, int size, int offset, int length );
414
427 static FloatBuffer* wrap( std::vector<float>& buffer );
428
429 };
430
431}}
432
433#endif /*_DECAF_NIO_FLOATBUFFER_H_*/
This interface imposes a total ordering on the objects of each class that implements it.
Definition Comparable.h:33
virtual int capacity() const
Definition Buffer.h:145
Buffer(int capactiy)
FloatBuffer & put(FloatBuffer &src)
This method transfers the floats remaining in the given source buffer into this buffer.
static FloatBuffer * allocate(int capacity)
Allocates a new Double buffer.
virtual bool equals(const FloatBuffer &value) const
static FloatBuffer * wrap(std::vector< float > &buffer)
Wraps the passed STL float Vector in a FloatBuffer.
FloatBuffer & put(std::vector< float > &buffer)
This method transfers the entire content of the given source floats array into this buffer.
virtual ~FloatBuffer()
Definition FloatBuffer.h:68
virtual float get(int index) const =0
Absolute get method.
virtual bool hasArray() const =0
Tells whether or not this buffer is backed by an accessible float array.
virtual float get()=0
Relative get method.
virtual FloatBuffer * slice() const =0
Creates a new FloatBuffer whose content is a shared subsequence of this buffer's content.
virtual FloatBuffer & compact()=0
Compacts this buffer.
virtual FloatBuffer & put(int index, float value)=0
Writes the given floats into this buffer at the given index.
virtual FloatBuffer * duplicate()=0
Creates a new float buffer that shares this buffer's content.
virtual int arrayOffset()=0
Returns the offset within this buffer's backing array of the first element of the buffer (optional op...
FloatBuffer(int capacity)
Creates a FloatBuffer object that has its backing array allocated internally and is then owned and de...
virtual float * array()=0
Returns the float array that backs this buffer (optional operation).
virtual bool operator==(const FloatBuffer &value) const
FloatBuffer & get(float *buffer, int size, int offset, int length)
Relative bulk get method.
virtual bool operator<(const FloatBuffer &value) const
static FloatBuffer * wrap(float *array, int size, int offset, int length)
Wraps the passed buffer with a new FloatBuffer.
virtual FloatBuffer & put(float value)=0
Writes the given floats into this buffer at the current position, and then increments the position.
virtual int compareTo(const FloatBuffer &value) const
virtual FloatBuffer * asReadOnlyBuffer() const =0
Creates a new, read-only float buffer that shares this buffer's content.
virtual std::string toString() const
FloatBuffer & get(std::vector< float > buffer)
Relative bulk get method.
FloatBuffer & put(const float *buffer, int size, int offset, int length)
This method transfers floats into this buffer from the given source array.
#define DECAF_API
Definition Config.h:29
Definition Readable.h:28
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition AprPool.h:25