Events.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 "Events.hh"
18 #include "Events.ih"
19 
20 // Custom includes
21 #include "Route.hh"
22 #include "EventManager.hh"
23 
24 //#include "Events.mpp"
25 #define prefix_
26 //-/////////////////////////////////////////////////////////////////////////////////////////////////
27 
28 //-/////////////////////////////////////////////////////////////////////////////////////////////////
29 // senf::ppi::EventDescriptor
30 
32 {
33  if (binding_ && EventManager::alive())
34  binding_->manager().destroyEvent(*this);
35 }
36 
37 prefix_ void senf::ppi::EventDescriptor::notifyUnthrottle()
38 {
39  Routes::const_iterator i (routes_.begin());
40  Routes::const_iterator const i_end (routes_.end());
41  for (; i != i_end; ++i)
42  if ((*i)->throttled())
43  break;
44  if (i != i_end)
45  return;
46  throttled_ = false;
47  enabled(true);
48 }
49 
51 {
52  SENF_ASSERT(v_isRegistered(), "Module::registerEvent() call missing");
53  if (throttled_ && v)
54  return;
55  if (v && ! enabled_)
56  v_enable();
57  else if (! v && enabled_)
58  v_disable();
59  enabled_ = v;
60 }
61 
62 //-/////////////////////////////////////////////////////////////////////////////////////////////////
63 #undef prefix_
64 //#include "Events.mpp"
65 
66 
67 // Local Variables:
68 // mode: c++
69 // fill-column: 100
70 // comment-column: 40
71 // c-file-style: "senf"
72 // indent-tabs-mode: nil
73 // ispell-local-dictionary: "american"
74 // compile-command: "scons -u test"
75 // End:
#define prefix_
Definition: Events.cc:25
Route public header.
EventManager public header.
virtual ~EventDescriptor()
Definition: Events.cc:31
EventManager & manager() const
#define SENF_ASSERT(x, comment)
Events public header.
bool enabled() const
Check, whether the event is currently enabled.