NetLink Sockets C++ 1.0.0
Networking C++ Library @ Get NetLink Sockets C++ Library at SourceForge.net. Fast, secure and Free Open Source software downloads

include/netlink/smart_buffer.inline.h

00001 /*
00002     NetLink Sockets: Networking C++ library
00003     Copyright 2012 Pedro Francisco Pareja Ruiz (PedroPareja@Gmail.com)
00004 
00005     This file is part of NetLink Sockets.
00006 
00007     NetLink Sockets is free software: you can redistribute it and/or modify
00008     it under the terms of the GNU General Public License as published by
00009     the Free Software Foundation, either version 3 of the License, or
00010     (at your option) any later version.
00011 
00012     NetLink Sockets is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015     GNU General Public License for more details.
00016 
00017     You should have received a copy of the GNU General Public License
00018     along with NetLink Sockets. If not, see <http://www.gnu.org/licenses/>.
00019 
00020 */
00021 
00022 
00023 #ifdef DOXYGEN
00024     #include <netlink/smart_buffer.h>
00025     NL_NAMESPACE_USE
00026 #endif
00027 
00028 
00035 inline const void* SmartBuffer::operator*() const {
00036 
00037     return _buffer;
00038 }
00039 
00040 
00050 inline const char* SmartBuffer::operator[](size_t index) const {
00051 
00052     if(index >= _usedSize)
00053         throw Exception(Exception::OUT_OF_RANGE, "SmartBuffer::operator[]: index out of range");
00054 
00055     return (char*) _buffer + index;
00056 }
00057 
00064 inline const void* SmartBuffer::buffer() const {
00065 
00066     return _buffer;
00067 }
00068 
00075 inline size_t SmartBuffer::size() const {
00076 
00077     return _usedSize;
00078 }
00079 
00086 inline void SmartBuffer::clear() {
00087 
00088     _usedSize = 0;
00089 }
00090 
 All Classes Namespaces Files Functions Enumerations Enumerator