activemq-cpp-3.8.2
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>
22 #include <decaf/lang/Comparable.h>
28 
29 namespace decaf{
30 namespace nio{
31 
52  class DECAF_API DoubleBuffer : public Buffer,
53  public lang::Comparable<DoubleBuffer> {
54  protected:
55 
66  DoubleBuffer( int capacity );
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 
262  DoubleBuffer& put( DoubleBuffer& src );
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 
391  static DoubleBuffer* allocate( int capacity );
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_*/
A container for data of a specific primitive type.
Definition: Buffer.h:125
virtual ~DoubleBuffer()
Definition: DoubleBuffer.h:70
This class defines four categories of operations upon double buffers:
Definition: DoubleBuffer.h:52
#define DECAF_API
Definition: Config.h:29
bool operator==(const ArrayPointer< T > &left, const U *right)
Definition: ArrayPointer.h:379
This interface imposes a total ordering on the objects of each class that implements it...
Definition: Comparable.h:33
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements...
Definition: AprPool.h:25