removed some useless spaces; not very important, I know :)
[senf.git] / PPI / Events.cti
1 // $Id$
2 //
3 // Copyright (C) 2007
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 Events inline template implementation */
25
26 #include "Events.ih"
27
28 // Custom includes
29 #include "../Utils/senfassert.hh"
30 #include "detail/EventBinding.hh"
31
32 #define prefix_ inline
33 ///////////////////////////////cti.p///////////////////////////////////////
34
35 ///////////////////////////////////////////////////////////////////////////
36 // senf::ppi::EventImplementationHelper<EventType,Self>
37
38 ////////////////////////////////////////
39 // protected members
40
41 template <class EventType, class Self>
42 prefix_ void
43 senf::ppi::EventImplementationHelper<EventType,Self>::callback(EventArg event,
44                                                                ClockService::clock_type time)
45 {
46     binding().callback(event,time);
47 }
48
49 template <class EventType, class Self>
50 prefix_ void senf::ppi::EventImplementationHelper<EventType,Self>::callback(EventArg event)
51 {
52     binding().callback(event);
53 }
54
55 ////////////////////////////////////////
56 // private members
57
58 template <class EventType, class Self>
59 prefix_ senf::ppi::detail::EventBinding<EventType> &
60 senf::ppi::EventImplementationHelper<EventType,Self>::binding()
61 {
62     SENF_ASSERT( static_cast<Self*>(this)->binding_ );
63     return * static_cast<Self*>(this)->binding_;
64 }
65
66 ///////////////////////////////////////////////////////////////////////////
67 // senf::ppi::EventImplementationHelper<void,Self>
68
69 ////////////////////////////////////////
70 // protected members
71
72 template <class Self>
73 prefix_ void
74 senf::ppi::EventImplementationHelper<void,Self>::callback(ClockService::clock_type time)
75 {
76     binding().callback(time);
77 }
78
79 template <class Self>
80 prefix_ void senf::ppi::EventImplementationHelper<void,Self>::callback()
81 {
82     binding().callback();
83 }
84
85 ////////////////////////////////////////
86 // private members
87
88 template <class Self>
89 prefix_ senf::ppi::detail::EventBinding<void> &
90 senf::ppi::EventImplementationHelper<void,Self>::binding()
91 {
92     SENF_ASSERT( static_cast<Self*>(this)->binding_ );
93     return * static_cast<Self*>(this)->binding_;
94 }
95
96 ///////////////////////////////////////////////////////////////////////////
97 // senf::ppi::EventImplementation<EventType>
98
99 template <class EventType>
100 prefix_ senf::ppi::module::Module & senf::ppi::EventImplementation<EventType>::module()
101     const
102 {
103     return binding_->module();
104 }
105
106 template <class EventType>
107 prefix_ senf::ppi::EventManager & senf::ppi::EventImplementation<EventType>::manager()
108     const
109 {
110     return binding_->manager();
111 }
112
113 ////////////////////////////////////////
114 // protected members
115
116 template <class EventType>
117 prefix_ senf::ppi::EventImplementation<EventType>::EventImplementation()
118     : binding_(0)
119 {}
120
121 ////////////////////////////////////////
122 // private members
123
124 template <class EventType>
125 prefix_ bool senf::ppi::EventImplementation<EventType>::v_isRegistered()
126 {
127     return binding_;
128 }
129
130 template <class EventType>
131 prefix_ void
132 senf::ppi::EventImplementation<EventType>::setBinding(detail::EventBinding<Event> & binding)
133 {
134     binding_ = & binding;
135 }
136
137 ///////////////////////////////cti.e///////////////////////////////////////
138 #undef prefix_
139
140 \f
141 // Local Variables:
142 // mode: c++
143 // fill-column: 100
144 // comment-column: 40
145 // c-file-style: "senf"
146 // indent-tabs-mode: nil
147 // ispell-local-dictionary: "american"
148 // compile-command: "scons -u test"
149 // End: