activemq-cpp-3.8.2
ShortBuffer.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_SHORTBUFFER_H_
19 #define _DECAF_NIO_SHORTBUFFER_H_
20 
21 #include <decaf/nio/Buffer.h>
22 #include <decaf/lang/Comparable.h>
28 
29 namespace decaf{
30 namespace nio{
31 
50  class DECAF_API ShortBuffer : public Buffer,
51  public lang::Comparable<ShortBuffer> {
52  protected:
53 
64  ShortBuffer( int capacity );
65 
66  public:
67 
68  virtual ~ShortBuffer() {}
69 
73  virtual std::string toString() const;
74 
89  virtual short* array() = 0;
90 
103  virtual int arrayOffset() = 0;
104 
122  virtual ShortBuffer* asReadOnlyBuffer() const = 0;
123 
142  virtual ShortBuffer& compact() = 0;
143 
157  virtual ShortBuffer* duplicate() = 0;
158 
167  virtual short get() = 0;
168 
180  virtual short get( int index ) const = 0;
181 
196  ShortBuffer& get( std::vector<short> buffer );
197 
227  ShortBuffer& get( short* buffer, int size, int offset, int length );
228 
238  virtual bool hasArray() const = 0;
239 
260  ShortBuffer& put( ShortBuffer& src );
261 
289  ShortBuffer& put( const short* buffer, int size, int offset, int length );
290 
303  ShortBuffer& put( std::vector<short>& buffer );
304 
318  virtual ShortBuffer& put( short value ) = 0;
319 
334  virtual ShortBuffer& put( int index, short value ) = 0;
335 
349  virtual ShortBuffer* slice() const = 0;
350 
351  public: // Comparable
352 
356  virtual int compareTo( const ShortBuffer& value ) const;
357 
361  virtual bool equals( const ShortBuffer& value ) const;
362 
366  virtual bool operator==( const ShortBuffer& value ) const;
367 
371  virtual bool operator<( const ShortBuffer& value ) const;
372 
373  public: // Statics
374 
387  static ShortBuffer* allocate( int capacity );
388 
413  static ShortBuffer* wrap( short* array, int size, int offset, int length );
414 
430  static ShortBuffer* wrap( std::vector<short>& buffer );
431 
432  };
433 
434 }}
435 
436 #endif /*_DECAF_NIO_SHORTBUFFER_H_*/
A container for data of a specific primitive type.
Definition: Buffer.h:125
virtual ~ShortBuffer()
Definition: ShortBuffer.h:68
This class defines four categories of operations upon short buffers:
Definition: ShortBuffer.h:50
#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