1 /***************************************************************************
2 * Copyright (C) 2008 by Sverre Rabbelier *
3 * sverre@rabbelier.nl *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 3 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
24 * This file contains the UBHandler class.
29 #include <SocketHandler.h>
32 typedef std::map
<SOCKET
,Socket
*> socket_m
; /**< The type of a socket number to Socket map. */
35 * This class will handle all Socket related events.
37 * This class does not use Singleton since SocketHandler already declares Get
39 class UBHandler
: public SocketHandler
42 /** Iterate over all sockets and call SwitchEditor if it is an UBSocket. */
45 /** Iterate over all sockets and send a shutdown notice. */
48 /** Returns the map with sockets. */
52 * Static method to access the only pointer of this instance.
53 * @return a pointer to the only instance of this class
55 static UBHandler
* Get();
57 /** Release resources. */
61 /** This is a singleton class, use <code>Get</code> to get an instance. */
64 /** This is a singleton class, use <code>Free</code> to free the instance. */
67 /** Hide the copy constructor. */
68 UBHandler(const UBHandler
& rhs
);
70 /** Hide the assignment operator. */
71 UBHandler
operator=(const UBHandler
& rhs
);
74 /** Send a shutdown notice to the specified socket. */
75 void Shutdown(Socket
* sock
);
78 static UBHandler
* ms_instance
; /**< The one instance of this class. */