Chris@16
|
1 // Boost.Signals library
|
Chris@16
|
2
|
Chris@16
|
3 // Copyright Douglas Gregor 2001-2004. Use, modification and
|
Chris@16
|
4 // distribution is subject to the Boost Software License, Version
|
Chris@16
|
5 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
6 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
7
|
Chris@16
|
8 // For more information, see http://www.boost.org
|
Chris@16
|
9
|
Chris@16
|
10 // This file intentionally does not have include guards, because it is meant
|
Chris@16
|
11 // to be included multiple times (one for each signalN class). The
|
Chris@16
|
12 // BOOST_SIGNALS_SIGNAL_TEMPLATE_HEADER_INCLUDED macro merely serves to
|
Chris@16
|
13 // suppress reinclusion of the files that this header depends on.
|
Chris@16
|
14
|
Chris@16
|
15 #ifndef BOOST_SIGNALS_SIGNAL_TEMPLATE_HEADER_INCLUDED
|
Chris@16
|
16 #define BOOST_SIGNALS_SIGNAL_TEMPLATE_HEADER_INCLUDED
|
Chris@16
|
17 # include <boost/config.hpp>
|
Chris@16
|
18 # include <boost/signals/connection.hpp>
|
Chris@16
|
19 # include <boost/utility.hpp>
|
Chris@16
|
20 # include <boost/ref.hpp>
|
Chris@16
|
21 # include <boost/signals/slot.hpp>
|
Chris@16
|
22 # include <boost/last_value.hpp>
|
Chris@16
|
23 # include <boost/signals/detail/signal_base.hpp>
|
Chris@16
|
24 # include <boost/signals/detail/slot_call_iterator.hpp>
|
Chris@16
|
25 # include <boost/mpl/bool.hpp>
|
Chris@16
|
26 # include <boost/type_traits/is_convertible.hpp>
|
Chris@16
|
27 # include <cassert>
|
Chris@16
|
28 # include <functional>
|
Chris@16
|
29 # include <memory>
|
Chris@16
|
30 #endif // !BOOST_SIGNALS_SIGNAL_TEMPLATE_HEADER_INCLUDED
|
Chris@16
|
31
|
Chris@16
|
32 #ifdef BOOST_HAS_ABI_HEADERS
|
Chris@16
|
33 # include BOOST_ABI_PREFIX
|
Chris@16
|
34 #endif
|
Chris@16
|
35
|
Chris@16
|
36 // Include the appropriate functionN header
|
Chris@16
|
37 #define BOOST_SIGNAL_FUNCTION_N_HEADER BOOST_JOIN(<boost/function/function,BOOST_SIGNALS_NUM_ARGS.hpp>)
|
Chris@16
|
38 #include BOOST_SIGNAL_FUNCTION_N_HEADER
|
Chris@16
|
39
|
Chris@16
|
40 // Determine if a comma should follow a listing of the arguments/parameters
|
Chris@16
|
41 #if BOOST_SIGNALS_NUM_ARGS == 0
|
Chris@16
|
42 # define BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS
|
Chris@16
|
43 #else
|
Chris@16
|
44 # define BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS ,
|
Chris@16
|
45 #endif // BOOST_SIGNALS_NUM_ARGS > 0
|
Chris@16
|
46
|
Chris@16
|
47 // Define class names used
|
Chris@16
|
48 #define BOOST_SIGNALS_SIGNAL BOOST_JOIN(signal,BOOST_SIGNALS_NUM_ARGS)
|
Chris@16
|
49 #define BOOST_SIGNALS_FUNCTION BOOST_JOIN(function,BOOST_SIGNALS_NUM_ARGS)
|
Chris@16
|
50 #define BOOST_SIGNALS_ARGS_STRUCT BOOST_JOIN(args,BOOST_SIGNALS_NUM_ARGS)
|
Chris@16
|
51 #define BOOST_SIGNALS_CALL_BOUND BOOST_JOIN(call_bound,BOOST_SIGNALS_NUM_ARGS)
|
Chris@16
|
52
|
Chris@16
|
53 // Define commonly-used instantiations
|
Chris@16
|
54 #define BOOST_SIGNALS_ARGS_STRUCT_INST \
|
Chris@16
|
55 BOOST_SIGNALS_NAMESPACE::detail::BOOST_SIGNALS_ARGS_STRUCT<BOOST_SIGNALS_TEMPLATE_ARGS>
|
Chris@16
|
56
|
Chris@16
|
57 namespace boost {
|
Chris@16
|
58 namespace BOOST_SIGNALS_NAMESPACE {
|
Chris@16
|
59 namespace detail {
|
Chris@16
|
60 // Holds the arguments for a bound slot call in a single place
|
Chris@16
|
61 template<BOOST_SIGNALS_TEMPLATE_PARMS
|
Chris@16
|
62 BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS
|
Chris@16
|
63 typename Dummy = int>
|
Chris@16
|
64 struct BOOST_SIGNALS_ARGS_STRUCT {
|
Chris@16
|
65 BOOST_SIGNALS_ARGS_STRUCT(BOOST_SIGNALS_COPY_PARMS)
|
Chris@16
|
66 BOOST_SIGNALS_INIT_ARGS
|
Chris@16
|
67 {
|
Chris@16
|
68 }
|
Chris@16
|
69
|
Chris@16
|
70 BOOST_SIGNALS_ARGS_AS_MEMBERS
|
Chris@16
|
71 };
|
Chris@16
|
72
|
Chris@16
|
73 // Function object that calls the function object given to it, passing
|
Chris@16
|
74 // the bound arguments along to that underlying function object
|
Chris@16
|
75 template<typename R>
|
Chris@16
|
76 struct BOOST_SIGNALS_CALL_BOUND {
|
Chris@16
|
77 template<BOOST_SIGNALS_TEMPLATE_PARMS
|
Chris@16
|
78 BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS
|
Chris@16
|
79 typename F>
|
Chris@16
|
80 struct caller {
|
Chris@16
|
81 typedef BOOST_SIGNALS_ARGS_STRUCT<BOOST_SIGNALS_TEMPLATE_ARGS>*
|
Chris@16
|
82 args_type;
|
Chris@16
|
83
|
Chris@16
|
84 args_type args;
|
Chris@16
|
85
|
Chris@16
|
86 typedef R result_type;
|
Chris@16
|
87
|
Chris@16
|
88 caller() {}
|
Chris@16
|
89 caller(args_type a) : args(a) {}
|
Chris@16
|
90
|
Chris@16
|
91 template<typename Pair>
|
Chris@16
|
92 R operator()(const Pair& slot) const
|
Chris@16
|
93 {
|
Chris@16
|
94 F* target = const_cast<F*>(unsafe_any_cast<F>(&slot.second));
|
Chris@16
|
95 return (*target)(BOOST_SIGNALS_BOUND_ARGS);
|
Chris@16
|
96 }
|
Chris@16
|
97 };
|
Chris@16
|
98 };
|
Chris@16
|
99
|
Chris@16
|
100 template<>
|
Chris@16
|
101 struct BOOST_SIGNALS_CALL_BOUND<void> {
|
Chris@16
|
102 template<BOOST_SIGNALS_TEMPLATE_PARMS
|
Chris@16
|
103 BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS
|
Chris@16
|
104 typename F>
|
Chris@16
|
105 struct caller {
|
Chris@16
|
106 typedef BOOST_SIGNALS_ARGS_STRUCT<BOOST_SIGNALS_TEMPLATE_ARGS>*
|
Chris@16
|
107 args_type;
|
Chris@16
|
108
|
Chris@16
|
109 args_type args;
|
Chris@16
|
110
|
Chris@16
|
111 typedef unusable result_type;
|
Chris@16
|
112
|
Chris@16
|
113 caller(args_type a) : args(a) {}
|
Chris@16
|
114
|
Chris@16
|
115 template<typename Pair>
|
Chris@16
|
116 unusable operator()(const Pair& slot) const
|
Chris@16
|
117 {
|
Chris@16
|
118 F* target = const_cast<F*>(unsafe_any_cast<F>(&slot.second));
|
Chris@16
|
119 (*target)(BOOST_SIGNALS_BOUND_ARGS);
|
Chris@16
|
120 return unusable();
|
Chris@16
|
121 }
|
Chris@16
|
122 };
|
Chris@16
|
123 };
|
Chris@16
|
124 } // namespace detail
|
Chris@16
|
125 } // namespace BOOST_SIGNALS_NAMESPACE
|
Chris@16
|
126
|
Chris@16
|
127 // The actual signalN class
|
Chris@16
|
128 template<
|
Chris@16
|
129 typename R,
|
Chris@16
|
130 BOOST_SIGNALS_TEMPLATE_PARMS
|
Chris@16
|
131 BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS
|
Chris@16
|
132 typename Combiner = last_value<R>,
|
Chris@16
|
133 typename Group = int,
|
Chris@16
|
134 typename GroupCompare = std::less<Group>,
|
Chris@16
|
135 typename SlotFunction = BOOST_SIGNALS_FUNCTION<
|
Chris@16
|
136 R BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS
|
Chris@16
|
137 BOOST_SIGNALS_TEMPLATE_ARGS>
|
Chris@16
|
138 >
|
Chris@16
|
139 class BOOST_SIGNALS_SIGNAL :
|
Chris@16
|
140 public BOOST_SIGNALS_NAMESPACE::detail::signal_base, // management of slot list
|
Chris@16
|
141 public BOOST_SIGNALS_NAMESPACE::trackable // signals are trackable
|
Chris@16
|
142 {
|
Chris@16
|
143 public:
|
Chris@16
|
144 // The slot function type
|
Chris@16
|
145 typedef SlotFunction slot_function_type;
|
Chris@16
|
146
|
Chris@16
|
147 // Result type of a slot
|
Chris@16
|
148 typedef typename BOOST_SIGNALS_NAMESPACE::detail::slot_result_type<R>::type
|
Chris@16
|
149 slot_result_type;
|
Chris@16
|
150
|
Chris@16
|
151 // Argument types
|
Chris@16
|
152 BOOST_SIGNALS_ARG_TYPES
|
Chris@16
|
153
|
Chris@16
|
154 #if BOOST_SIGNALS_NUM_ARGS == 1
|
Chris@16
|
155 typedef T1 argument_type;
|
Chris@16
|
156 #elif BOOST_SIGNALS_NUM_ARGS == 2
|
Chris@16
|
157 typedef T1 first_argument_type;
|
Chris@16
|
158 typedef T2 second_argument_type;
|
Chris@16
|
159 #endif
|
Chris@16
|
160
|
Chris@16
|
161 private:
|
Chris@16
|
162 // The real slot name comparison object type
|
Chris@16
|
163 typedef BOOST_SIGNALS_NAMESPACE::detail::group_bridge_compare<GroupCompare, Group>
|
Chris@16
|
164 real_group_compare_type;
|
Chris@16
|
165
|
Chris@16
|
166 // The function object passed to the slot call iterator that will call
|
Chris@16
|
167 // the underlying slot function with its arguments bound
|
Chris@16
|
168 typedef BOOST_SIGNALS_NAMESPACE::detail::BOOST_SIGNALS_CALL_BOUND<R>
|
Chris@16
|
169 outer_bound_slot_caller;
|
Chris@16
|
170 typedef typename outer_bound_slot_caller::template
|
Chris@16
|
171 caller<BOOST_SIGNALS_TEMPLATE_ARGS
|
Chris@16
|
172 BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS
|
Chris@16
|
173 slot_function_type>
|
Chris@16
|
174 call_bound_slot;
|
Chris@16
|
175
|
Chris@16
|
176 public:
|
Chris@16
|
177 // Combiner's result type
|
Chris@16
|
178 typedef typename Combiner::result_type result_type;
|
Chris@16
|
179
|
Chris@16
|
180 // Combiner type
|
Chris@16
|
181 typedef Combiner combiner_type;
|
Chris@16
|
182
|
Chris@16
|
183 // Slot type
|
Chris@16
|
184 typedef slot<slot_function_type> slot_type;
|
Chris@16
|
185
|
Chris@16
|
186 // Slot name type and comparison
|
Chris@16
|
187 typedef Group group_type;
|
Chris@16
|
188 typedef GroupCompare group_compare_type;
|
Chris@16
|
189
|
Chris@16
|
190 typedef BOOST_SIGNALS_NAMESPACE::detail::slot_call_iterator<
|
Chris@16
|
191 call_bound_slot, iterator> slot_call_iterator;
|
Chris@16
|
192
|
Chris@16
|
193 explicit
|
Chris@16
|
194 BOOST_SIGNALS_SIGNAL(const Combiner& c = Combiner(),
|
Chris@16
|
195 const GroupCompare& comp = GroupCompare()) :
|
Chris@16
|
196 BOOST_SIGNALS_NAMESPACE::detail::signal_base(real_group_compare_type(comp),
|
Chris@16
|
197 c)
|
Chris@16
|
198 {
|
Chris@16
|
199 }
|
Chris@16
|
200
|
Chris@16
|
201 // Connect a slot to this signal
|
Chris@16
|
202 BOOST_SIGNALS_NAMESPACE::connection
|
Chris@16
|
203 connect(const slot_type&,
|
Chris@16
|
204 BOOST_SIGNALS_NAMESPACE::connect_position at
|
Chris@16
|
205 = BOOST_SIGNALS_NAMESPACE::at_back);
|
Chris@16
|
206
|
Chris@16
|
207
|
Chris@16
|
208 BOOST_SIGNALS_NAMESPACE::connection
|
Chris@16
|
209 connect(const group_type&, const slot_type&,
|
Chris@16
|
210 BOOST_SIGNALS_NAMESPACE::connect_position at
|
Chris@16
|
211 = BOOST_SIGNALS_NAMESPACE::at_back);
|
Chris@16
|
212
|
Chris@16
|
213 #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
Chris@16
|
214 // MSVC 6.0 and 7.0 don't handle the is_convertible test well
|
Chris@16
|
215 void disconnect(const group_type& group)
|
Chris@16
|
216 {
|
Chris@16
|
217 impl->disconnect(group);
|
Chris@16
|
218 }
|
Chris@16
|
219 #else
|
Chris@16
|
220 template<typename T>
|
Chris@16
|
221 void disconnect(const T& t)
|
Chris@16
|
222 {
|
Chris@16
|
223 typedef mpl::bool_<(is_convertible<T, group_type>::value)> is_group;
|
Chris@16
|
224 this->do_disconnect(t, is_group());
|
Chris@16
|
225 }
|
Chris@16
|
226
|
Chris@16
|
227 private:
|
Chris@16
|
228 // Disconnect a named slot
|
Chris@16
|
229 void do_disconnect(const group_type& group, mpl::bool_<true>)
|
Chris@16
|
230 {
|
Chris@16
|
231 impl->disconnect(group);
|
Chris@16
|
232 }
|
Chris@16
|
233
|
Chris@16
|
234 template<typename Function>
|
Chris@16
|
235 void do_disconnect(const Function& f, mpl::bool_<false>)
|
Chris@16
|
236 {
|
Chris@16
|
237 // Notify the slot handling code that we are iterating through the slots
|
Chris@16
|
238 BOOST_SIGNALS_NAMESPACE::detail::call_notification notification(this->impl);
|
Chris@16
|
239
|
Chris@16
|
240 for (iterator i = impl->slots_.begin(); i != impl->slots_.end(); ++i) {
|
Chris@16
|
241 slot_function_type& s = *unsafe_any_cast<slot_function_type>(&i->second);
|
Chris@16
|
242 if (s == f) i->first.disconnect();
|
Chris@16
|
243 }
|
Chris@16
|
244 }
|
Chris@16
|
245 #endif
|
Chris@16
|
246
|
Chris@16
|
247 public:
|
Chris@16
|
248
|
Chris@16
|
249 // Emit the signal
|
Chris@16
|
250 result_type operator()(BOOST_SIGNALS_PARMS);
|
Chris@16
|
251 result_type operator()(BOOST_SIGNALS_PARMS) const;
|
Chris@16
|
252
|
Chris@16
|
253 Combiner& combiner()
|
Chris@16
|
254 { return *unsafe_any_cast<Combiner>(&impl->combiner_); }
|
Chris@16
|
255
|
Chris@16
|
256 const Combiner& combiner() const
|
Chris@16
|
257 { return *unsafe_any_cast<const Combiner>(&impl->combiner_); }
|
Chris@16
|
258 };
|
Chris@16
|
259
|
Chris@16
|
260 template<
|
Chris@16
|
261 typename R,
|
Chris@16
|
262 BOOST_SIGNALS_TEMPLATE_PARMS
|
Chris@16
|
263 BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS
|
Chris@16
|
264 typename Combiner,
|
Chris@16
|
265 typename Group,
|
Chris@16
|
266 typename GroupCompare,
|
Chris@16
|
267 typename SlotFunction
|
Chris@16
|
268 >
|
Chris@16
|
269 BOOST_SIGNALS_NAMESPACE::connection
|
Chris@16
|
270 BOOST_SIGNALS_SIGNAL<
|
Chris@16
|
271 R, BOOST_SIGNALS_TEMPLATE_ARGS
|
Chris@16
|
272 BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS
|
Chris@16
|
273 Combiner, Group, GroupCompare, SlotFunction
|
Chris@16
|
274 >::connect(const slot_type& in_slot,
|
Chris@16
|
275 BOOST_SIGNALS_NAMESPACE::connect_position at)
|
Chris@16
|
276 {
|
Chris@16
|
277 using boost::BOOST_SIGNALS_NAMESPACE::detail::stored_group;
|
Chris@16
|
278
|
Chris@16
|
279 // If the slot has been disconnected, just return a disconnected
|
Chris@16
|
280 // connection
|
Chris@16
|
281 if (!in_slot.is_active()) {
|
Chris@16
|
282 return BOOST_SIGNALS_NAMESPACE::connection();
|
Chris@16
|
283 }
|
Chris@16
|
284
|
Chris@16
|
285 return impl->connect_slot(in_slot.get_slot_function(), stored_group(),
|
Chris@16
|
286 in_slot.get_data(), at);
|
Chris@16
|
287 }
|
Chris@16
|
288
|
Chris@16
|
289 template<
|
Chris@16
|
290 typename R,
|
Chris@16
|
291 BOOST_SIGNALS_TEMPLATE_PARMS
|
Chris@16
|
292 BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS
|
Chris@16
|
293 typename Combiner,
|
Chris@16
|
294 typename Group,
|
Chris@16
|
295 typename GroupCompare,
|
Chris@16
|
296 typename SlotFunction
|
Chris@16
|
297 >
|
Chris@16
|
298 BOOST_SIGNALS_NAMESPACE::connection
|
Chris@16
|
299 BOOST_SIGNALS_SIGNAL<
|
Chris@16
|
300 R, BOOST_SIGNALS_TEMPLATE_ARGS
|
Chris@16
|
301 BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS
|
Chris@16
|
302 Combiner, Group, GroupCompare, SlotFunction
|
Chris@16
|
303 >::connect(const group_type& group,
|
Chris@16
|
304 const slot_type& in_slot,
|
Chris@16
|
305 BOOST_SIGNALS_NAMESPACE::connect_position at)
|
Chris@16
|
306 {
|
Chris@16
|
307 // If the slot has been disconnected, just return a disconnected
|
Chris@16
|
308 // connection
|
Chris@16
|
309 if (!in_slot.is_active()) {
|
Chris@16
|
310 return BOOST_SIGNALS_NAMESPACE::connection();
|
Chris@16
|
311 }
|
Chris@16
|
312
|
Chris@16
|
313 return impl->connect_slot(in_slot.get_slot_function(), group,
|
Chris@16
|
314 in_slot.get_data(), at);
|
Chris@16
|
315 }
|
Chris@16
|
316
|
Chris@16
|
317 template<
|
Chris@16
|
318 typename R,
|
Chris@16
|
319 BOOST_SIGNALS_TEMPLATE_PARMS
|
Chris@16
|
320 BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS
|
Chris@16
|
321 typename Combiner,
|
Chris@16
|
322 typename Group,
|
Chris@16
|
323 typename GroupCompare,
|
Chris@16
|
324 typename SlotFunction
|
Chris@16
|
325 >
|
Chris@16
|
326 typename BOOST_SIGNALS_SIGNAL<
|
Chris@16
|
327 R, BOOST_SIGNALS_TEMPLATE_ARGS
|
Chris@16
|
328 BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS
|
Chris@16
|
329 Combiner, Group, GroupCompare, SlotFunction>::result_type
|
Chris@16
|
330 BOOST_SIGNALS_SIGNAL<
|
Chris@16
|
331 R, BOOST_SIGNALS_TEMPLATE_ARGS
|
Chris@16
|
332 BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS
|
Chris@16
|
333 Combiner, Group, GroupCompare, SlotFunction
|
Chris@16
|
334 >::operator()(BOOST_SIGNALS_PARMS)
|
Chris@16
|
335 {
|
Chris@16
|
336 // Notify the slot handling code that we are making a call
|
Chris@16
|
337 BOOST_SIGNALS_NAMESPACE::detail::call_notification notification(this->impl);
|
Chris@16
|
338
|
Chris@16
|
339 // Construct a function object that will call the underlying slots
|
Chris@16
|
340 // with the given arguments.
|
Chris@16
|
341 #if BOOST_SIGNALS_NUM_ARGS == 0
|
Chris@16
|
342 BOOST_SIGNALS_ARGS_STRUCT_INST args;
|
Chris@16
|
343 #else
|
Chris@16
|
344 BOOST_SIGNALS_ARGS_STRUCT_INST args(BOOST_SIGNALS_ARGS);
|
Chris@16
|
345 #endif // BOOST_SIGNALS_NUM_ARGS > 0
|
Chris@16
|
346 call_bound_slot f(&args);
|
Chris@16
|
347
|
Chris@16
|
348 typedef typename call_bound_slot::result_type call_result_type;
|
Chris@16
|
349 optional<call_result_type> cache;
|
Chris@16
|
350 // Let the combiner call the slots via a pair of input iterators
|
Chris@16
|
351 return combiner()(slot_call_iterator(notification.impl->slots_.begin(),
|
Chris@16
|
352 impl->slots_.end(), f, cache),
|
Chris@16
|
353 slot_call_iterator(notification.impl->slots_.end(),
|
Chris@16
|
354 impl->slots_.end(), f, cache));
|
Chris@16
|
355 }
|
Chris@16
|
356
|
Chris@16
|
357 template<
|
Chris@16
|
358 typename R,
|
Chris@16
|
359 BOOST_SIGNALS_TEMPLATE_PARMS
|
Chris@16
|
360 BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS
|
Chris@16
|
361 typename Combiner,
|
Chris@16
|
362 typename Group,
|
Chris@16
|
363 typename GroupCompare,
|
Chris@16
|
364 typename SlotFunction
|
Chris@16
|
365 >
|
Chris@16
|
366 typename BOOST_SIGNALS_SIGNAL<
|
Chris@16
|
367 R, BOOST_SIGNALS_TEMPLATE_ARGS
|
Chris@16
|
368 BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS
|
Chris@16
|
369 Combiner, Group, GroupCompare, SlotFunction>::result_type
|
Chris@16
|
370 BOOST_SIGNALS_SIGNAL<
|
Chris@16
|
371 R, BOOST_SIGNALS_TEMPLATE_ARGS
|
Chris@16
|
372 BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS
|
Chris@16
|
373 Combiner, Group, GroupCompare, SlotFunction
|
Chris@16
|
374 >::operator()(BOOST_SIGNALS_PARMS) const
|
Chris@16
|
375 {
|
Chris@16
|
376 // Notify the slot handling code that we are making a call
|
Chris@16
|
377 BOOST_SIGNALS_NAMESPACE::detail::call_notification notification(this->impl);
|
Chris@16
|
378
|
Chris@16
|
379 // Construct a function object that will call the underlying slots
|
Chris@16
|
380 // with the given arguments.
|
Chris@16
|
381 #if BOOST_SIGNALS_NUM_ARGS == 0
|
Chris@16
|
382 BOOST_SIGNALS_ARGS_STRUCT_INST args;
|
Chris@16
|
383 #else
|
Chris@16
|
384 BOOST_SIGNALS_ARGS_STRUCT_INST args(BOOST_SIGNALS_ARGS);
|
Chris@16
|
385 #endif // BOOST_SIGNALS_NUM_ARGS > 0
|
Chris@16
|
386
|
Chris@16
|
387 call_bound_slot f(&args);
|
Chris@16
|
388
|
Chris@16
|
389 typedef typename call_bound_slot::result_type call_result_type;
|
Chris@16
|
390 optional<call_result_type> cache;
|
Chris@16
|
391
|
Chris@16
|
392 // Let the combiner call the slots via a pair of input iterators
|
Chris@16
|
393 return combiner()(slot_call_iterator(notification.impl->slots_.begin(),
|
Chris@16
|
394 impl->slots_.end(), f, cache),
|
Chris@16
|
395 slot_call_iterator(notification.impl->slots_.end(),
|
Chris@16
|
396 impl->slots_.end(), f, cache));
|
Chris@16
|
397 }
|
Chris@16
|
398 } // namespace boost
|
Chris@16
|
399
|
Chris@16
|
400 #undef BOOST_SIGNAL_FUNCTION_N_HEADER
|
Chris@16
|
401 #undef BOOST_SIGNALS_ARGS_STRUCT_INST
|
Chris@16
|
402 #undef BOOST_SIGNALS_CALL_BOUND
|
Chris@16
|
403 #undef BOOST_SIGNALS_ARGS_STRUCT
|
Chris@16
|
404 #undef BOOST_SIGNALS_FUNCTION
|
Chris@16
|
405 #undef BOOST_SIGNALS_SIGNAL
|
Chris@16
|
406 #undef BOOST_SIGNALS_COMMA_IF_NONZERO_ARGS
|
Chris@16
|
407
|
Chris@16
|
408 #ifdef BOOST_HAS_ABI_HEADERS
|
Chris@16
|
409 # include BOOST_ABI_SUFFIX
|
Chris@16
|
410 #endif
|