From fcab8098d6a9a385e0e5edfb26f4abf615da77ca Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 10 Oct 2008 15:04:28 +0200 Subject: FdManager hinzugef?gt und Verbindungsklassen angepasst --- src/Net/FdManager.h | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 src/Net/FdManager.h (limited to 'src/Net/FdManager.h') diff --git a/src/Net/FdManager.h b/src/Net/FdManager.h new file mode 100644 index 0000000..f6a528f --- /dev/null +++ b/src/Net/FdManager.h @@ -0,0 +1,58 @@ +/* + * FdManager.h + * + * Copyright (C) 2008 Matthias Schiffer + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef MAD_NET_FDMANAGER_H_ +#define MAD_NET_FDMANAGER_H_ + +#include +#include +#include + +namespace Mad { +namespace Net { + +class FdManager { + private: + static FdManager fdManager; + + std::map pollfds; + std::map > handlers; + + FdManager(); + + public: + virtual ~FdManager(); + + static FdManager *getFdManager() {return &fdManager;} + + bool registerFd(int fd, const sigc::slot &handler, short events = 0); + bool unregisterFd(int fd); + + bool setFdEvents(int fd, short events); + short getFdEvents(int fd) const; + + void interrupt(); + + void run(); +}; + +} +} + +#endif /* MAD_NET_FDMANAGER_H_ */ -- cgit v1.2.3