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 TimerDispatcher inline non-template implementation */
26 #include "TimerEvent.ih"
31 #define prefix_ inline
32 ///////////////////////////////cci.p///////////////////////////////////////
34 ///////////////////////////////////////////////////////////////////////////
35 // senf::scheduler::TimerEvent
37 prefix_ senf::scheduler::TimerEvent::TimerEvent(std::string const & name, Callback const & cb,
38 ClockService::clock_type timeout,
39 bool initiallyEnabled)
40 : detail::FIFORunner::TaskInfo (name), cb_ (cb), timeout_ (timeout)
46 prefix_ senf::scheduler::TimerEvent::TimerEvent(std::string const & name, Callback const & cb)
47 : detail::FIFORunner::TaskInfo (name), cb_ (cb), timeout_ (0)
50 prefix_ senf::scheduler::TimerEvent::~TimerEvent()
52 if (senf::scheduler::detail::TimerDispatcher::alive())
56 prefix_ void senf::scheduler::TimerEvent::enable()
58 if (! detail::TimerSetBase::linked())
59 senf::scheduler::detail::TimerDispatcher::instance().add(*this);
62 prefix_ void senf::scheduler::TimerEvent::disable()
64 if (detail::TimerSetBase::linked())
65 senf::scheduler::detail::TimerDispatcher::instance().remove(*this);
68 prefix_ void senf::scheduler::TimerEvent::action(Callback const & cb)
73 prefix_ void senf::scheduler::TimerEvent::timeout(ClockService::clock_type timeout,
74 bool initiallyEnabled)
82 ///////////////////////////////////////////////////////////////////////////
83 // senf::scheduler::detail::TimerDispatcher
85 prefix_ void senf::scheduler::detail::TimerDispatcher::enable()
90 prefix_ void senf::scheduler::detail::TimerDispatcher::disable()
95 prefix_ bool senf::scheduler::detail::TimerDispatcher::empty()
98 return timers_.empty();
101 prefix_ void senf::scheduler::detail::TimerDispatcher::
102 timerSource(std::auto_ptr<TimerSource> timerSource)
104 source_.reset(timerSource.release());
107 prefix_ senf::scheduler::detail::TimerSource *
108 senf::scheduler::detail::TimerDispatcher::timerSource()
110 return source_.get();
113 ///////////////////////////////cci.e///////////////////////////////////////
120 // comment-column: 40
121 // c-file-style: "senf"
122 // indent-tabs-mode: nil
123 // ispell-local-dictionary: "american"
124 // compile-command: "scons -u test"