activemq-cpp-3.9.5
DoubleBuffer.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_DOUBLEBUFFER_H_
19#define _DECAF_NIO_DOUBLEBUFFER_H_
20
21#include <decaf/nio/Buffer.h>
28
29namespace decaf{
30namespace nio{
31
53 public lang::Comparable<DoubleBuffer> {
54 protected:
55
67
68 public:
69
70 virtual ~DoubleBuffer() {}
71
75 virtual std::string toString() const;
76
91 virtual double* array() = 0;
92
105 virtual int arrayOffset() = 0;
106
124 virtual DoubleBuffer* asReadOnlyBuffer() const = 0;
125
144 virtual DoubleBuffer& compact() = 0;
145
159 virtual DoubleBuffer* duplicate() = 0;
160
169 virtual double get() = 0;
170
182 virtual double get( int index ) const = 0;
183
198 DoubleBuffer& get( std::vector<double> buffer );
199
229 DoubleBuffer& get( double* buffer, int size, int offset, int length );
230
240 virtual bool hasArray() const = 0;
241
263
291 DoubleBuffer& put( const double* buffer, int size, int offset, int length );
292
305 DoubleBuffer& put( std::vector<double>& buffer );
306
320 virtual DoubleBuffer& put( double value ) = 0;
321
336 virtual DoubleBuffer& put( int index, double value ) = 0;
337
351 virtual DoubleBuffer* slice() const = 0;
352
353 public: // Comparable
354
358 virtual int compareTo( const DoubleBuffer& value ) const;
359
363 virtual bool equals( const DoubleBuffer& value ) const;
364
368 virtual bool operator==( const DoubleBuffer& value ) const;
369
373 virtual bool operator<( const DoubleBuffer& value ) const;
374
375 public: // Statics
376
392
417 static DoubleBuffer* wrap( double* array, int size, int offset, int length );
418
434 static DoubleBuffer* wrap( std::vector<double>& buffer );
435
436 };
437
438}}
439
440#endif /*_DECAF_NIO_DOUBLEBUFFER_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)
virtual double * array()=0
Returns the double array that backs this buffer (optional operation).
virtual bool operator<(const DoubleBuffer &value) const
virtual DoubleBuffer * asReadOnlyBuffer() const =0
Creates a new, read-only double buffer that shares this buffer's content.
static DoubleBuffer * wrap(std::vector< double > &buffer)
Wraps the passed STL double Vector in a DoubleBuffer.
virtual DoubleBuffer & put(double value)=0
Writes the given doubles into this buffer at the current position, and then increments the position.
virtual bool operator==(const DoubleBuffer &value) const
virtual DoubleBuffer & put(int index, double value)=0
Writes the given doubles into this buffer at the given index.
virtual bool equals(const DoubleBuffer &value) const
DoubleBuffer & get(std::vector< double > buffer)
Relative bulk get method.
DoubleBuffer & put(DoubleBuffer &src)
This method transfers the doubles remaining in the given source buffer into this buffer.
virtual bool hasArray() const =0
Tells whether or not this buffer is backed by an accessible double array.
static DoubleBuffer * wrap(double *array, int size, int offset, int length)
Wraps the passed buffer with a new DoubleBuffer.
DoubleBuffer(int capacity)
Creates a DoubleBuffer object that has its backing array allocated internally and is then owned and d...
virtual int arrayOffset()=0
Returns the offset within this buffer's backing array of the first element of the buffer (optional op...
DoubleBuffer & put(std::vector< double > &buffer)
This method transfers the entire content of the given source doubles array into this buffer.
virtual ~DoubleBuffer()
Definition DoubleBuffer.h:70
static DoubleBuffer * allocate(int capacity)
Allocates a new DoubleBuffer.
virtual DoubleBuffer * slice() const =0
Creates a new DoubleBuffer whose content is a shared subsequence of this buffer's content.
virtual DoubleBuffer & compact()=0
Compacts this buffer.
virtual double get()=0
Relative get method.
DoubleBuffer & get(double *buffer, int size, int offset, int length)
Relative bulk get method.
virtual DoubleBuffer * duplicate()=0
Creates a new double buffer that shares this buffer's content.
virtual int compareTo(const DoubleBuffer &value) const
DoubleBuffer & put(const double *buffer, int size, int offset, int length)
This method transfers doubles into this buffer from the given source array.
virtual double get(int index) const =0
Absolute get method.
virtual std::string toString() const
#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