Fix documentation build under maverick (doxygen 1.7.1)
[senf.git] / senf / Scheduler / FdEvent.cci
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 FdDispatcher inline non-template implementation */
25
26 #include "FdEvent.ih"
27
28 // Custom includes
29 #include <senf/Utils/senfassert.hh>
30 #include "FdManager.hh"
31
32 #define prefix_ inline
33 //-/////////////////////////////////////////////////////////////////////////////////////////////////
34
35 //-/////////////////////////////////////////////////////////////////////////////////////////////////
36 // senf::scheduler::FdEvent
37
38 prefix_ senf::scheduler::FdEvent::FdEvent(std::string const & name, Callback const & cb)
39     : detail::FIFORunner::TaskInfo (name), cb_ (cb), fd_ (-1), pollable_ (true), events_ (0)
40 {}
41
42 prefix_ senf::scheduler::FdEvent::~FdEvent()
43 {
44     if (detail::FdDispatcher::alive())
45         disable();
46 }
47
48 prefix_ senf::scheduler::FdEvent & senf::scheduler::FdEvent::action(Callback const & cb)
49 {
50     cb_ = cb;
51     return *this;
52 }
53
54 prefix_ senf::scheduler::FdEvent & senf::scheduler::FdEvent::addEvents(int e)
55 {
56     events( events() | e );
57     return *this;
58 }
59
60 prefix_ senf::scheduler::FdEvent & senf::scheduler::FdEvent::removeEvents(int e)
61 {
62     events( events() & ~e );
63     return *this;
64 }
65
66 prefix_ int senf::scheduler::FdEvent::events()
67 {
68     return events_;
69 }
70
71 //-/////////////////////////////////////////////////////////////////////////////////////////////////
72 // senf::scheduler::detail::FdDispatcher
73
74 prefix_ senf::scheduler::detail::FdDispatcher::FdDispatcher()
75 {}
76
77 prefix_ bool senf::scheduler::detail::FdDispatcher::empty()
78     const
79 {
80     return fds_.empty();
81 }
82
83 //-/////////////////////////////////////////////////////////////////////////////////////////////////
84 // senf::scheduler::detail::FileDispatcher
85
86 prefix_ void senf::scheduler::detail::FileDispatcher::timeout(int t)
87 {
88     managerTimeout_ = t;
89     if (fds_.empty())
90         detail::FdManager::instance().timeout(managerTimeout_);
91 }
92
93 prefix_ int senf::scheduler::detail::FileDispatcher::timeout()
94     const
95 {
96     return managerTimeout_;
97 }
98
99 prefix_ bool senf::scheduler::detail::FileDispatcher::empty()
100     const
101 {
102     return fds_.empty();
103 }
104
105 //-/////////////////////////////////////////////////////////////////////////////////////////////////
106
107 prefix_ int senf::scheduler::detail::retrieve_filehandle(int fd)
108 {
109     return fd;
110 }
111
112 //-/////////////////////////////////////////////////////////////////////////////////////////////////
113 #undef prefix_
114
115 \f
116 // Local Variables:
117 // mode: c++
118 // fill-column: 100
119 // comment-column: 40
120 // c-file-style: "senf"
121 // indent-tabs-mode: nil
122 // ispell-local-dictionary: "american"
123 // compile-command: "scons -u test"
124 // End: