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