activemq-cpp-3.8.2
Buffer.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_BUFFER_H_
19 #define _DECAF_NIO_BUFFER_H_
20 
23 
24 namespace decaf{
25 namespace nio{
26 
126  protected:
127 
128  mutable int _position;
130  int _limit;
131  int _mark;
132  bool _markSet;
133 
134  public:
135 
136  Buffer( int capactiy );
137  Buffer( const Buffer& other );
138  virtual ~Buffer() {}
139 
140  public:
141 
145  virtual int capacity() const {
146  return this->_capacity;
147  }
148 
152  virtual int position() const {
153  return this->_position;
154  }
155 
167  virtual Buffer& position( int newPosition );
168 
172  virtual int limit() const {
173  return this->_limit;
174  }
175 
188  virtual Buffer& limit( int newLimit );
189 
195  virtual Buffer& mark();
196 
204  virtual Buffer& reset();
205 
222  virtual Buffer& clear();
223 
242  virtual Buffer& flip();
243 
256  virtual Buffer& rewind();
257 
263  virtual int remaining() const {
264  return _limit - _position;
265  }
266 
273  virtual bool hasRemaining() const {
274  return remaining() != 0;
275  }
276 
282  virtual bool isReadOnly() const = 0;
283 
284  };
285 
286 }}
287 
288 #endif /*_DECAF_NIO_BUFFER_H_*/
A container for data of a specific primitive type.
Definition: Buffer.h:125
int _mark
Definition: Buffer.h:131
virtual int remaining() const
Returns the number of elements between the current position and the limit.
Definition: Buffer.h:263
bool _markSet
Definition: Buffer.h:132
virtual int position() const
Definition: Buffer.h:152
virtual bool hasRemaining() const
Tells whether there are any elements between the current position and the limit.
Definition: Buffer.h:273
virtual ~Buffer()
Definition: Buffer.h:138
virtual int capacity() const
Definition: Buffer.h:145
#define DECAF_API
Definition: Config.h:29
virtual int limit() const
Definition: Buffer.h:172
int _limit
Definition: Buffer.h:130
int _position
Definition: Buffer.h:128
int _capacity
Definition: Buffer.h:129
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements...
Definition: AprPool.h:25