activemq-cpp-3.9.5
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
24namespace decaf {
25namespace nio {
26
126 protected:
127
128 mutable int _position;
131 int _mark;
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_*/
bool _markSet
Definition Buffer.h:132
virtual Buffer & clear()
Clears this buffer.
virtual Buffer & limit(int newLimit)
Sets this buffer's limit.
virtual bool isReadOnly() const =0
Tells whether or not this buffer is read-only.
virtual int remaining() const
Returns the number of elements between the current position and the limit.
Definition Buffer.h:263
Buffer(const Buffer &other)
virtual Buffer & rewind()
Rewinds this buffer.
virtual int limit() const
Definition Buffer.h:172
virtual int capacity() const
Definition Buffer.h:145
Buffer(int capactiy)
virtual Buffer & mark()
Sets this buffer's mark at its position.
int _position
Definition Buffer.h:128
int _mark
Definition Buffer.h:131
virtual ~Buffer()
Definition Buffer.h:138
virtual int position() const
Definition Buffer.h:152
virtual Buffer & reset()
Resets this buffer's position to the previously-marked position.
virtual Buffer & position(int newPosition)
Sets this buffer's position.
virtual bool hasRemaining() const
Tells whether there are any elements between the current position and the limit.
Definition Buffer.h:273
int _capacity
Definition Buffer.h:129
int _limit
Definition Buffer.h:130
virtual Buffer & flip()
Flips this buffer.
#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