EventHook.ih
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 
14 /** \file
15  \brief EventHook internal header */
16 
17 #ifndef IH_SENF_Scheduler_EventHook_
18 #define IH_SENF_Scheduler_EventHook_ 1
19 
20 // Custom includes
21 #include <senf/Utils/singleton.hh>
22 
23 //-/////////////////////////////////////////////////////////////////////////////////////////////////
24 
25 namespace senf {
26 namespace scheduler {
27 
28  void restart();
29 
30 namespace detail {
31 
32  class EventHookDispatcher
33  : public singleton<EventHookDispatcher>
34  {
35  public:
36  using singleton<EventHookDispatcher>::instance;
37  using singleton<EventHookDispatcher>::alive;
38 
39  void add(EventHook & event);
40  void remove(EventHook & event);
41 
42  void prepareRun();
43 
44  bool empty() const;
45 
46  private:
47  EventHookDispatcher();
48  ~EventHookDispatcher();
49 
50  typedef boost::intrusive::list< EventHook,
51  boost::intrusive::constant_time_size<false>,
52  boost::intrusive::base_hook<EventHookListBase> > EventList;
53 
54  EventList events_;
55 
56  friend void senf::scheduler::restart();
57  friend class singleton<EventHookDispatcher>;
58  };
59 
60 }}}
61 
62 //-/////////////////////////////////////////////////////////////////////////////////////////////////
63 #endif
64 
65 
66 // Local Variables:
67 // mode: c++
68 // fill-column: 100
69 // comment-column: 40
70 // c-file-style: "senf"
71 // indent-tabs-mode: nil
72 // ispell-local-dictionary: "american"
73 // compile-command: "scons -u test"
74 // End: