4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
6 // The contents of this file are subject to the Fraunhofer FOKUS Public License
7 // Version 1.0 (the "License"); you may not use this file except in compliance
8 // with the License. You may obtain a copy of the License at
9 // http://senf.berlios.de/license.html
11 // The Fraunhofer FOKUS Public License Version 1.0 is based on,
12 // but modifies the Mozilla Public License Version 1.1.
13 // See the full license text for the amendments.
15 // Software distributed under the License is distributed on an "AS IS" basis,
16 // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
17 // for the specific language governing rights and limitations under the License.
19 // The Original Code is Fraunhofer FOKUS code.
21 // The Initial Developer of the Original Code is Fraunhofer-Gesellschaft e.V.
22 // (registered association), Hansastraße 27 c, 80686 Munich, Germany.
23 // All Rights Reserved.
26 // Stefan Bund <g0dil@berlios.de>
29 \brief EventManager public header */
31 #ifndef HH_SENF_PPI_EventManager_
32 #define HH_SENF_PPI_EventManager_ 1
35 #include <boost/utility.hpp>
36 #include <boost/ptr_container/ptr_vector.hpp>
37 #include <senf/Scheduler/ClockService.hh>
39 #include "detail/Callback.hh"
40 #include "detail/EventBinding.hh"
42 //#include "EventManager.mpp"
43 //-/////////////////////////////////////////////////////////////////////////////////////////////////
48 /** \brief Event registry and control
50 The EventManager control event registration and manages global event parameters. The
51 EventManager controls event dispatch but does \e not control event generation. This is the
52 responsibility of an external component (the Scheduler)
58 //-////////////////////////////////////////////////////////////////////////
62 // Somehow doxygen barfs on this definition
63 template <class Descriptor>
65 : public detail::Callback<typename Descriptor::EventArg>
69 //-////////////////////////////////////////////////////////////////////////
70 ///\name Structors and default members
73 static EventManager & instance();
76 // default default constructor
77 // default copy constructor
78 // default copy assignment
81 // no conversion constructors
84 //-////////////////////////////////////////////////////////////////////////
86 ClockService::clock_type now(); ///< Current time at last event dispatch
87 ClockService::clock_type time(); ///< Expected time of the last event
95 template <class Descriptor>
96 void registerEvent(module::Module & module,
97 typename Callback<Descriptor>::type callback,
98 Descriptor & descriptor);
100 void destroyModule(module::Module & module);
101 void destroyEvent(EventDescriptor & event);
103 typedef boost::ptr_vector<detail::EventBindingBase> EventRegistrations;
104 EventRegistrations registrations_;
106 void eventTime(ClockService::clock_type time);
108 ClockService::clock_type eventTime_;
112 friend class detail::EventBindingBase;
113 friend class module::Module;
114 friend class EventDescriptor;
119 //-/////////////////////////////////////////////////////////////////////////////////////////////////
120 #include "EventManager.cci"
121 #include "EventManager.ct"
122 //#include "EventManager.cti"
129 // comment-column: 40
130 // c-file-style: "senf"
131 // indent-tabs-mode: nil
132 // ispell-local-dictionary: "american"
133 // compile-command: "scons -u test"