Merged with trunk R1705.
[ardour.git] / libs / sigc++2 / sigc++ / functors / slot.h
1 // -*- c++ -*-
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>
9
10 namespace sigc {
11
12 namespace internal {
13
14 /** A typed slot_rep.
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.
20  */
21 template <class T_functor>
22 struct typed_slot_rep : public slot_rep
23 {
24   typedef typed_slot_rep<T_functor> self;
25
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;
29
30   /** The functor contained by this slot_rep object. */
31   adaptor_type functor_;
32
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.
36    */
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_); }
40
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_); }
44
45   inline ~typed_slot_rep()
46     {
47       call_ = 0;
48       destroy_ = 0;
49       visit_each_type<trackable*>(slot_do_unbind(this), functor_);
50     }
51
52   /** Detaches the stored functor from the other referred trackables and destroys it.
53    * This does not destroy the base slot_rep object.
54    */
55   static void* destroy(void* data)
56     {
57       self* self_ = static_cast<self*>((slot_rep*)data);
58       self_->call_ = 0;
59       self_->destroy_ = 0;
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)
65        */
66       return 0;
67     }
68
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.
73    */
74   static void* dup(void* data)
75     {
76       slot_rep* rep_ = (slot_rep*)data;
77       return static_cast<slot_rep*>(new self(*static_cast<self*>(rep_)));
78     }
79 };
80
81
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().
86  *
87  * The following template arguments are used:
88  * - @e T_functor The functor type.
89  * - @e T_return The return type of call_it().
90  *
91  */
92 template<class T_functor, class T_return>
93 struct slot_call0
94 {
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.
98    */
99   static T_return call_it(slot_rep* rep)
100     {
101       typedef typed_slot_rep<T_functor> typed_slot;
102       typed_slot *typed_rep = static_cast<typed_slot*>(rep);
103       return (typed_rep->functor_)();
104     }
105
106   /** Forms a function pointer from call_it().
107    * @return A function pointer formed from call_it().
108    */
109   static hook address() 
110     { return reinterpret_cast<hook>(&call_it); }
111 };
112
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().
117  *
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().
122  *
123  */
124 template<class T_functor, class T_return, class T_arg1>
125 struct slot_call1
126 {
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.
131    */
132   static T_return call_it(slot_rep* rep, typename type_trait<T_arg1>::take a_1)
133     {
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>
137                (a_1);
138     }
139
140   /** Forms a function pointer from call_it().
141    * @return A function pointer formed from call_it().
142    */
143   static hook address() 
144     { return reinterpret_cast<hook>(&call_it); }
145 };
146
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().
151  *
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().
157  *
158  */
159 template<class T_functor, class T_return, class T_arg1,class T_arg2>
160 struct slot_call2
161 {
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.
167    */
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)
169     {
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>
173                (a_1,a_2);
174     }
175
176   /** Forms a function pointer from call_it().
177    * @return A function pointer formed from call_it().
178    */
179   static hook address() 
180     { return reinterpret_cast<hook>(&call_it); }
181 };
182
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().
187  *
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().
194  *
195  */
196 template<class T_functor, class T_return, class T_arg1,class T_arg2,class T_arg3>
197 struct slot_call3
198 {
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.
205    */
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)
207     {
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>
211                (a_1,a_2,a_3);
212     }
213
214   /** Forms a function pointer from call_it().
215    * @return A function pointer formed from call_it().
216    */
217   static hook address() 
218     { return reinterpret_cast<hook>(&call_it); }
219 };
220
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().
225  *
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().
233  *
234  */
235 template<class T_functor, class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4>
236 struct slot_call4
237 {
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.
245    */
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)
247     {
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>
251                (a_1,a_2,a_3,a_4);
252     }
253
254   /** Forms a function pointer from call_it().
255    * @return A function pointer formed from call_it().
256    */
257   static hook address() 
258     { return reinterpret_cast<hook>(&call_it); }
259 };
260
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().
265  *
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().
274  *
275  */
276 template<class T_functor, class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5>
277 struct slot_call5
278 {
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.
287    */
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)
289     {
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);
294     }
295
296   /** Forms a function pointer from call_it().
297    * @return A function pointer formed from call_it().
298    */
299   static hook address() 
300     { return reinterpret_cast<hook>(&call_it); }
301 };
302
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().
307  *
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().
317  *
318  */
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>
320 struct slot_call6
321 {
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.
331    */
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)
333     {
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);
338     }
339
340   /** Forms a function pointer from call_it().
341    * @return A function pointer formed from call_it().
342    */
343   static hook address() 
344     { return reinterpret_cast<hook>(&call_it); }
345 };
346
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().
351  *
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().
362  *
363  */
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>
365 struct slot_call7
366 {
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.
377    */
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)
379     {
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);
384     }
385
386   /** Forms a function pointer from call_it().
387    * @return A function pointer formed from call_it().
388    */
389   static hook address() 
390     { return reinterpret_cast<hook>(&call_it); }
391 };
392
393 } /* namespace internal */
394
395
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()().
399  *
400  * The template arguments determine the function signature of operator()():
401  * - @e T_return The return type of operator()().
402  *
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.
409  *
410  * You should use the more convenient unnumbered sigc::slot template.
411  *
412  * @ingroup slot
413  */
414 /* TODO: Where put the following bit of information? I can't make any
415  *       sense of the "because", by the way!
416  *
417  * Because slot is opaque, visit_each() will not visit its internal members.
418  */
419 template <class T_return>
420 class slot0
421   : public slot_base
422 {
423 public:
424   typedef T_return result_type;
425
426
427 #ifndef DOXYGEN_SHOULD_SKIP_THIS
428 private:
429   typedef internal::slot_rep rep_type;
430 public:
431   typedef T_return (*call_type)(rep_type*);
432 #endif
433
434   /** Invoke the contained functor unless slot is in blocking state.
435    * @return The return value of the functor invocation.
436    */
437   inline T_return operator()() const
438     {
439       if (!empty() && !blocked())
440         return (reinterpret_cast<call_type>(rep_->call_))(rep_);
441       return T_return();
442     }
443
444   inline slot0() {}
445
446   /** Constructs a slot from an arbitrary functor.
447    * @param _A_func The desirer functor the new slot should be assigned to.
448    */
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(); }
453
454   slot0(const slot0& src)
455     : slot_base(src) {}
456
457   /** Overrides this slot making a copy from another slot.
458    * @param src The slot from which to make a copy.
459    * @return @p this.
460    */
461   slot0& operator=(const slot0& src)
462     { slot_base::operator=(src); return *this; }
463 };
464
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()().
468  *
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.
472  *
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.
479  *
480  * You should use the more convenient unnumbered sigc::slot template.
481  *
482  * @ingroup slot
483  */
484 /* TODO: Where put the following bit of information? I can't make any
485  *       sense of the "because", by the way!
486  *
487  * Because slot is opaque, visit_each() will not visit its internal members.
488  */
489 template <class T_return, class T_arg1>
490 class slot1
491   : public slot_base
492 {
493 public:
494   typedef T_return result_type;
495   typedef typename type_trait<T_arg1>::take arg1_type_;
496
497
498 #ifndef DOXYGEN_SHOULD_SKIP_THIS
499 private:
500   typedef internal::slot_rep rep_type;
501 public:
502   typedef T_return (*call_type)(rep_type*, arg1_type_);
503 #endif
504
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.
508    */
509   inline T_return operator()(arg1_type_ _A_a1) const
510     {
511       if (!empty() && !blocked())
512         return (reinterpret_cast<call_type>(rep_->call_))(rep_, _A_a1);
513       return T_return();
514     }
515
516   inline slot1() {}
517
518   /** Constructs a slot from an arbitrary functor.
519    * @param _A_func The desirer functor the new slot should be assigned to.
520    */
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(); }
525
526   slot1(const slot1& src)
527     : slot_base(src) {}
528
529   /** Overrides this slot making a copy from another slot.
530    * @param src The slot from which to make a copy.
531    * @return @p this.
532    */
533   slot1& operator=(const slot1& src)
534     { slot_base::operator=(src); return *this; }
535 };
536
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()().
540  *
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.
545  *
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.
552  *
553  * You should use the more convenient unnumbered sigc::slot template.
554  *
555  * @ingroup slot
556  */
557 /* TODO: Where put the following bit of information? I can't make any
558  *       sense of the "because", by the way!
559  *
560  * Because slot is opaque, visit_each() will not visit its internal members.
561  */
562 template <class T_return, class T_arg1,class T_arg2>
563 class slot2
564   : public slot_base
565 {
566 public:
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_;
570
571
572 #ifndef DOXYGEN_SHOULD_SKIP_THIS
573 private:
574   typedef internal::slot_rep rep_type;
575 public:
576   typedef T_return (*call_type)(rep_type*, arg1_type_,arg2_type_);
577 #endif
578
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.
583    */
584   inline T_return operator()(arg1_type_ _A_a1,arg2_type_ _A_a2) const
585     {
586       if (!empty() && !blocked())
587         return (reinterpret_cast<call_type>(rep_->call_))(rep_, _A_a1,_A_a2);
588       return T_return();
589     }
590
591   inline slot2() {}
592
593   /** Constructs a slot from an arbitrary functor.
594    * @param _A_func The desirer functor the new slot should be assigned to.
595    */
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(); }
600
601   slot2(const slot2& src)
602     : slot_base(src) {}
603
604   /** Overrides this slot making a copy from another slot.
605    * @param src The slot from which to make a copy.
606    * @return @p this.
607    */
608   slot2& operator=(const slot2& src)
609     { slot_base::operator=(src); return *this; }
610 };
611
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()().
615  *
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.
621  *
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.
628  *
629  * You should use the more convenient unnumbered sigc::slot template.
630  *
631  * @ingroup slot
632  */
633 /* TODO: Where put the following bit of information? I can't make any
634  *       sense of the "because", by the way!
635  *
636  * Because slot is opaque, visit_each() will not visit its internal members.
637  */
638 template <class T_return, class T_arg1,class T_arg2,class T_arg3>
639 class slot3
640   : public slot_base
641 {
642 public:
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_;
647
648
649 #ifndef DOXYGEN_SHOULD_SKIP_THIS
650 private:
651   typedef internal::slot_rep rep_type;
652 public:
653   typedef T_return (*call_type)(rep_type*, arg1_type_,arg2_type_,arg3_type_);
654 #endif
655
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.
661    */
662   inline T_return operator()(arg1_type_ _A_a1,arg2_type_ _A_a2,arg3_type_ _A_a3) const
663     {
664       if (!empty() && !blocked())
665         return (reinterpret_cast<call_type>(rep_->call_))(rep_, _A_a1,_A_a2,_A_a3);
666       return T_return();
667     }
668
669   inline slot3() {}
670
671   /** Constructs a slot from an arbitrary functor.
672    * @param _A_func The desirer functor the new slot should be assigned to.
673    */
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(); }
678
679   slot3(const slot3& src)
680     : slot_base(src) {}
681
682   /** Overrides this slot making a copy from another slot.
683    * @param src The slot from which to make a copy.
684    * @return @p this.
685    */
686   slot3& operator=(const slot3& src)
687     { slot_base::operator=(src); return *this; }
688 };
689
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()().
693  *
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.
700  *
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.
707  *
708  * You should use the more convenient unnumbered sigc::slot template.
709  *
710  * @ingroup slot
711  */
712 /* TODO: Where put the following bit of information? I can't make any
713  *       sense of the "because", by the way!
714  *
715  * Because slot is opaque, visit_each() will not visit its internal members.
716  */
717 template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4>
718 class slot4
719   : public slot_base
720 {
721 public:
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_;
727
728
729 #ifndef DOXYGEN_SHOULD_SKIP_THIS
730 private:
731   typedef internal::slot_rep rep_type;
732 public:
733   typedef T_return (*call_type)(rep_type*, arg1_type_,arg2_type_,arg3_type_,arg4_type_);
734 #endif
735
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.
742    */
743   inline T_return operator()(arg1_type_ _A_a1,arg2_type_ _A_a2,arg3_type_ _A_a3,arg4_type_ _A_a4) const
744     {
745       if (!empty() && !blocked())
746         return (reinterpret_cast<call_type>(rep_->call_))(rep_, _A_a1,_A_a2,_A_a3,_A_a4);
747       return T_return();
748     }
749
750   inline slot4() {}
751
752   /** Constructs a slot from an arbitrary functor.
753    * @param _A_func The desirer functor the new slot should be assigned to.
754    */
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(); }
759
760   slot4(const slot4& src)
761     : slot_base(src) {}
762
763   /** Overrides this slot making a copy from another slot.
764    * @param src The slot from which to make a copy.
765    * @return @p this.
766    */
767   slot4& operator=(const slot4& src)
768     { slot_base::operator=(src); return *this; }
769 };
770
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()().
774  *
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.
782  *
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.
789  *
790  * You should use the more convenient unnumbered sigc::slot template.
791  *
792  * @ingroup slot
793  */
794 /* TODO: Where put the following bit of information? I can't make any
795  *       sense of the "because", by the way!
796  *
797  * Because slot is opaque, visit_each() will not visit its internal members.
798  */
799 template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5>
800 class slot5
801   : public slot_base
802 {
803 public:
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_;
810
811
812 #ifndef DOXYGEN_SHOULD_SKIP_THIS
813 private:
814   typedef internal::slot_rep rep_type;
815 public:
816   typedef T_return (*call_type)(rep_type*, arg1_type_,arg2_type_,arg3_type_,arg4_type_,arg5_type_);
817 #endif
818
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.
826    */
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
828     {
829       if (!empty() && !blocked())
830         return (reinterpret_cast<call_type>(rep_->call_))(rep_, _A_a1,_A_a2,_A_a3,_A_a4,_A_a5);
831       return T_return();
832     }
833
834   inline slot5() {}
835
836   /** Constructs a slot from an arbitrary functor.
837    * @param _A_func The desirer functor the new slot should be assigned to.
838    */
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(); }
843
844   slot5(const slot5& src)
845     : slot_base(src) {}
846
847   /** Overrides this slot making a copy from another slot.
848    * @param src The slot from which to make a copy.
849    * @return @p this.
850    */
851   slot5& operator=(const slot5& src)
852     { slot_base::operator=(src); return *this; }
853 };
854
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()().
858  *
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.
867  *
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.
874  *
875  * You should use the more convenient unnumbered sigc::slot template.
876  *
877  * @ingroup slot
878  */
879 /* TODO: Where put the following bit of information? I can't make any
880  *       sense of the "because", by the way!
881  *
882  * Because slot is opaque, visit_each() will not visit its internal members.
883  */
884 template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5,class T_arg6>
885 class slot6
886   : public slot_base
887 {
888 public:
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_;
896
897
898 #ifndef DOXYGEN_SHOULD_SKIP_THIS
899 private:
900   typedef internal::slot_rep rep_type;
901 public:
902   typedef T_return (*call_type)(rep_type*, arg1_type_,arg2_type_,arg3_type_,arg4_type_,arg5_type_,arg6_type_);
903 #endif
904
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.
913    */
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
915     {
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);
918       return T_return();
919     }
920
921   inline slot6() {}
922
923   /** Constructs a slot from an arbitrary functor.
924    * @param _A_func The desirer functor the new slot should be assigned to.
925    */
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(); }
930
931   slot6(const slot6& src)
932     : slot_base(src) {}
933
934   /** Overrides this slot making a copy from another slot.
935    * @param src The slot from which to make a copy.
936    * @return @p this.
937    */
938   slot6& operator=(const slot6& src)
939     { slot_base::operator=(src); return *this; }
940 };
941
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()().
945  *
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.
955  *
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.
962  *
963  * You should use the more convenient unnumbered sigc::slot template.
964  *
965  * @ingroup slot
966  */
967 /* TODO: Where put the following bit of information? I can't make any
968  *       sense of the "because", by the way!
969  *
970  * Because slot is opaque, visit_each() will not visit its internal members.
971  */
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>
973 class slot7
974   : public slot_base
975 {
976 public:
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_;
985
986
987 #ifndef DOXYGEN_SHOULD_SKIP_THIS
988 private:
989   typedef internal::slot_rep rep_type;
990 public:
991   typedef T_return (*call_type)(rep_type*, arg1_type_,arg2_type_,arg3_type_,arg4_type_,arg5_type_,arg6_type_,arg7_type_);
992 #endif
993
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.
1003    */
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
1005     {
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);
1008       return T_return();
1009     }
1010
1011   inline slot7() {}
1012
1013   /** Constructs a slot from an arbitrary functor.
1014    * @param _A_func The desirer functor the new slot should be assigned to.
1015    */
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(); }
1020
1021   slot7(const slot7& src)
1022     : slot_base(src) {}
1023
1024   /** Overrides this slot making a copy from another slot.
1025    * @param src The slot from which to make a copy.
1026    * @return @p this.
1027    */
1028   slot7& operator=(const slot7& src)
1029     { slot_base::operator=(src); return *this; }
1030 };
1031
1032
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()().
1037  *
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.
1047  *
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.
1054  *
1055  * @par Example:
1056  *   @code
1057  *   void foo(int) {}
1058  *   sigc::slot<void, long> s = sigc::ptr_fun(&foo);
1059  *   s(19);
1060  *   @endcode
1061  *
1062  * @ingroup slot
1063  */
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_>
1065 class slot 
1066   : public slot7<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7>
1067 {
1068 public:
1069   typedef slot7<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7> parent_type;
1070
1071   inline slot() {}
1072
1073   /** Constructs a slot from an arbitrary functor.
1074    * @param _A_func The desirer functor the new slot should be assigned to.
1075    */
1076   template <class T_functor>
1077   slot(const T_functor& _A_func)
1078     : parent_type(_A_func) {}
1079
1080   slot(const slot& src)
1081     : parent_type((const parent_type&)src) {}
1082 };
1083
1084
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).
1089  */
1090 template <class T_return>
1091 class slot <T_return>
1092   : public slot0<T_return>
1093 {
1094 public:
1095   typedef slot0<T_return> parent_type;
1096
1097   inline slot() {}
1098
1099   /** Constructs a slot from an arbitrary functor.
1100    * @param _A_func The desirer functor the new slot should be assigned to.
1101    */
1102   template <class T_functor>
1103   slot(const T_functor& _A_func)
1104     : parent_type(_A_func) {}
1105
1106   slot(const slot& src)
1107     : parent_type((const parent_type&)src) {}
1108 };
1109
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).
1114  */
1115 template <class T_return, class T_arg1>
1116 class slot <T_return, T_arg1>
1117   : public slot1<T_return, T_arg1>
1118 {
1119 public:
1120   typedef slot1<T_return, T_arg1> parent_type;
1121
1122   inline slot() {}
1123
1124   /** Constructs a slot from an arbitrary functor.
1125    * @param _A_func The desirer functor the new slot should be assigned to.
1126    */
1127   template <class T_functor>
1128   slot(const T_functor& _A_func)
1129     : parent_type(_A_func) {}
1130
1131   slot(const slot& src)
1132     : parent_type((const parent_type&)src) {}
1133 };
1134
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).
1139  */
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>
1143 {
1144 public:
1145   typedef slot2<T_return, T_arg1,T_arg2> parent_type;
1146
1147   inline slot() {}
1148
1149   /** Constructs a slot from an arbitrary functor.
1150    * @param _A_func The desirer functor the new slot should be assigned to.
1151    */
1152   template <class T_functor>
1153   slot(const T_functor& _A_func)
1154     : parent_type(_A_func) {}
1155
1156   slot(const slot& src)
1157     : parent_type((const parent_type&)src) {}
1158 };
1159
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).
1164  */
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>
1168 {
1169 public:
1170   typedef slot3<T_return, T_arg1,T_arg2,T_arg3> parent_type;
1171
1172   inline slot() {}
1173
1174   /** Constructs a slot from an arbitrary functor.
1175    * @param _A_func The desirer functor the new slot should be assigned to.
1176    */
1177   template <class T_functor>
1178   slot(const T_functor& _A_func)
1179     : parent_type(_A_func) {}
1180
1181   slot(const slot& src)
1182     : parent_type((const parent_type&)src) {}
1183 };
1184
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).
1189  */
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>
1193 {
1194 public:
1195   typedef slot4<T_return, T_arg1,T_arg2,T_arg3,T_arg4> parent_type;
1196
1197   inline slot() {}
1198
1199   /** Constructs a slot from an arbitrary functor.
1200    * @param _A_func The desirer functor the new slot should be assigned to.
1201    */
1202   template <class T_functor>
1203   slot(const T_functor& _A_func)
1204     : parent_type(_A_func) {}
1205
1206   slot(const slot& src)
1207     : parent_type((const parent_type&)src) {}
1208 };
1209
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).
1214  */
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>
1218 {
1219 public:
1220   typedef slot5<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5> parent_type;
1221
1222   inline slot() {}
1223
1224   /** Constructs a slot from an arbitrary functor.
1225    * @param _A_func The desirer functor the new slot should be assigned to.
1226    */
1227   template <class T_functor>
1228   slot(const T_functor& _A_func)
1229     : parent_type(_A_func) {}
1230
1231   slot(const slot& src)
1232     : parent_type((const parent_type&)src) {}
1233 };
1234
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).
1239  */
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>
1243 {
1244 public:
1245   typedef slot6<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6> parent_type;
1246
1247   inline slot() {}
1248
1249   /** Constructs a slot from an arbitrary functor.
1250    * @param _A_func The desirer functor the new slot should be assigned to.
1251    */
1252   template <class T_functor>
1253   slot(const T_functor& _A_func)
1254     : parent_type(_A_func) {}
1255
1256   slot(const slot& src)
1257     : parent_type((const parent_type&)src) {}
1258 };
1259
1260
1261
1262 } /* namespace sigc */
1263 #endif /* _SIGC_FUNCTORS_MACROS_SLOTHM4_ */