ecc7f98f5e62c1ac00f1061f3537104df6169c2f
[senf.git] / Scheduler / FdManager.hh
1 // $Id$
2 //
3 // Copyright (C) 2008 
4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 //     Stefan Bund <g0dil@berlios.de>
7 //
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.
12 //
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.
17 //
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.
22
23 /** \file
24     \brief FdManager public header */
25
26 #ifndef HH_FdManager_
27 #define HH_FdManager_ 1
28
29 // Custom includes
30 #include "Poller.hh"
31
32 //#include "FdManager.mpp"
33 ///////////////////////////////hh.p////////////////////////////////////////
34
35 namespace senf {
36 namespace scheduler {
37
38     /** \brief
39       */
40     class FdManager
41     {
42     public:
43         ///////////////////////////////////////////////////////////////////////////
44         // Types
45
46         struct Event {
47             virtual ~Event();
48             virtual void signal(int events) = 0;
49         };
50
51         enum Events { 
52             EV_READ = Poller<Event>::EV_READ, EV_PRIO = Poller<Event>::EV_PRIO, EV_WRITE = Poller<Event>::EV_WRITE,
53             EV_HUP = Poller<Event>::EV_HUP, EV_ERR = Poller<Event>::EV_ERR 
54         };
55
56         ///////////////////////////////////////////////////////////////////////////
57         ///\name Structors and default members
58         ///@{
59
60         ///@}
61         ///////////////////////////////////////////////////////////////////////////
62
63         void set(int fd, int events, Event * entry);
64         void remove(int fd);
65
66         void timeout(int t);
67         int timeout() const;
68
69         void processOnce();
70
71     protected:
72
73     private:
74         Poller<Event> poller_;
75     };
76
77 }}
78
79 ///////////////////////////////hh.e////////////////////////////////////////
80 #include "FdManager.cci"
81 //#include "FdManager.ct"
82 //#include "FdManager.cti"
83 #endif
84
85 \f
86 // Local Variables:
87 // mode: c++
88 // fill-column: 100
89 // comment-column: 40
90 // c-file-style: "senf"
91 // indent-tabs-mode: nil
92 // ispell-local-dictionary: "american"
93 // compile-command: "scons -u test"
94 // End: