activemq-cpp-3.9.5
FloatArrayBuffer.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_INTERNAL_NIO_FLOATARRAYBUFFER_H_
19#define _DECAF_INTERNAL_NIO_FLOATARRAYBUFFER_H_
20
28
29#include <decaf/lang/Pointer.h>
30
31namespace decaf {
32namespace internal {
33namespace nio {
34
36
38 private:
39
40 // The reference array object that backs this buffer.
42
43 // Offset into the array that we are to start from
44 int offset;
45
46 // Number of bytes to read past the offset, or Limit.
47 int length;
48
49 // Read / Write flag
50 bool readOnly;
51
52 public:
53
66 FloatArrayBuffer(int size, bool readOnly = false);
67
86 FloatArrayBuffer(float* array, int size, int offset, int length, bool readOnly = false);
87
105 FloatArrayBuffer(const decaf::lang::Pointer<ByteArrayAdapter>& array, int offset, int capacity,
106 bool readOnly = false);
107
117
119
120 public:
121
125 virtual float* array();
126
130 virtual int arrayOffset();
131
135 virtual FloatBuffer* asReadOnlyBuffer() const;
136
140 virtual FloatBuffer& compact();
141
145 virtual FloatBuffer* duplicate();
146
150 virtual float get();
151
155 virtual float get(int index) const;
156
160 virtual bool hasArray() const {
161 return true;
162 }
163
167 virtual bool isReadOnly() const {
168 return this->readOnly;
169 }
170
174 virtual FloatBuffer& put(float value);
175
179 virtual FloatBuffer& put(int index, float value);
180
184 virtual FloatBuffer* slice() const;
185
186 protected:
187
194 virtual void setReadOnly(bool value) {
195 this->readOnly = value;
196 }
197
198 };
199
200}}}
201
202#endif /*_DECAF_INTERNAL_NIO_FLOATARRAYBUFFER_H_*/
Definition: FloatArrayBuffer.h:37
FloatArrayBuffer(float *array, int size, int offset, int length, bool readOnly=false)
Creates a FloatArrayBuffer object that wraps the given array.
virtual FloatBuffer * asReadOnlyBuffer() const
Creates a new, read-only float buffer that shares this buffer's content.The content of the new buffer...
virtual FloatBuffer & put(float value)
Writes the given floats into this buffer at the current position, and then increments the position....
virtual float * array()
Returns the float array that backs this buffer (optional operation).Modifications to this buffer's co...
virtual int arrayOffset()
Returns the offset within this buffer's backing array of the first element of the buffer (optional op...
virtual FloatBuffer & put(int index, float value)
Writes the given floats into this buffer at the given index.The position in the Buffer to write the d...
virtual FloatBuffer * slice() const
Creates a new FloatBuffer whose content is a shared subsequence of this buffer's content....
virtual FloatBuffer & compact()
Compacts this buffer.The bytes between the buffer's current position and its limit,...
virtual void setReadOnly(bool value)
Sets this FloatArrayBuffer as Read-Only.
Definition: FloatArrayBuffer.h:194
virtual bool hasArray() const
Tells whether or not this buffer is backed by an accessible float array.If this method returns true t...
Definition: FloatArrayBuffer.h:160
virtual FloatBuffer * duplicate()
Creates a new float buffer that shares this buffer's content.The content of the new buffer will be th...
FloatArrayBuffer(int size, bool readOnly=false)
Creates a FloatArrayBuffer object that has its backing array allocated internally and is then owned a...
FloatArrayBuffer(const decaf::lang::Pointer< ByteArrayAdapter > &array, int offset, int capacity, bool readOnly=false)
Creates a byte buffer that wraps the passed ByteArrayAdapter and start at the given offset.
virtual float get()
Relative get method.Reads the value at this buffer's current position, and then increments the positi...
virtual float get(int index) const
Absolute get method.Reads the value at the given index.The index in the Buffer where the float is to ...
FloatArrayBuffer(const FloatArrayBuffer &other)
Create a FloatArrayBuffer that mirrors this one, meaning it shares a reference to this buffers ByteAr...
virtual bool isReadOnly() const
Tells whether or not this buffer is read-only.true if, and only if, this buffer is read-only.
Definition: FloatArrayBuffer.h:167
This class adapts primitive type arrays to a base byte array so that the classes can inter-operate on...
Definition: ByteArrayAdapter.h:43
Decaf's implementation of a Smart Pointer that is a template on a Type and is Thread Safe if the defa...
Definition: Pointer.h:53
This class defines four categories of operations upon float buffers:
Definition: FloatBuffer.h:51
#define DECAF_API
Definition: Config.h:29
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition: AprPool.h:25