Webmaster  |  Imprint 
C++ Server Pages
Main  |  License  |  Documentation  |  Download 

/home/tommi/cxxtools/include/cxxtools/connectable.h

00001 /*
00002  * Copyright (C) 2004-2007 by Dr. Marc Boris Duerner
00003  * 
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2.1 of the License, or (at your option) any later version.
00008  * 
00009  * As a special exception, you may use this file as part of a free
00010  * software library without restriction. Specifically, if other files
00011  * instantiate templates or use macros or inline functions from this
00012  * file, or you compile this file and link it with other files to
00013  * produce an executable, this file does not by itself cause the
00014  * resulting executable to be covered by the GNU General Public
00015  * License. This exception does not however invalidate any other
00016  * reasons why the executable file might be covered by the GNU Library
00017  * General Public License.
00018  * 
00019  * This library is distributed in the hope that it will be useful,
00020  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00022  * Lesser General Public License for more details.
00023  * 
00024  * You should have received a copy of the GNU Lesser General Public
00025  * License along with this library; if not, write to the Free Software
00026  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00027  */
00028 #ifndef cxxtools_Connectable_h
00029 #define cxxtools_Connectable_h
00030 
00031 #include <cxxtools/connection.h>
00032 #include <list>
00033 
00034 namespace cxxtools {
00035 
00045     class Connectable
00046     {
00047         public:
00052             Connectable();
00053 
00059             virtual ~Connectable();
00060 
00070             virtual void onConnectionOpen(const Connection& c);
00071 
00080             virtual void onConnectionClose(const Connection& c);
00081 
00083             size_t connectionCount() const
00084             { return _connections.size(); }
00085 
00086         protected:
00091             Connectable(const Connectable& c);
00092 
00099             Connectable& operator=(const Connectable& rhs);
00100 
00103             const std::list<Connection>& connections() const
00104             { return _connections; }
00105 
00108             std::list<Connection>& connections()
00109             { return _connections; }
00110 
00111         protected:
00114             mutable std::list<Connection> _connections;
00115 
00117             void clear();
00118     };
00119 
00120 } // namespace cxxtools
00121 
00122 #endif
Copyright © 2008 The Tntnet Development Team
Tntnet 1.6