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 FdDispatcher public header */
26 #ifndef HH_FdDispatcher_
27 #define HH_FdDispatcher_ 1
31 #include "FdManager.hh"
32 #include "FIFORunner.hh"
34 //#include "FdDispatcher.mpp"
35 #include "FdDispatcher.ih"
36 ///////////////////////////////hh.p////////////////////////////////////////
46 ///////////////////////////////////////////////////////////////////////////
49 typedef boost::function<void (int)> Callback;
52 EV_READ = FdManager::EV_READ, EV_PRIO = FdManager::EV_PRIO, 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 | FdManager::EV_PRIO
57 ///////////////////////////////////////////////////////////////////////////
58 ///\name Structors and default members
61 explicit FdDispatcher(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);
74 : public detail::FdTask<0, FdEvent>,
75 public detail::FdTask<1, FdEvent>,
76 public detail::FdTask<2, FdEvent>,
77 public FdManager::Event
79 typedef detail::FdTask<0, FdEvent> ReadTask;
80 typedef detail::FdTask<1, FdEvent> PrioTask;
81 typedef detail::FdTask<2, FdEvent> WriteTask;
83 virtual void signal(int events);
85 int activeEvents() const;
90 typedef std::map<int, FdEvent> FdMap;
99 ///////////////////////////////hh.e////////////////////////////////////////
100 #include "FdDispatcher.cci"
101 #include "FdDispatcher.ct"
102 #include "FdDispatcher.cti"
109 // comment-column: 40
110 // c-file-style: "senf"
111 // indent-tabs-mode: nil
112 // ispell-local-dictionary: "american"
113 // compile-command: "scons -u test"