|
activemq-cpp-3.4.0
|
00001 /* 00002 * Licensed to the Apache Software Foundation (ASF) under one or more 00003 * contributor license agreements. See the NOTICE file distributed with 00004 * this work for additional information regarding copyright ownership. 00005 * The ASF licenses this file to You under the Apache License, Version 2.0 00006 * (the "License"); you may not use this file except in compliance with 00007 * the License. You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 00018 #ifndef _DECAF_NIO_BUFFER_H_ 00019 #define _DECAF_NIO_BUFFER_H_ 00020 00021 #include <decaf/lang/exceptions/IllegalArgumentException.h> 00022 #include <decaf/nio/InvalidMarkException.h> 00023 00024 namespace decaf{ 00025 namespace nio{ 00026 00125 class DECAF_API Buffer { 00126 protected: 00127 00128 mutable int _position; 00129 int _capacity; 00130 int _limit; 00131 int _mark; 00132 bool _markSet; 00133 00134 public: 00135 00136 Buffer( int capactiy ); 00137 Buffer( const Buffer& other ); 00138 virtual ~Buffer() {} 00139 00140 public: 00141 00145 virtual int capacity() const { 00146 return this->_capacity; 00147 } 00148 00152 virtual int position() const { 00153 return this->_position; 00154 } 00155 00167 virtual Buffer& position( int newPosition ); 00168 00172 virtual int limit() const { 00173 return this->_limit; 00174 } 00175 00188 virtual Buffer& limit( int newLimit ); 00189 00195 virtual Buffer& mark(); 00196 00204 virtual Buffer& reset(); 00205 00222 virtual Buffer& clear(); 00223 00242 virtual Buffer& flip(); 00243 00256 virtual Buffer& rewind(); 00257 00263 virtual int remaining() const { 00264 return _limit - _position; 00265 } 00266 00273 virtual bool hasRemaining() const { 00274 return remaining() != 0; 00275 } 00276 00282 virtual bool isReadOnly() const = 0; 00283 00284 }; 00285 00286 }} 00287 00288 #endif /*_DECAF_NIO_BUFFER_H_*/