4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 // Stefan Bund <g0dil@berlios.de>
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 \brief FileDispatcher public header */
26 #ifndef HH_FileDispatcher_
27 #define HH_FileDispatcher_ 1
31 #include "FdManager.hh"
32 #include "FIFORunner.hh"
33 #include "FdDispatcher.hh"
35 //#include "FileDispatcher.mpp"
36 ///////////////////////////////hh.p////////////////////////////////////////
46 ///////////////////////////////////////////////////////////////////////////
49 typedef boost::function<void (int)> Callback;
52 EV_READ = FdManager::EV_READ, EV_WRITE = FdManager::EV_WRITE,
53 EV_HUP = FdManager::EV_HUP, EV_ERR = FdManager::EV_ERR,
54 EV_ALL = FdManager::EV_READ | FdManager::EV_WRITE
57 ///////////////////////////////////////////////////////////////////////////
58 ///\name Structors and default members
61 FileDispatcher(FdManager & manager, FIFORunner & runner);
65 ///////////////////////////////////////////////////////////////////////////
67 void add(int fd, Callback const & cb, int events = EV_ALL);
68 void remove(int fd, int events = EV_ALL);
79 : public detail::FdTask<0, FileEvent>,
80 public detail::FdTask<1, FileEvent>
82 typedef detail::FdTask<0, FileEvent> ReadTask;
83 typedef detail::FdTask<1, FileEvent> WriteTask;
85 int activeEvents() const;
89 typedef std::map<int, FileEvent> FileMap;
100 ///////////////////////////////hh.e////////////////////////////////////////
101 #include "FileDispatcher.cci"
102 //#include "FileDispatcher.ct"
103 //#include "FileDispatcher.cti"
110 // comment-column: 40
111 // c-file-style: "senf"
112 // indent-tabs-mode: nil
113 // ispell-local-dictionary: "american"
114 // compile-command: "scons -u test"