Only allow this language: ((n|s)!(w|e)!(u|d)!;)+ for directions.
[UnsignedByte.git] / src / Core / Socket / UBHandler.h
blob515afb5973dfd1c13e2499bcfdf90a4d130b9653
1 /***************************************************************************
2 * Copyright (C) 2008 by Sverre Rabbelier *
3 * sverre@rabbelier.nl *
4 * *
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. *
9 * *
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. *
14 * *
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 ***************************************************************************/
20 #pragma once
22 /**
23 * @file UBHandler.h
24 * This file contains the UBHandler class.
26 * @see UBHandler
27 */
29 #include <SocketHandler.h>
31 class Socket;
32 typedef std::map<SOCKET,Socket *> socket_m; /**< The type of a socket number to Socket map. */
34 /**
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
41 public:
42 /** Iterate over all sockets and call SwitchEditor if it is an UBSocket. */
43 void SwitchEditors();
45 /** Iterate over all sockets and send a shutdown notice. */
46 void Shutdown();
48 /** Returns the map with sockets. */
49 socket_m& Sockets();
51 /**
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. */
58 static void Free();
60 private:
61 /** This is a singleton class, use <code>Get</code> to get an instance. */
62 UBHandler(void) {};
64 /** This is a singleton class, use <code>Free</code> to free the instance. */
65 ~UBHandler(void) {};
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. */