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 EventBinding public header */
31 #ifndef HH_SENF_PPI_detail_EventBinding_
32 #define HH_SENF_PPI_detail_EventBinding_ 1
35 #include <senf/Scheduler/ClockService.hh>
36 #include <senf/PPI/predecl.hh>
37 #include "Callback.hh"
39 //#include "EventBinding.mpp"
40 //-/////////////////////////////////////////////////////////////////////////////////////////////////
46 /** \brief Internal: Association Event - Module - Handler, base-class */
47 class EventBindingBase
52 EventManager & manager() const;
53 module::Module & module() const;
56 EventBindingBase(EventManager & manager, module::Module & module,
57 EventDescriptor & descriptor);
59 void eventTime(ClockService::clock_type time);
62 EventManager * manager_;
63 module::Module * module_;
64 EventDescriptor * descriptor_;
66 friend class senf::ppi::EventManager;
67 friend class senf::ppi::EventDescriptor;
70 /** \brief Internal: Callback forwarders
72 template <class EventType, class Self>
73 class EventBindingHelper
76 typedef typename detail::EventArgType<EventType>::type EventArg;
78 void callback(EventArg event, ClockService::clock_type time);
79 void callback(EventArg event);
88 class EventBindingHelper<void,Self>
91 void callback(ClockService::clock_type time);
100 /** \brief Internal: Association Event - Module - Handler, event type specific */
101 template <class EventType>
103 : public EventBindingBase,
104 public EventBindingHelper<EventType, EventBinding<EventType> >
107 typedef EventType Event;
108 typedef typename detail::EventArgType<Event>::type EventArg;
109 typedef typename detail::Callback<EventArg>::type Callback;
111 EventBinding(EventManager & manager, module::Module & module, Callback callback,
112 EventDescriptor & descriptor);
117 friend class EventBindingHelper<EventType, EventBinding<EventType> >;
122 //-/////////////////////////////////////////////////////////////////////////////////////////////////
123 #include "EventBinding.cci"
124 //#include "EventBinding.ct"
125 #include "EventBinding.cti"
132 // comment-column: 40
133 // c-file-style: "senf"
134 // indent-tabs-mode: nil
135 // ispell-local-dictionary: "american"
136 // compile-command: "scons -u ../test"