IdleEvent.cc
Go to the documentation of this file.
1 //
2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
6 //
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
11 //
12 
13 
17 #include "IdleEvent.hh"
18 //#include "IdleEvent.ih"
19 
20 // Custom includes
21 
22 //#include "IdleEvent.mpp"
23 #define prefix_
24 //-/////////////////////////////////////////////////////////////////////////////////////////////////
25 
26 //-/////////////////////////////////////////////////////////////////////////////////////////////////
27 // senf::ppi::IdleEvent
28 
29 //-/////////////////////////////////////////////////////////////////////////////////////////////////
30 // private members
31 
32 prefix_ void senf::ppi::IdleEvent::v_enable()
33 {
34  timer_.timeout(manager().now());
35 }
36 
37 prefix_ void senf::ppi::IdleEvent::v_disable()
38 {
39  timer_.disable();
40 }
41 
42 prefix_ void senf::ppi::IdleEvent::cb()
43 {
44  callback();
45  if (enabled())
46  v_enable();
47 }
48 
49 //-/////////////////////////////////////////////////////////////////////////////////////////////////
50 #undef prefix_
51 //#include "IdleEvent.mpp"
52 
53 
54 // Local Variables:
55 // mode: c++
56 // fill-column: 100
57 // comment-column: 40
58 // c-file-style: "senf"
59 // indent-tabs-mode: nil
60 // ispell-local-dictionary: "american"
61 // compile-command: "scons -u test"
62 // End:
void callback(EventArg event, ClockService::clock_type time)
Forward event to user callback.
ClockService::clock_type const & now()
void timeout(ClockService::clock_type const &timeout, bool initiallyEnabled=true)
EventManager & manager() const
EventManager of the event.
IdleEvent public header.
bool enabled() const
Check, whether the event is currently enabled.
#define prefix_
Definition: IdleEvent.cc:23