2 /* Do not edit! -- generated file */
3 #ifndef _SIGC_FUNCTORS_MACROS_SLOTHM4_
4 #define _SIGC_FUNCTORS_MACROS_SLOTHM4_
5 #include <sigc++/trackable.h>
6 #include <sigc++/visit_each.h>
7 #include <sigc++/adaptors/adaptor_trait.h>
8 #include <sigc++/functors/slot_base.h>
15 * A typed slot_rep holds a functor that can be invoked from
16 * slot::operator()(). visit_each() is used to visit the functor's
17 * targets that inherit trackable recursively and register the
18 * notification callback. Consequently the slot_rep object will be
19 * notified when some referred object is destroyed or overwritten.
21 template <class T_functor>
22 struct typed_slot_rep : public slot_rep
24 typedef typed_slot_rep<T_functor> self;
26 /* Use an adaptor type so that arguments can be passed as const references
27 * through explicit template instantiation from slot_call#::call_it() */
28 typedef typename adaptor_trait<T_functor>::adaptor_type adaptor_type;
30 /** The functor contained by this slot_rep object. */
31 adaptor_type functor_;
33 /** Constructs an invalid typed slot_rep object.
34 * The notification callback is registered using visit_each().
35 * @param functor The functor contained by the new slot_rep object.
37 inline typed_slot_rep(const T_functor& functor)
38 : slot_rep(0, &destroy, &dup), functor_(functor)
39 { visit_each_type<trackable*>(slot_do_bind(this), functor_); }
41 inline typed_slot_rep(const typed_slot_rep& cl)
42 : slot_rep(cl.call_, &destroy, &dup), functor_(cl.functor_)
43 { visit_each_type<trackable*>(slot_do_bind(this), functor_); }
45 inline ~typed_slot_rep()
49 visit_each_type<trackable*>(slot_do_unbind(this), functor_);
52 /** Detaches the stored functor from the other referred trackables and destroys it.
53 * This does not destroy the base slot_rep object.
55 static void* destroy(void* data)
57 self* self_ = static_cast<self*>((slot_rep*)data);
60 visit_each_type<trackable*>(slot_do_unbind(self_), self_->functor_);
61 self_->functor_.~adaptor_type();
62 /* don't call disconnect() here: destroy() is either called
63 * a) from the parent itself (in which case disconnect() leads to a segfault) or
64 * b) from a parentless slot (in which case disconnect() does nothing)
69 /** Makes a deep copy of the slot_rep object.
70 * Deep copy means that the notification callback of the new
71 * slot_rep object is registered in the referred trackables.
72 * @return A deep copy of the slot_rep object.
74 static void* dup(void* data)
76 slot_rep* rep_ = (slot_rep*)data;
77 return static_cast<slot_rep*>(new self(*static_cast<self*>(rep_)));
82 /** Abstracts functor execution.
83 * call_it() invokes a functor of type @e T_functor with a list of
84 * parameters whose types are given by the template arguments.
85 * address() forms a function pointer from call_it().
87 * The following template arguments are used:
88 * - @e T_functor The functor type.
89 * - @e T_return The return type of call_it().
92 template<class T_functor, class T_return>
95 /** Invokes a functor of type @p T_functor.
96 * @param rep slot_rep object that holds a functor of type @p T_functor.
97 * @return The return values of the functor invocation.
99 static T_return call_it(slot_rep* rep)
101 typedef typed_slot_rep<T_functor> typed_slot;
102 typed_slot *typed_rep = static_cast<typed_slot*>(rep);
103 return (typed_rep->functor_)();
106 /** Forms a function pointer from call_it().
107 * @return A function pointer formed from call_it().
109 static hook address()
110 { return reinterpret_cast<hook>(&call_it); }
113 /** Abstracts functor execution.
114 * call_it() invokes a functor of type @e T_functor with a list of
115 * parameters whose types are given by the template arguments.
116 * address() forms a function pointer from call_it().
118 * The following template arguments are used:
119 * - @e T_functor The functor type.
120 * - @e T_return The return type of call_it().
121 * - @e T_arg1 Argument type used in the definition of call_it().
124 template<class T_functor, class T_return, class T_arg1>
127 /** Invokes a functor of type @p T_functor.
128 * @param rep slot_rep object that holds a functor of type @p T_functor.
129 * @param _A_a1 Argument to be passed on to the functor.
130 * @return The return values of the functor invocation.
132 static T_return call_it(slot_rep* rep, typename type_trait<T_arg1>::take a_1)
134 typedef typed_slot_rep<T_functor> typed_slot;
135 typed_slot *typed_rep = static_cast<typed_slot*>(rep);
136 return (typed_rep->functor_).SIGC_WORKAROUND_OPERATOR_PARENTHESES<typename type_trait<T_arg1>::take>
140 /** Forms a function pointer from call_it().
141 * @return A function pointer formed from call_it().
143 static hook address()
144 { return reinterpret_cast<hook>(&call_it); }
147 /** Abstracts functor execution.
148 * call_it() invokes a functor of type @e T_functor with a list of
149 * parameters whose types are given by the template arguments.
150 * address() forms a function pointer from call_it().
152 * The following template arguments are used:
153 * - @e T_functor The functor type.
154 * - @e T_return The return type of call_it().
155 * - @e T_arg1 Argument type used in the definition of call_it().
156 * - @e T_arg2 Argument type used in the definition of call_it().
159 template<class T_functor, class T_return, class T_arg1,class T_arg2>
162 /** Invokes a functor of type @p T_functor.
163 * @param rep slot_rep object that holds a functor of type @p T_functor.
164 * @param _A_a1 Argument to be passed on to the functor.
165 * @param _A_a2 Argument to be passed on to the functor.
166 * @return The return values of the functor invocation.
168 static T_return call_it(slot_rep* rep, typename type_trait<T_arg1>::take a_1,typename type_trait<T_arg2>::take a_2)
170 typedef typed_slot_rep<T_functor> typed_slot;
171 typed_slot *typed_rep = static_cast<typed_slot*>(rep);
172 return (typed_rep->functor_).SIGC_WORKAROUND_OPERATOR_PARENTHESES<typename type_trait<T_arg1>::take,typename type_trait<T_arg2>::take>
176 /** Forms a function pointer from call_it().
177 * @return A function pointer formed from call_it().
179 static hook address()
180 { return reinterpret_cast<hook>(&call_it); }
183 /** Abstracts functor execution.
184 * call_it() invokes a functor of type @e T_functor with a list of
185 * parameters whose types are given by the template arguments.
186 * address() forms a function pointer from call_it().
188 * The following template arguments are used:
189 * - @e T_functor The functor type.
190 * - @e T_return The return type of call_it().
191 * - @e T_arg1 Argument type used in the definition of call_it().
192 * - @e T_arg2 Argument type used in the definition of call_it().
193 * - @e T_arg3 Argument type used in the definition of call_it().
196 template<class T_functor, class T_return, class T_arg1,class T_arg2,class T_arg3>
199 /** Invokes a functor of type @p T_functor.
200 * @param rep slot_rep object that holds a functor of type @p T_functor.
201 * @param _A_a1 Argument to be passed on to the functor.
202 * @param _A_a2 Argument to be passed on to the functor.
203 * @param _A_a3 Argument to be passed on to the functor.
204 * @return The return values of the functor invocation.
206 static T_return call_it(slot_rep* rep, typename type_trait<T_arg1>::take a_1,typename type_trait<T_arg2>::take a_2,typename type_trait<T_arg3>::take a_3)
208 typedef typed_slot_rep<T_functor> typed_slot;
209 typed_slot *typed_rep = static_cast<typed_slot*>(rep);
210 return (typed_rep->functor_).SIGC_WORKAROUND_OPERATOR_PARENTHESES<typename type_trait<T_arg1>::take,typename type_trait<T_arg2>::take,typename type_trait<T_arg3>::take>
214 /** Forms a function pointer from call_it().
215 * @return A function pointer formed from call_it().
217 static hook address()
218 { return reinterpret_cast<hook>(&call_it); }
221 /** Abstracts functor execution.
222 * call_it() invokes a functor of type @e T_functor with a list of
223 * parameters whose types are given by the template arguments.
224 * address() forms a function pointer from call_it().
226 * The following template arguments are used:
227 * - @e T_functor The functor type.
228 * - @e T_return The return type of call_it().
229 * - @e T_arg1 Argument type used in the definition of call_it().
230 * - @e T_arg2 Argument type used in the definition of call_it().
231 * - @e T_arg3 Argument type used in the definition of call_it().
232 * - @e T_arg4 Argument type used in the definition of call_it().
235 template<class T_functor, class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4>
238 /** Invokes a functor of type @p T_functor.
239 * @param rep slot_rep object that holds a functor of type @p T_functor.
240 * @param _A_a1 Argument to be passed on to the functor.
241 * @param _A_a2 Argument to be passed on to the functor.
242 * @param _A_a3 Argument to be passed on to the functor.
243 * @param _A_a4 Argument to be passed on to the functor.
244 * @return The return values of the functor invocation.
246 static T_return call_it(slot_rep* rep, typename type_trait<T_arg1>::take a_1,typename type_trait<T_arg2>::take a_2,typename type_trait<T_arg3>::take a_3,typename type_trait<T_arg4>::take a_4)
248 typedef typed_slot_rep<T_functor> typed_slot;
249 typed_slot *typed_rep = static_cast<typed_slot*>(rep);
250 return (typed_rep->functor_).SIGC_WORKAROUND_OPERATOR_PARENTHESES<typename type_trait<T_arg1>::take,typename type_trait<T_arg2>::take,typename type_trait<T_arg3>::take,typename type_trait<T_arg4>::take>
254 /** Forms a function pointer from call_it().
255 * @return A function pointer formed from call_it().
257 static hook address()
258 { return reinterpret_cast<hook>(&call_it); }
261 /** Abstracts functor execution.
262 * call_it() invokes a functor of type @e T_functor with a list of
263 * parameters whose types are given by the template arguments.
264 * address() forms a function pointer from call_it().
266 * The following template arguments are used:
267 * - @e T_functor The functor type.
268 * - @e T_return The return type of call_it().
269 * - @e T_arg1 Argument type used in the definition of call_it().
270 * - @e T_arg2 Argument type used in the definition of call_it().
271 * - @e T_arg3 Argument type used in the definition of call_it().
272 * - @e T_arg4 Argument type used in the definition of call_it().
273 * - @e T_arg5 Argument type used in the definition of call_it().
276 template<class T_functor, class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5>
279 /** Invokes a functor of type @p T_functor.
280 * @param rep slot_rep object that holds a functor of type @p T_functor.
281 * @param _A_a1 Argument to be passed on to the functor.
282 * @param _A_a2 Argument to be passed on to the functor.
283 * @param _A_a3 Argument to be passed on to the functor.
284 * @param _A_a4 Argument to be passed on to the functor.
285 * @param _A_a5 Argument to be passed on to the functor.
286 * @return The return values of the functor invocation.
288 static T_return call_it(slot_rep* rep, typename type_trait<T_arg1>::take a_1,typename type_trait<T_arg2>::take a_2,typename type_trait<T_arg3>::take a_3,typename type_trait<T_arg4>::take a_4,typename type_trait<T_arg5>::take a_5)
290 typedef typed_slot_rep<T_functor> typed_slot;
291 typed_slot *typed_rep = static_cast<typed_slot*>(rep);
292 return (typed_rep->functor_).SIGC_WORKAROUND_OPERATOR_PARENTHESES<typename type_trait<T_arg1>::take,typename type_trait<T_arg2>::take,typename type_trait<T_arg3>::take,typename type_trait<T_arg4>::take,typename type_trait<T_arg5>::take>
293 (a_1,a_2,a_3,a_4,a_5);
296 /** Forms a function pointer from call_it().
297 * @return A function pointer formed from call_it().
299 static hook address()
300 { return reinterpret_cast<hook>(&call_it); }
303 /** Abstracts functor execution.
304 * call_it() invokes a functor of type @e T_functor with a list of
305 * parameters whose types are given by the template arguments.
306 * address() forms a function pointer from call_it().
308 * The following template arguments are used:
309 * - @e T_functor The functor type.
310 * - @e T_return The return type of call_it().
311 * - @e T_arg1 Argument type used in the definition of call_it().
312 * - @e T_arg2 Argument type used in the definition of call_it().
313 * - @e T_arg3 Argument type used in the definition of call_it().
314 * - @e T_arg4 Argument type used in the definition of call_it().
315 * - @e T_arg5 Argument type used in the definition of call_it().
316 * - @e T_arg6 Argument type used in the definition of call_it().
319 template<class T_functor, class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5,class T_arg6>
322 /** Invokes a functor of type @p T_functor.
323 * @param rep slot_rep object that holds a functor of type @p T_functor.
324 * @param _A_a1 Argument to be passed on to the functor.
325 * @param _A_a2 Argument to be passed on to the functor.
326 * @param _A_a3 Argument to be passed on to the functor.
327 * @param _A_a4 Argument to be passed on to the functor.
328 * @param _A_a5 Argument to be passed on to the functor.
329 * @param _A_a6 Argument to be passed on to the functor.
330 * @return The return values of the functor invocation.
332 static T_return call_it(slot_rep* rep, typename type_trait<T_arg1>::take a_1,typename type_trait<T_arg2>::take a_2,typename type_trait<T_arg3>::take a_3,typename type_trait<T_arg4>::take a_4,typename type_trait<T_arg5>::take a_5,typename type_trait<T_arg6>::take a_6)
334 typedef typed_slot_rep<T_functor> typed_slot;
335 typed_slot *typed_rep = static_cast<typed_slot*>(rep);
336 return (typed_rep->functor_).SIGC_WORKAROUND_OPERATOR_PARENTHESES<typename type_trait<T_arg1>::take,typename type_trait<T_arg2>::take,typename type_trait<T_arg3>::take,typename type_trait<T_arg4>::take,typename type_trait<T_arg5>::take,typename type_trait<T_arg6>::take>
337 (a_1,a_2,a_3,a_4,a_5,a_6);
340 /** Forms a function pointer from call_it().
341 * @return A function pointer formed from call_it().
343 static hook address()
344 { return reinterpret_cast<hook>(&call_it); }
347 /** Abstracts functor execution.
348 * call_it() invokes a functor of type @e T_functor with a list of
349 * parameters whose types are given by the template arguments.
350 * address() forms a function pointer from call_it().
352 * The following template arguments are used:
353 * - @e T_functor The functor type.
354 * - @e T_return The return type of call_it().
355 * - @e T_arg1 Argument type used in the definition of call_it().
356 * - @e T_arg2 Argument type used in the definition of call_it().
357 * - @e T_arg3 Argument type used in the definition of call_it().
358 * - @e T_arg4 Argument type used in the definition of call_it().
359 * - @e T_arg5 Argument type used in the definition of call_it().
360 * - @e T_arg6 Argument type used in the definition of call_it().
361 * - @e T_arg7 Argument type used in the definition of call_it().
364 template<class T_functor, class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5,class T_arg6,class T_arg7>
367 /** Invokes a functor of type @p T_functor.
368 * @param rep slot_rep object that holds a functor of type @p T_functor.
369 * @param _A_a1 Argument to be passed on to the functor.
370 * @param _A_a2 Argument to be passed on to the functor.
371 * @param _A_a3 Argument to be passed on to the functor.
372 * @param _A_a4 Argument to be passed on to the functor.
373 * @param _A_a5 Argument to be passed on to the functor.
374 * @param _A_a6 Argument to be passed on to the functor.
375 * @param _A_a7 Argument to be passed on to the functor.
376 * @return The return values of the functor invocation.
378 static T_return call_it(slot_rep* rep, typename type_trait<T_arg1>::take a_1,typename type_trait<T_arg2>::take a_2,typename type_trait<T_arg3>::take a_3,typename type_trait<T_arg4>::take a_4,typename type_trait<T_arg5>::take a_5,typename type_trait<T_arg6>::take a_6,typename type_trait<T_arg7>::take a_7)
380 typedef typed_slot_rep<T_functor> typed_slot;
381 typed_slot *typed_rep = static_cast<typed_slot*>(rep);
382 return (typed_rep->functor_).SIGC_WORKAROUND_OPERATOR_PARENTHESES<typename type_trait<T_arg1>::take,typename type_trait<T_arg2>::take,typename type_trait<T_arg3>::take,typename type_trait<T_arg4>::take,typename type_trait<T_arg5>::take,typename type_trait<T_arg6>::take,typename type_trait<T_arg7>::take>
383 (a_1,a_2,a_3,a_4,a_5,a_6,a_7);
386 /** Forms a function pointer from call_it().
387 * @return A function pointer formed from call_it().
389 static hook address()
390 { return reinterpret_cast<hook>(&call_it); }
393 } /* namespace internal */
396 /** Converts an arbitrary functor to a unified type which is opaque.
397 * sigc::slot itself is a functor or to be more precise a closure. It contains
398 * a single, arbitrary functor (or closure) that is executed in operator()().
400 * The template arguments determine the function signature of operator()():
401 * - @e T_return The return type of operator()().
403 * To use simply assign the slot to the desired functor. If the functor
404 * is not compatible with the parameter list defined with the template
405 * arguments compiler errors are triggered. When called the slot
406 * will invoke the functor with minimal copies.
407 * block() and unblock() can be used to block the functor's invocation
408 * from operator()() temporarily.
410 * You should use the more convenient unnumbered sigc::slot template.
414 /* TODO: Where put the following bit of information? I can't make any
415 * sense of the "because", by the way!
417 * Because slot is opaque, visit_each() will not visit its internal members.
419 template <class T_return>
424 typedef T_return result_type;
427 #ifndef DOXYGEN_SHOULD_SKIP_THIS
429 typedef internal::slot_rep rep_type;
431 typedef T_return (*call_type)(rep_type*);
434 /** Invoke the contained functor unless slot is in blocking state.
435 * @return The return value of the functor invocation.
437 inline T_return operator()() const
439 if (!empty() && !blocked())
440 return (reinterpret_cast<call_type>(rep_->call_))(rep_);
446 /** Constructs a slot from an arbitrary functor.
447 * @param _A_func The desirer functor the new slot should be assigned to.
449 template <class T_functor>
450 slot0(const T_functor& _A_func)
451 : slot_base(new internal::typed_slot_rep<T_functor>(_A_func))
452 { rep_->call_ = internal::slot_call0<T_functor, T_return>::address(); }
454 slot0(const slot0& src)
457 /** Overrides this slot making a copy from another slot.
458 * @param src The slot from which to make a copy.
461 slot0& operator=(const slot0& src)
462 { slot_base::operator=(src); return *this; }
465 /** Converts an arbitrary functor to a unified type which is opaque.
466 * sigc::slot itself is a functor or to be more precise a closure. It contains
467 * a single, arbitrary functor (or closure) that is executed in operator()().
469 * The template arguments determine the function signature of operator()():
470 * - @e T_return The return type of operator()().
471 * - @e T_arg1 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
473 * To use simply assign the slot to the desired functor. If the functor
474 * is not compatible with the parameter list defined with the template
475 * arguments compiler errors are triggered. When called the slot
476 * will invoke the functor with minimal copies.
477 * block() and unblock() can be used to block the functor's invocation
478 * from operator()() temporarily.
480 * You should use the more convenient unnumbered sigc::slot template.
484 /* TODO: Where put the following bit of information? I can't make any
485 * sense of the "because", by the way!
487 * Because slot is opaque, visit_each() will not visit its internal members.
489 template <class T_return, class T_arg1>
494 typedef T_return result_type;
495 typedef typename type_trait<T_arg1>::take arg1_type_;
498 #ifndef DOXYGEN_SHOULD_SKIP_THIS
500 typedef internal::slot_rep rep_type;
502 typedef T_return (*call_type)(rep_type*, arg1_type_);
505 /** Invoke the contained functor unless slot is in blocking state.
506 * @param _A_a1 Argument to be passed on to the functor.
507 * @return The return value of the functor invocation.
509 inline T_return operator()(arg1_type_ _A_a1) const
511 if (!empty() && !blocked())
512 return (reinterpret_cast<call_type>(rep_->call_))(rep_, _A_a1);
518 /** Constructs a slot from an arbitrary functor.
519 * @param _A_func The desirer functor the new slot should be assigned to.
521 template <class T_functor>
522 slot1(const T_functor& _A_func)
523 : slot_base(new internal::typed_slot_rep<T_functor>(_A_func))
524 { rep_->call_ = internal::slot_call1<T_functor, T_return, T_arg1>::address(); }
526 slot1(const slot1& src)
529 /** Overrides this slot making a copy from another slot.
530 * @param src The slot from which to make a copy.
533 slot1& operator=(const slot1& src)
534 { slot_base::operator=(src); return *this; }
537 /** Converts an arbitrary functor to a unified type which is opaque.
538 * sigc::slot itself is a functor or to be more precise a closure. It contains
539 * a single, arbitrary functor (or closure) that is executed in operator()().
541 * The template arguments determine the function signature of operator()():
542 * - @e T_return The return type of operator()().
543 * - @e T_arg1 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
544 * - @e T_arg2 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
546 * To use simply assign the slot to the desired functor. If the functor
547 * is not compatible with the parameter list defined with the template
548 * arguments compiler errors are triggered. When called the slot
549 * will invoke the functor with minimal copies.
550 * block() and unblock() can be used to block the functor's invocation
551 * from operator()() temporarily.
553 * You should use the more convenient unnumbered sigc::slot template.
557 /* TODO: Where put the following bit of information? I can't make any
558 * sense of the "because", by the way!
560 * Because slot is opaque, visit_each() will not visit its internal members.
562 template <class T_return, class T_arg1,class T_arg2>
567 typedef T_return result_type;
568 typedef typename type_trait<T_arg1>::take arg1_type_;
569 typedef typename type_trait<T_arg2>::take arg2_type_;
572 #ifndef DOXYGEN_SHOULD_SKIP_THIS
574 typedef internal::slot_rep rep_type;
576 typedef T_return (*call_type)(rep_type*, arg1_type_,arg2_type_);
579 /** Invoke the contained functor unless slot is in blocking state.
580 * @param _A_a1 Argument to be passed on to the functor.
581 * @param _A_a2 Argument to be passed on to the functor.
582 * @return The return value of the functor invocation.
584 inline T_return operator()(arg1_type_ _A_a1,arg2_type_ _A_a2) const
586 if (!empty() && !blocked())
587 return (reinterpret_cast<call_type>(rep_->call_))(rep_, _A_a1,_A_a2);
593 /** Constructs a slot from an arbitrary functor.
594 * @param _A_func The desirer functor the new slot should be assigned to.
596 template <class T_functor>
597 slot2(const T_functor& _A_func)
598 : slot_base(new internal::typed_slot_rep<T_functor>(_A_func))
599 { rep_->call_ = internal::slot_call2<T_functor, T_return, T_arg1,T_arg2>::address(); }
601 slot2(const slot2& src)
604 /** Overrides this slot making a copy from another slot.
605 * @param src The slot from which to make a copy.
608 slot2& operator=(const slot2& src)
609 { slot_base::operator=(src); return *this; }
612 /** Converts an arbitrary functor to a unified type which is opaque.
613 * sigc::slot itself is a functor or to be more precise a closure. It contains
614 * a single, arbitrary functor (or closure) that is executed in operator()().
616 * The template arguments determine the function signature of operator()():
617 * - @e T_return The return type of operator()().
618 * - @e T_arg1 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
619 * - @e T_arg2 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
620 * - @e T_arg3 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
622 * To use simply assign the slot to the desired functor. If the functor
623 * is not compatible with the parameter list defined with the template
624 * arguments compiler errors are triggered. When called the slot
625 * will invoke the functor with minimal copies.
626 * block() and unblock() can be used to block the functor's invocation
627 * from operator()() temporarily.
629 * You should use the more convenient unnumbered sigc::slot template.
633 /* TODO: Where put the following bit of information? I can't make any
634 * sense of the "because", by the way!
636 * Because slot is opaque, visit_each() will not visit its internal members.
638 template <class T_return, class T_arg1,class T_arg2,class T_arg3>
643 typedef T_return result_type;
644 typedef typename type_trait<T_arg1>::take arg1_type_;
645 typedef typename type_trait<T_arg2>::take arg2_type_;
646 typedef typename type_trait<T_arg3>::take arg3_type_;
649 #ifndef DOXYGEN_SHOULD_SKIP_THIS
651 typedef internal::slot_rep rep_type;
653 typedef T_return (*call_type)(rep_type*, arg1_type_,arg2_type_,arg3_type_);
656 /** Invoke the contained functor unless slot is in blocking state.
657 * @param _A_a1 Argument to be passed on to the functor.
658 * @param _A_a2 Argument to be passed on to the functor.
659 * @param _A_a3 Argument to be passed on to the functor.
660 * @return The return value of the functor invocation.
662 inline T_return operator()(arg1_type_ _A_a1,arg2_type_ _A_a2,arg3_type_ _A_a3) const
664 if (!empty() && !blocked())
665 return (reinterpret_cast<call_type>(rep_->call_))(rep_, _A_a1,_A_a2,_A_a3);
671 /** Constructs a slot from an arbitrary functor.
672 * @param _A_func The desirer functor the new slot should be assigned to.
674 template <class T_functor>
675 slot3(const T_functor& _A_func)
676 : slot_base(new internal::typed_slot_rep<T_functor>(_A_func))
677 { rep_->call_ = internal::slot_call3<T_functor, T_return, T_arg1,T_arg2,T_arg3>::address(); }
679 slot3(const slot3& src)
682 /** Overrides this slot making a copy from another slot.
683 * @param src The slot from which to make a copy.
686 slot3& operator=(const slot3& src)
687 { slot_base::operator=(src); return *this; }
690 /** Converts an arbitrary functor to a unified type which is opaque.
691 * sigc::slot itself is a functor or to be more precise a closure. It contains
692 * a single, arbitrary functor (or closure) that is executed in operator()().
694 * The template arguments determine the function signature of operator()():
695 * - @e T_return The return type of operator()().
696 * - @e T_arg1 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
697 * - @e T_arg2 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
698 * - @e T_arg3 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
699 * - @e T_arg4 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
701 * To use simply assign the slot to the desired functor. If the functor
702 * is not compatible with the parameter list defined with the template
703 * arguments compiler errors are triggered. When called the slot
704 * will invoke the functor with minimal copies.
705 * block() and unblock() can be used to block the functor's invocation
706 * from operator()() temporarily.
708 * You should use the more convenient unnumbered sigc::slot template.
712 /* TODO: Where put the following bit of information? I can't make any
713 * sense of the "because", by the way!
715 * Because slot is opaque, visit_each() will not visit its internal members.
717 template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4>
722 typedef T_return result_type;
723 typedef typename type_trait<T_arg1>::take arg1_type_;
724 typedef typename type_trait<T_arg2>::take arg2_type_;
725 typedef typename type_trait<T_arg3>::take arg3_type_;
726 typedef typename type_trait<T_arg4>::take arg4_type_;
729 #ifndef DOXYGEN_SHOULD_SKIP_THIS
731 typedef internal::slot_rep rep_type;
733 typedef T_return (*call_type)(rep_type*, arg1_type_,arg2_type_,arg3_type_,arg4_type_);
736 /** Invoke the contained functor unless slot is in blocking state.
737 * @param _A_a1 Argument to be passed on to the functor.
738 * @param _A_a2 Argument to be passed on to the functor.
739 * @param _A_a3 Argument to be passed on to the functor.
740 * @param _A_a4 Argument to be passed on to the functor.
741 * @return The return value of the functor invocation.
743 inline T_return operator()(arg1_type_ _A_a1,arg2_type_ _A_a2,arg3_type_ _A_a3,arg4_type_ _A_a4) const
745 if (!empty() && !blocked())
746 return (reinterpret_cast<call_type>(rep_->call_))(rep_, _A_a1,_A_a2,_A_a3,_A_a4);
752 /** Constructs a slot from an arbitrary functor.
753 * @param _A_func The desirer functor the new slot should be assigned to.
755 template <class T_functor>
756 slot4(const T_functor& _A_func)
757 : slot_base(new internal::typed_slot_rep<T_functor>(_A_func))
758 { rep_->call_ = internal::slot_call4<T_functor, T_return, T_arg1,T_arg2,T_arg3,T_arg4>::address(); }
760 slot4(const slot4& src)
763 /** Overrides this slot making a copy from another slot.
764 * @param src The slot from which to make a copy.
767 slot4& operator=(const slot4& src)
768 { slot_base::operator=(src); return *this; }
771 /** Converts an arbitrary functor to a unified type which is opaque.
772 * sigc::slot itself is a functor or to be more precise a closure. It contains
773 * a single, arbitrary functor (or closure) that is executed in operator()().
775 * The template arguments determine the function signature of operator()():
776 * - @e T_return The return type of operator()().
777 * - @e T_arg1 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
778 * - @e T_arg2 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
779 * - @e T_arg3 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
780 * - @e T_arg4 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
781 * - @e T_arg5 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
783 * To use simply assign the slot to the desired functor. If the functor
784 * is not compatible with the parameter list defined with the template
785 * arguments compiler errors are triggered. When called the slot
786 * will invoke the functor with minimal copies.
787 * block() and unblock() can be used to block the functor's invocation
788 * from operator()() temporarily.
790 * You should use the more convenient unnumbered sigc::slot template.
794 /* TODO: Where put the following bit of information? I can't make any
795 * sense of the "because", by the way!
797 * Because slot is opaque, visit_each() will not visit its internal members.
799 template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5>
804 typedef T_return result_type;
805 typedef typename type_trait<T_arg1>::take arg1_type_;
806 typedef typename type_trait<T_arg2>::take arg2_type_;
807 typedef typename type_trait<T_arg3>::take arg3_type_;
808 typedef typename type_trait<T_arg4>::take arg4_type_;
809 typedef typename type_trait<T_arg5>::take arg5_type_;
812 #ifndef DOXYGEN_SHOULD_SKIP_THIS
814 typedef internal::slot_rep rep_type;
816 typedef T_return (*call_type)(rep_type*, arg1_type_,arg2_type_,arg3_type_,arg4_type_,arg5_type_);
819 /** Invoke the contained functor unless slot is in blocking state.
820 * @param _A_a1 Argument to be passed on to the functor.
821 * @param _A_a2 Argument to be passed on to the functor.
822 * @param _A_a3 Argument to be passed on to the functor.
823 * @param _A_a4 Argument to be passed on to the functor.
824 * @param _A_a5 Argument to be passed on to the functor.
825 * @return The return value of the functor invocation.
827 inline T_return operator()(arg1_type_ _A_a1,arg2_type_ _A_a2,arg3_type_ _A_a3,arg4_type_ _A_a4,arg5_type_ _A_a5) const
829 if (!empty() && !blocked())
830 return (reinterpret_cast<call_type>(rep_->call_))(rep_, _A_a1,_A_a2,_A_a3,_A_a4,_A_a5);
836 /** Constructs a slot from an arbitrary functor.
837 * @param _A_func The desirer functor the new slot should be assigned to.
839 template <class T_functor>
840 slot5(const T_functor& _A_func)
841 : slot_base(new internal::typed_slot_rep<T_functor>(_A_func))
842 { rep_->call_ = internal::slot_call5<T_functor, T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5>::address(); }
844 slot5(const slot5& src)
847 /** Overrides this slot making a copy from another slot.
848 * @param src The slot from which to make a copy.
851 slot5& operator=(const slot5& src)
852 { slot_base::operator=(src); return *this; }
855 /** Converts an arbitrary functor to a unified type which is opaque.
856 * sigc::slot itself is a functor or to be more precise a closure. It contains
857 * a single, arbitrary functor (or closure) that is executed in operator()().
859 * The template arguments determine the function signature of operator()():
860 * - @e T_return The return type of operator()().
861 * - @e T_arg1 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
862 * - @e T_arg2 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
863 * - @e T_arg3 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
864 * - @e T_arg4 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
865 * - @e T_arg5 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
866 * - @e T_arg6 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
868 * To use simply assign the slot to the desired functor. If the functor
869 * is not compatible with the parameter list defined with the template
870 * arguments compiler errors are triggered. When called the slot
871 * will invoke the functor with minimal copies.
872 * block() and unblock() can be used to block the functor's invocation
873 * from operator()() temporarily.
875 * You should use the more convenient unnumbered sigc::slot template.
879 /* TODO: Where put the following bit of information? I can't make any
880 * sense of the "because", by the way!
882 * Because slot is opaque, visit_each() will not visit its internal members.
884 template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5,class T_arg6>
889 typedef T_return result_type;
890 typedef typename type_trait<T_arg1>::take arg1_type_;
891 typedef typename type_trait<T_arg2>::take arg2_type_;
892 typedef typename type_trait<T_arg3>::take arg3_type_;
893 typedef typename type_trait<T_arg4>::take arg4_type_;
894 typedef typename type_trait<T_arg5>::take arg5_type_;
895 typedef typename type_trait<T_arg6>::take arg6_type_;
898 #ifndef DOXYGEN_SHOULD_SKIP_THIS
900 typedef internal::slot_rep rep_type;
902 typedef T_return (*call_type)(rep_type*, arg1_type_,arg2_type_,arg3_type_,arg4_type_,arg5_type_,arg6_type_);
905 /** Invoke the contained functor unless slot is in blocking state.
906 * @param _A_a1 Argument to be passed on to the functor.
907 * @param _A_a2 Argument to be passed on to the functor.
908 * @param _A_a3 Argument to be passed on to the functor.
909 * @param _A_a4 Argument to be passed on to the functor.
910 * @param _A_a5 Argument to be passed on to the functor.
911 * @param _A_a6 Argument to be passed on to the functor.
912 * @return The return value of the functor invocation.
914 inline T_return operator()(arg1_type_ _A_a1,arg2_type_ _A_a2,arg3_type_ _A_a3,arg4_type_ _A_a4,arg5_type_ _A_a5,arg6_type_ _A_a6) const
916 if (!empty() && !blocked())
917 return (reinterpret_cast<call_type>(rep_->call_))(rep_, _A_a1,_A_a2,_A_a3,_A_a4,_A_a5,_A_a6);
923 /** Constructs a slot from an arbitrary functor.
924 * @param _A_func The desirer functor the new slot should be assigned to.
926 template <class T_functor>
927 slot6(const T_functor& _A_func)
928 : slot_base(new internal::typed_slot_rep<T_functor>(_A_func))
929 { rep_->call_ = internal::slot_call6<T_functor, T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6>::address(); }
931 slot6(const slot6& src)
934 /** Overrides this slot making a copy from another slot.
935 * @param src The slot from which to make a copy.
938 slot6& operator=(const slot6& src)
939 { slot_base::operator=(src); return *this; }
942 /** Converts an arbitrary functor to a unified type which is opaque.
943 * sigc::slot itself is a functor or to be more precise a closure. It contains
944 * a single, arbitrary functor (or closure) that is executed in operator()().
946 * The template arguments determine the function signature of operator()():
947 * - @e T_return The return type of operator()().
948 * - @e T_arg1 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
949 * - @e T_arg2 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
950 * - @e T_arg3 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
951 * - @e T_arg4 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
952 * - @e T_arg5 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
953 * - @e T_arg6 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
954 * - @e T_arg7 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
956 * To use simply assign the slot to the desired functor. If the functor
957 * is not compatible with the parameter list defined with the template
958 * arguments compiler errors are triggered. When called the slot
959 * will invoke the functor with minimal copies.
960 * block() and unblock() can be used to block the functor's invocation
961 * from operator()() temporarily.
963 * You should use the more convenient unnumbered sigc::slot template.
967 /* TODO: Where put the following bit of information? I can't make any
968 * sense of the "because", by the way!
970 * Because slot is opaque, visit_each() will not visit its internal members.
972 template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5,class T_arg6,class T_arg7>
977 typedef T_return result_type;
978 typedef typename type_trait<T_arg1>::take arg1_type_;
979 typedef typename type_trait<T_arg2>::take arg2_type_;
980 typedef typename type_trait<T_arg3>::take arg3_type_;
981 typedef typename type_trait<T_arg4>::take arg4_type_;
982 typedef typename type_trait<T_arg5>::take arg5_type_;
983 typedef typename type_trait<T_arg6>::take arg6_type_;
984 typedef typename type_trait<T_arg7>::take arg7_type_;
987 #ifndef DOXYGEN_SHOULD_SKIP_THIS
989 typedef internal::slot_rep rep_type;
991 typedef T_return (*call_type)(rep_type*, arg1_type_,arg2_type_,arg3_type_,arg4_type_,arg5_type_,arg6_type_,arg7_type_);
994 /** Invoke the contained functor unless slot is in blocking state.
995 * @param _A_a1 Argument to be passed on to the functor.
996 * @param _A_a2 Argument to be passed on to the functor.
997 * @param _A_a3 Argument to be passed on to the functor.
998 * @param _A_a4 Argument to be passed on to the functor.
999 * @param _A_a5 Argument to be passed on to the functor.
1000 * @param _A_a6 Argument to be passed on to the functor.
1001 * @param _A_a7 Argument to be passed on to the functor.
1002 * @return The return value of the functor invocation.
1004 inline T_return operator()(arg1_type_ _A_a1,arg2_type_ _A_a2,arg3_type_ _A_a3,arg4_type_ _A_a4,arg5_type_ _A_a5,arg6_type_ _A_a6,arg7_type_ _A_a7) const
1006 if (!empty() && !blocked())
1007 return (reinterpret_cast<call_type>(rep_->call_))(rep_, _A_a1,_A_a2,_A_a3,_A_a4,_A_a5,_A_a6,_A_a7);
1013 /** Constructs a slot from an arbitrary functor.
1014 * @param _A_func The desirer functor the new slot should be assigned to.
1016 template <class T_functor>
1017 slot7(const T_functor& _A_func)
1018 : slot_base(new internal::typed_slot_rep<T_functor>(_A_func))
1019 { rep_->call_ = internal::slot_call7<T_functor, T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7>::address(); }
1021 slot7(const slot7& src)
1024 /** Overrides this slot making a copy from another slot.
1025 * @param src The slot from which to make a copy.
1028 slot7& operator=(const slot7& src)
1029 { slot_base::operator=(src); return *this; }
1033 /** Convenience wrapper for the numbered sigc::slot# templates.
1034 * Slots convert arbitrary functors to unified types which are opaque.
1035 * sigc::slot itself is a functor or to be more precise a closure. It contains
1036 * a single, arbitrary functor (or closure) that is executed in operator()().
1038 * The template arguments determine the function signature of operator()():
1039 * - @e T_return The return type of operator()().
1040 * - @e T_arg1 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
1041 * - @e T_arg2 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
1042 * - @e T_arg3 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
1043 * - @e T_arg4 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
1044 * - @e T_arg5 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
1045 * - @e T_arg6 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
1046 * - @e T_arg7 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
1048 * To use simply assign the slot to the desired functor. If the functor
1049 * is not compatible with the parameter list defined with the template
1050 * arguments compiler errors are triggered. When called the slot
1051 * will invoke the functor with minimal copies.
1052 * block() and unblock() can be used to block the functor's invocation
1053 * from operator()() temporarily.
1058 * sigc::slot<void, long> s = sigc::ptr_fun(&foo);
1064 template <class T_return, class T_arg1 = nil_,class T_arg2 = nil_,class T_arg3 = nil_,class T_arg4 = nil_,class T_arg5 = nil_,class T_arg6 = nil_,class T_arg7 = nil_>
1066 : public slot7<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7>
1069 typedef slot7<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7> parent_type;
1073 /** Constructs a slot from an arbitrary functor.
1074 * @param _A_func The desirer functor the new slot should be assigned to.
1076 template <class T_functor>
1077 slot(const T_functor& _A_func)
1078 : parent_type(_A_func) {}
1080 slot(const slot& src)
1081 : parent_type((const parent_type&)src) {}
1085 /** Convenience wrapper for the numbered sigc::slot0 template.
1086 * See the base class for useful methods.
1087 * This is the template specialization of the unnumbered sigc::slot
1088 * template for 0 argument(s).
1090 template <class T_return>
1091 class slot <T_return>
1092 : public slot0<T_return>
1095 typedef slot0<T_return> parent_type;
1099 /** Constructs a slot from an arbitrary functor.
1100 * @param _A_func The desirer functor the new slot should be assigned to.
1102 template <class T_functor>
1103 slot(const T_functor& _A_func)
1104 : parent_type(_A_func) {}
1106 slot(const slot& src)
1107 : parent_type((const parent_type&)src) {}
1110 /** Convenience wrapper for the numbered sigc::slot1 template.
1111 * See the base class for useful methods.
1112 * This is the template specialization of the unnumbered sigc::slot
1113 * template for 1 argument(s).
1115 template <class T_return, class T_arg1>
1116 class slot <T_return, T_arg1>
1117 : public slot1<T_return, T_arg1>
1120 typedef slot1<T_return, T_arg1> parent_type;
1124 /** Constructs a slot from an arbitrary functor.
1125 * @param _A_func The desirer functor the new slot should be assigned to.
1127 template <class T_functor>
1128 slot(const T_functor& _A_func)
1129 : parent_type(_A_func) {}
1131 slot(const slot& src)
1132 : parent_type((const parent_type&)src) {}
1135 /** Convenience wrapper for the numbered sigc::slot2 template.
1136 * See the base class for useful methods.
1137 * This is the template specialization of the unnumbered sigc::slot
1138 * template for 2 argument(s).
1140 template <class T_return, class T_arg1,class T_arg2>
1141 class slot <T_return, T_arg1,T_arg2>
1142 : public slot2<T_return, T_arg1,T_arg2>
1145 typedef slot2<T_return, T_arg1,T_arg2> parent_type;
1149 /** Constructs a slot from an arbitrary functor.
1150 * @param _A_func The desirer functor the new slot should be assigned to.
1152 template <class T_functor>
1153 slot(const T_functor& _A_func)
1154 : parent_type(_A_func) {}
1156 slot(const slot& src)
1157 : parent_type((const parent_type&)src) {}
1160 /** Convenience wrapper for the numbered sigc::slot3 template.
1161 * See the base class for useful methods.
1162 * This is the template specialization of the unnumbered sigc::slot
1163 * template for 3 argument(s).
1165 template <class T_return, class T_arg1,class T_arg2,class T_arg3>
1166 class slot <T_return, T_arg1,T_arg2,T_arg3>
1167 : public slot3<T_return, T_arg1,T_arg2,T_arg3>
1170 typedef slot3<T_return, T_arg1,T_arg2,T_arg3> parent_type;
1174 /** Constructs a slot from an arbitrary functor.
1175 * @param _A_func The desirer functor the new slot should be assigned to.
1177 template <class T_functor>
1178 slot(const T_functor& _A_func)
1179 : parent_type(_A_func) {}
1181 slot(const slot& src)
1182 : parent_type((const parent_type&)src) {}
1185 /** Convenience wrapper for the numbered sigc::slot4 template.
1186 * See the base class for useful methods.
1187 * This is the template specialization of the unnumbered sigc::slot
1188 * template for 4 argument(s).
1190 template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4>
1191 class slot <T_return, T_arg1,T_arg2,T_arg3,T_arg4>
1192 : public slot4<T_return, T_arg1,T_arg2,T_arg3,T_arg4>
1195 typedef slot4<T_return, T_arg1,T_arg2,T_arg3,T_arg4> parent_type;
1199 /** Constructs a slot from an arbitrary functor.
1200 * @param _A_func The desirer functor the new slot should be assigned to.
1202 template <class T_functor>
1203 slot(const T_functor& _A_func)
1204 : parent_type(_A_func) {}
1206 slot(const slot& src)
1207 : parent_type((const parent_type&)src) {}
1210 /** Convenience wrapper for the numbered sigc::slot5 template.
1211 * See the base class for useful methods.
1212 * This is the template specialization of the unnumbered sigc::slot
1213 * template for 5 argument(s).
1215 template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5>
1216 class slot <T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5>
1217 : public slot5<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5>
1220 typedef slot5<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5> parent_type;
1224 /** Constructs a slot from an arbitrary functor.
1225 * @param _A_func The desirer functor the new slot should be assigned to.
1227 template <class T_functor>
1228 slot(const T_functor& _A_func)
1229 : parent_type(_A_func) {}
1231 slot(const slot& src)
1232 : parent_type((const parent_type&)src) {}
1235 /** Convenience wrapper for the numbered sigc::slot6 template.
1236 * See the base class for useful methods.
1237 * This is the template specialization of the unnumbered sigc::slot
1238 * template for 6 argument(s).
1240 template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5,class T_arg6>
1241 class slot <T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6>
1242 : public slot6<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6>
1245 typedef slot6<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6> parent_type;
1249 /** Constructs a slot from an arbitrary functor.
1250 * @param _A_func The desirer functor the new slot should be assigned to.
1252 template <class T_functor>
1253 slot(const T_functor& _A_func)
1254 : parent_type(_A_func) {}
1256 slot(const slot& src)
1257 : parent_type((const parent_type&)src) {}
1262 } /* namespace sigc */
1263 #endif /* _SIGC_FUNCTORS_MACROS_SLOTHM4_ */