ionflux.org | Impressum

SelectMultiplexer.hpp

Go to the documentation of this file.
00001 #ifndef IONFLUX_TOOLS_SELECTMULTIPLEXER
00002 #define IONFLUX_TOOLS_SELECTMULTIPLEXER
00003 /* ==========================================================================
00004  * Ionflux Tools
00005  * Copyright (c) 2004 Joern P. Meier
00006  * mail@ionflux.org
00007  * --------------------------------------------------------------------------
00008  * SelectMultiplexer.hpp              Select based IO event multiplexer.
00009  * ==========================================================================
00010  * 
00011  * This file is part of Ionflux Tools.
00012  * 
00013  * Ionflux Tools is free software; you can redistribute it and/or modify it 
00014  * under the terms of the GNU General Public License as published by the Free
00015  * Software Foundation; either version 2 of the License, or (at  your option)
00016  * any later version.
00017  * 
00018  * Ionflux Tools is distributed in the hope that it will be useful, but 
00019  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
00020  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00021  * for more details.
00022  * 
00023  * You should have received a copy of the GNU General Public License
00024  * along with Ionflux Tools; if not, write to the Free Software Foundation, 
00025  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00026  * 
00027  * ========================================================================== */
00028 
00029 #include <string>
00030 #include <iostream>
00031 #include <sstream>
00032 #include <vector>
00033 #include <signal.h>
00034 #include "ionflux/IOMultiplexer.hpp"
00035 #include "ionflux/FDSet.hpp"
00036 
00037 namespace Ionflux
00038 {
00039 
00040 namespace Tools
00041 {
00042 
00059 class SelectMultiplexer
00060 : public IOMultiplexer
00061 {
00062     protected:
00064         static sig_atomic_t shutdown;
00066         Ionflux::Tools::Reporter log;
00068         std::vector<IOEventInfo *> events;
00070         std::vector<IOEventInfo *> trash;
00072         std::vector<IOEventInfo *> newEvents;
00074         FDSet fds;
00076         bool running;
00077         
00084         virtual void clearEvent(IOEventInfo *eventInfo);
00085         
00087         virtual void clearEvents();
00088         
00095         virtual void addEvent(IOEventInfo *eventInfo);
00096         
00098         virtual void addEvents();
00099         
00100     public:
00105         SelectMultiplexer();
00106         
00111         virtual ~SelectMultiplexer();
00112         
00120         virtual void registerEvent(IOHandler *handler, IOEvent event);
00121         
00129         virtual void removeEvent(IOHandler *handler, IOEvent event);
00130         
00135         virtual void run();
00136         
00141         virtual void quit();
00142         
00147         virtual bool isRunning();
00148         
00155         static void shutdownHandler(int signum);
00156         
00161         virtual Reporter &getLog();
00162 };
00163 
00164 }
00165 
00166 }
00167 
00171 #endif

Generated on Tue Mar 14 20:58:29 2006 for Ionflux Tools Class Library (iftools) by  doxygen 1.4.6