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/socket_group.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 #ifdef DOXYGEN
00023     #include <netlink/socket_group.h>
00024     NL_NAMESPACE_USE
00025 #endif
00026 
00027 
00035 inline void SocketGroup::add(Socket* socket) {
00036 
00037     _vSocket.push_back(socket);
00038 }
00039 
00049 inline Socket* SocketGroup::get(unsigned index) const {
00050 
00051     if(index >= _vSocket.size())
00052         throw Exception(Exception::OUT_OF_RANGE, "SocketGroup::get: index out of range");
00053 
00054     return _vSocket[index];
00055 }
00056 
00065 inline void SocketGroup::remove(unsigned index) {
00066 
00067     if(index >= _vSocket.size())
00068         throw Exception(Exception::OUT_OF_RANGE, "SocketGroup::remove: index out of range");
00069 
00070     _vSocket.erase(_vSocket.begin() + index);
00071 }
00072 
00079 inline size_t SocketGroup::size() const {
00080 
00081     return _vSocket.size();
00082 }
00083 
00092 inline void SocketGroup::setCmdOnAccept(SocketGroupCmd* cmd) {
00093 
00094     _cmdOnAccept = cmd;
00095 }
00096 
00105 inline void SocketGroup::setCmdOnRead(SocketGroupCmd* cmd) {
00106 
00107     _cmdOnRead = cmd;
00108 }
00109 
00119 inline void SocketGroup::setCmdOnDisconnect(SocketGroupCmd* cmd) {
00120 
00121     _cmdOnDisconnect = cmd;
00122 }
00123 
 All Classes Namespaces Files Functions Enumerations Enumerator