merged with 1697 revision of trunk (which is post-rc1 but pre-rc2
[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*>(reinterpret_cast<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* a_rep = reinterpret_cast<slot_rep*>(data);
77       return static_cast<slot_rep*>(new self(*static_cast<self*>(a_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>(slot_base::rep_->call_))(slot_base::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     {
453       //The slot_base:: is necessary to stop the HP-UX aCC compiler from being confused. murrayc.
454       slot_base::rep_->call_ = internal::slot_call0<T_functor, T_return>::address();
455     }
456
457   slot0(const slot0& src)
458     : slot_base(src) {}
459
460   /** Overrides this slot making a copy from another slot.
461    * @param src The slot from which to make a copy.
462    * @return @p this.
463    */
464   slot0& operator=(const slot0& src)
465     { slot_base::operator=(src); return *this; }
466 };
467
468 /** Converts an arbitrary functor to a unified type which is opaque.
469  * sigc::slot itself is a functor or to be more precise a closure. It contains
470  * a single, arbitrary functor (or closure) that is executed in operator()().
471  *
472  * The template arguments determine the function signature of operator()():
473  * - @e T_return The return type of operator()().
474  * - @e T_arg1 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
475  *
476  * To use simply assign the slot to the desired functor. If the functor
477  * is not compatible with the parameter list defined with the template
478  * arguments compiler errors are triggered. When called the slot
479  * will invoke the functor with minimal copies.
480  * block() and unblock() can be used to block the functor's invocation
481  * from operator()() temporarily.
482  *
483  * You should use the more convenient unnumbered sigc::slot template.
484  *
485  * @ingroup slot
486  */
487 /* TODO: Where put the following bit of information? I can't make any
488  *       sense of the "because", by the way!
489  *
490  * Because slot is opaque, visit_each() will not visit its internal members.
491  */
492 template <class T_return, class T_arg1>
493 class slot1
494   : public slot_base
495 {
496 public:
497   typedef T_return result_type;
498   typedef typename type_trait<T_arg1>::take arg1_type_;
499
500
501 #ifndef DOXYGEN_SHOULD_SKIP_THIS
502 private:
503   typedef internal::slot_rep rep_type;
504 public:
505   typedef T_return (*call_type)(rep_type*, arg1_type_);
506 #endif
507
508   /** Invoke the contained functor unless slot is in blocking state.
509    * @param _A_a1 Argument to be passed on to the functor.
510    * @return The return value of the functor invocation.
511    */
512   inline T_return operator()(arg1_type_ _A_a1) const
513     {
514       if (!empty() && !blocked())
515         return (reinterpret_cast<call_type>(slot_base::rep_->call_))(slot_base::rep_, _A_a1);
516       return T_return();
517     }
518
519   inline slot1() {}
520
521   /** Constructs a slot from an arbitrary functor.
522    * @param _A_func The desirer functor the new slot should be assigned to.
523    */
524   template <class T_functor>
525   slot1(const T_functor& _A_func)
526     : slot_base(new internal::typed_slot_rep<T_functor>(_A_func))
527     {
528       //The slot_base:: is necessary to stop the HP-UX aCC compiler from being confused. murrayc.
529       slot_base::rep_->call_ = internal::slot_call1<T_functor, T_return, T_arg1>::address();
530     }
531
532   slot1(const slot1& src)
533     : slot_base(src) {}
534
535   /** Overrides this slot making a copy from another slot.
536    * @param src The slot from which to make a copy.
537    * @return @p this.
538    */
539   slot1& operator=(const slot1& src)
540     { slot_base::operator=(src); return *this; }
541 };
542
543 /** Converts an arbitrary functor to a unified type which is opaque.
544  * sigc::slot itself is a functor or to be more precise a closure. It contains
545  * a single, arbitrary functor (or closure) that is executed in operator()().
546  *
547  * The template arguments determine the function signature of operator()():
548  * - @e T_return The return type of operator()().
549  * - @e T_arg1 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
550  * - @e T_arg2 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
551  *
552  * To use simply assign the slot to the desired functor. If the functor
553  * is not compatible with the parameter list defined with the template
554  * arguments compiler errors are triggered. When called the slot
555  * will invoke the functor with minimal copies.
556  * block() and unblock() can be used to block the functor's invocation
557  * from operator()() temporarily.
558  *
559  * You should use the more convenient unnumbered sigc::slot template.
560  *
561  * @ingroup slot
562  */
563 /* TODO: Where put the following bit of information? I can't make any
564  *       sense of the "because", by the way!
565  *
566  * Because slot is opaque, visit_each() will not visit its internal members.
567  */
568 template <class T_return, class T_arg1,class T_arg2>
569 class slot2
570   : public slot_base
571 {
572 public:
573   typedef T_return result_type;
574   typedef typename type_trait<T_arg1>::take arg1_type_;
575   typedef typename type_trait<T_arg2>::take arg2_type_;
576
577
578 #ifndef DOXYGEN_SHOULD_SKIP_THIS
579 private:
580   typedef internal::slot_rep rep_type;
581 public:
582   typedef T_return (*call_type)(rep_type*, arg1_type_,arg2_type_);
583 #endif
584
585   /** Invoke the contained functor unless slot is in blocking state.
586    * @param _A_a1 Argument to be passed on to the functor.
587    * @param _A_a2 Argument to be passed on to the functor.
588    * @return The return value of the functor invocation.
589    */
590   inline T_return operator()(arg1_type_ _A_a1,arg2_type_ _A_a2) const
591     {
592       if (!empty() && !blocked())
593         return (reinterpret_cast<call_type>(slot_base::rep_->call_))(slot_base::rep_, _A_a1,_A_a2);
594       return T_return();
595     }
596
597   inline slot2() {}
598
599   /** Constructs a slot from an arbitrary functor.
600    * @param _A_func The desirer functor the new slot should be assigned to.
601    */
602   template <class T_functor>
603   slot2(const T_functor& _A_func)
604     : slot_base(new internal::typed_slot_rep<T_functor>(_A_func))
605     {
606       //The slot_base:: is necessary to stop the HP-UX aCC compiler from being confused. murrayc.
607       slot_base::rep_->call_ = internal::slot_call2<T_functor, T_return, T_arg1,T_arg2>::address();
608     }
609
610   slot2(const slot2& src)
611     : slot_base(src) {}
612
613   /** Overrides this slot making a copy from another slot.
614    * @param src The slot from which to make a copy.
615    * @return @p this.
616    */
617   slot2& operator=(const slot2& src)
618     { slot_base::operator=(src); return *this; }
619 };
620
621 /** Converts an arbitrary functor to a unified type which is opaque.
622  * sigc::slot itself is a functor or to be more precise a closure. It contains
623  * a single, arbitrary functor (or closure) that is executed in operator()().
624  *
625  * The template arguments determine the function signature of operator()():
626  * - @e T_return The return type of operator()().
627  * - @e T_arg1 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
628  * - @e T_arg2 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
629  * - @e T_arg3 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
630  *
631  * To use simply assign the slot to the desired functor. If the functor
632  * is not compatible with the parameter list defined with the template
633  * arguments compiler errors are triggered. When called the slot
634  * will invoke the functor with minimal copies.
635  * block() and unblock() can be used to block the functor's invocation
636  * from operator()() temporarily.
637  *
638  * You should use the more convenient unnumbered sigc::slot template.
639  *
640  * @ingroup slot
641  */
642 /* TODO: Where put the following bit of information? I can't make any
643  *       sense of the "because", by the way!
644  *
645  * Because slot is opaque, visit_each() will not visit its internal members.
646  */
647 template <class T_return, class T_arg1,class T_arg2,class T_arg3>
648 class slot3
649   : public slot_base
650 {
651 public:
652   typedef T_return result_type;
653   typedef typename type_trait<T_arg1>::take arg1_type_;
654   typedef typename type_trait<T_arg2>::take arg2_type_;
655   typedef typename type_trait<T_arg3>::take arg3_type_;
656
657
658 #ifndef DOXYGEN_SHOULD_SKIP_THIS
659 private:
660   typedef internal::slot_rep rep_type;
661 public:
662   typedef T_return (*call_type)(rep_type*, arg1_type_,arg2_type_,arg3_type_);
663 #endif
664
665   /** Invoke the contained functor unless slot is in blocking state.
666    * @param _A_a1 Argument to be passed on to the functor.
667    * @param _A_a2 Argument to be passed on to the functor.
668    * @param _A_a3 Argument to be passed on to the functor.
669    * @return The return value of the functor invocation.
670    */
671   inline T_return operator()(arg1_type_ _A_a1,arg2_type_ _A_a2,arg3_type_ _A_a3) const
672     {
673       if (!empty() && !blocked())
674         return (reinterpret_cast<call_type>(slot_base::rep_->call_))(slot_base::rep_, _A_a1,_A_a2,_A_a3);
675       return T_return();
676     }
677
678   inline slot3() {}
679
680   /** Constructs a slot from an arbitrary functor.
681    * @param _A_func The desirer functor the new slot should be assigned to.
682    */
683   template <class T_functor>
684   slot3(const T_functor& _A_func)
685     : slot_base(new internal::typed_slot_rep<T_functor>(_A_func))
686     {
687       //The slot_base:: is necessary to stop the HP-UX aCC compiler from being confused. murrayc.
688       slot_base::rep_->call_ = internal::slot_call3<T_functor, T_return, T_arg1,T_arg2,T_arg3>::address();
689     }
690
691   slot3(const slot3& src)
692     : slot_base(src) {}
693
694   /** Overrides this slot making a copy from another slot.
695    * @param src The slot from which to make a copy.
696    * @return @p this.
697    */
698   slot3& operator=(const slot3& src)
699     { slot_base::operator=(src); return *this; }
700 };
701
702 /** Converts an arbitrary functor to a unified type which is opaque.
703  * sigc::slot itself is a functor or to be more precise a closure. It contains
704  * a single, arbitrary functor (or closure) that is executed in operator()().
705  *
706  * The template arguments determine the function signature of operator()():
707  * - @e T_return The return type of operator()().
708  * - @e T_arg1 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
709  * - @e T_arg2 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
710  * - @e T_arg3 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
711  * - @e T_arg4 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
712  *
713  * To use simply assign the slot to the desired functor. If the functor
714  * is not compatible with the parameter list defined with the template
715  * arguments compiler errors are triggered. When called the slot
716  * will invoke the functor with minimal copies.
717  * block() and unblock() can be used to block the functor's invocation
718  * from operator()() temporarily.
719  *
720  * You should use the more convenient unnumbered sigc::slot template.
721  *
722  * @ingroup slot
723  */
724 /* TODO: Where put the following bit of information? I can't make any
725  *       sense of the "because", by the way!
726  *
727  * Because slot is opaque, visit_each() will not visit its internal members.
728  */
729 template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4>
730 class slot4
731   : public slot_base
732 {
733 public:
734   typedef T_return result_type;
735   typedef typename type_trait<T_arg1>::take arg1_type_;
736   typedef typename type_trait<T_arg2>::take arg2_type_;
737   typedef typename type_trait<T_arg3>::take arg3_type_;
738   typedef typename type_trait<T_arg4>::take arg4_type_;
739
740
741 #ifndef DOXYGEN_SHOULD_SKIP_THIS
742 private:
743   typedef internal::slot_rep rep_type;
744 public:
745   typedef T_return (*call_type)(rep_type*, arg1_type_,arg2_type_,arg3_type_,arg4_type_);
746 #endif
747
748   /** Invoke the contained functor unless slot is in blocking state.
749    * @param _A_a1 Argument to be passed on to the functor.
750    * @param _A_a2 Argument to be passed on to the functor.
751    * @param _A_a3 Argument to be passed on to the functor.
752    * @param _A_a4 Argument to be passed on to the functor.
753    * @return The return value of the functor invocation.
754    */
755   inline T_return operator()(arg1_type_ _A_a1,arg2_type_ _A_a2,arg3_type_ _A_a3,arg4_type_ _A_a4) const
756     {
757       if (!empty() && !blocked())
758         return (reinterpret_cast<call_type>(slot_base::rep_->call_))(slot_base::rep_, _A_a1,_A_a2,_A_a3,_A_a4);
759       return T_return();
760     }
761
762   inline slot4() {}
763
764   /** Constructs a slot from an arbitrary functor.
765    * @param _A_func The desirer functor the new slot should be assigned to.
766    */
767   template <class T_functor>
768   slot4(const T_functor& _A_func)
769     : slot_base(new internal::typed_slot_rep<T_functor>(_A_func))
770     {
771       //The slot_base:: is necessary to stop the HP-UX aCC compiler from being confused. murrayc.
772       slot_base::rep_->call_ = internal::slot_call4<T_functor, T_return, T_arg1,T_arg2,T_arg3,T_arg4>::address();
773     }
774
775   slot4(const slot4& src)
776     : slot_base(src) {}
777
778   /** Overrides this slot making a copy from another slot.
779    * @param src The slot from which to make a copy.
780    * @return @p this.
781    */
782   slot4& operator=(const slot4& src)
783     { slot_base::operator=(src); return *this; }
784 };
785
786 /** Converts an arbitrary functor to a unified type which is opaque.
787  * sigc::slot itself is a functor or to be more precise a closure. It contains
788  * a single, arbitrary functor (or closure) that is executed in operator()().
789  *
790  * The template arguments determine the function signature of operator()():
791  * - @e T_return The return type of operator()().
792  * - @e T_arg1 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
793  * - @e T_arg2 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
794  * - @e T_arg3 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
795  * - @e T_arg4 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
796  * - @e T_arg5 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
797  *
798  * To use simply assign the slot to the desired functor. If the functor
799  * is not compatible with the parameter list defined with the template
800  * arguments compiler errors are triggered. When called the slot
801  * will invoke the functor with minimal copies.
802  * block() and unblock() can be used to block the functor's invocation
803  * from operator()() temporarily.
804  *
805  * You should use the more convenient unnumbered sigc::slot template.
806  *
807  * @ingroup slot
808  */
809 /* TODO: Where put the following bit of information? I can't make any
810  *       sense of the "because", by the way!
811  *
812  * Because slot is opaque, visit_each() will not visit its internal members.
813  */
814 template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5>
815 class slot5
816   : public slot_base
817 {
818 public:
819   typedef T_return result_type;
820   typedef typename type_trait<T_arg1>::take arg1_type_;
821   typedef typename type_trait<T_arg2>::take arg2_type_;
822   typedef typename type_trait<T_arg3>::take arg3_type_;
823   typedef typename type_trait<T_arg4>::take arg4_type_;
824   typedef typename type_trait<T_arg5>::take arg5_type_;
825
826
827 #ifndef DOXYGEN_SHOULD_SKIP_THIS
828 private:
829   typedef internal::slot_rep rep_type;
830 public:
831   typedef T_return (*call_type)(rep_type*, arg1_type_,arg2_type_,arg3_type_,arg4_type_,arg5_type_);
832 #endif
833
834   /** Invoke the contained functor unless slot is in blocking state.
835    * @param _A_a1 Argument to be passed on to the functor.
836    * @param _A_a2 Argument to be passed on to the functor.
837    * @param _A_a3 Argument to be passed on to the functor.
838    * @param _A_a4 Argument to be passed on to the functor.
839    * @param _A_a5 Argument to be passed on to the functor.
840    * @return The return value of the functor invocation.
841    */
842   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
843     {
844       if (!empty() && !blocked())
845         return (reinterpret_cast<call_type>(slot_base::rep_->call_))(slot_base::rep_, _A_a1,_A_a2,_A_a3,_A_a4,_A_a5);
846       return T_return();
847     }
848
849   inline slot5() {}
850
851   /** Constructs a slot from an arbitrary functor.
852    * @param _A_func The desirer functor the new slot should be assigned to.
853    */
854   template <class T_functor>
855   slot5(const T_functor& _A_func)
856     : slot_base(new internal::typed_slot_rep<T_functor>(_A_func))
857     {
858       //The slot_base:: is necessary to stop the HP-UX aCC compiler from being confused. murrayc.
859       slot_base::rep_->call_ = internal::slot_call5<T_functor, T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5>::address();
860     }
861
862   slot5(const slot5& src)
863     : slot_base(src) {}
864
865   /** Overrides this slot making a copy from another slot.
866    * @param src The slot from which to make a copy.
867    * @return @p this.
868    */
869   slot5& operator=(const slot5& src)
870     { slot_base::operator=(src); return *this; }
871 };
872
873 /** Converts an arbitrary functor to a unified type which is opaque.
874  * sigc::slot itself is a functor or to be more precise a closure. It contains
875  * a single, arbitrary functor (or closure) that is executed in operator()().
876  *
877  * The template arguments determine the function signature of operator()():
878  * - @e T_return The return type of operator()().
879  * - @e T_arg1 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
880  * - @e T_arg2 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
881  * - @e T_arg3 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
882  * - @e T_arg4 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
883  * - @e T_arg5 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
884  * - @e T_arg6 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
885  *
886  * To use simply assign the slot to the desired functor. If the functor
887  * is not compatible with the parameter list defined with the template
888  * arguments compiler errors are triggered. When called the slot
889  * will invoke the functor with minimal copies.
890  * block() and unblock() can be used to block the functor's invocation
891  * from operator()() temporarily.
892  *
893  * You should use the more convenient unnumbered sigc::slot template.
894  *
895  * @ingroup slot
896  */
897 /* TODO: Where put the following bit of information? I can't make any
898  *       sense of the "because", by the way!
899  *
900  * Because slot is opaque, visit_each() will not visit its internal members.
901  */
902 template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5,class T_arg6>
903 class slot6
904   : public slot_base
905 {
906 public:
907   typedef T_return result_type;
908   typedef typename type_trait<T_arg1>::take arg1_type_;
909   typedef typename type_trait<T_arg2>::take arg2_type_;
910   typedef typename type_trait<T_arg3>::take arg3_type_;
911   typedef typename type_trait<T_arg4>::take arg4_type_;
912   typedef typename type_trait<T_arg5>::take arg5_type_;
913   typedef typename type_trait<T_arg6>::take arg6_type_;
914
915
916 #ifndef DOXYGEN_SHOULD_SKIP_THIS
917 private:
918   typedef internal::slot_rep rep_type;
919 public:
920   typedef T_return (*call_type)(rep_type*, arg1_type_,arg2_type_,arg3_type_,arg4_type_,arg5_type_,arg6_type_);
921 #endif
922
923   /** Invoke the contained functor unless slot is in blocking state.
924    * @param _A_a1 Argument to be passed on to the functor.
925    * @param _A_a2 Argument to be passed on to the functor.
926    * @param _A_a3 Argument to be passed on to the functor.
927    * @param _A_a4 Argument to be passed on to the functor.
928    * @param _A_a5 Argument to be passed on to the functor.
929    * @param _A_a6 Argument to be passed on to the functor.
930    * @return The return value of the functor invocation.
931    */
932   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
933     {
934       if (!empty() && !blocked())
935         return (reinterpret_cast<call_type>(slot_base::rep_->call_))(slot_base::rep_, _A_a1,_A_a2,_A_a3,_A_a4,_A_a5,_A_a6);
936       return T_return();
937     }
938
939   inline slot6() {}
940
941   /** Constructs a slot from an arbitrary functor.
942    * @param _A_func The desirer functor the new slot should be assigned to.
943    */
944   template <class T_functor>
945   slot6(const T_functor& _A_func)
946     : slot_base(new internal::typed_slot_rep<T_functor>(_A_func))
947     {
948       //The slot_base:: is necessary to stop the HP-UX aCC compiler from being confused. murrayc.
949       slot_base::rep_->call_ = internal::slot_call6<T_functor, T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6>::address();
950     }
951
952   slot6(const slot6& src)
953     : slot_base(src) {}
954
955   /** Overrides this slot making a copy from another slot.
956    * @param src The slot from which to make a copy.
957    * @return @p this.
958    */
959   slot6& operator=(const slot6& src)
960     { slot_base::operator=(src); return *this; }
961 };
962
963 /** Converts an arbitrary functor to a unified type which is opaque.
964  * sigc::slot itself is a functor or to be more precise a closure. It contains
965  * a single, arbitrary functor (or closure) that is executed in operator()().
966  *
967  * The template arguments determine the function signature of operator()():
968  * - @e T_return The return type of operator()().
969  * - @e T_arg1 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
970  * - @e T_arg2 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
971  * - @e T_arg3 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
972  * - @e T_arg4 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
973  * - @e T_arg5 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
974  * - @e T_arg6 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
975  * - @e T_arg7 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
976  *
977  * To use simply assign the slot to the desired functor. If the functor
978  * is not compatible with the parameter list defined with the template
979  * arguments compiler errors are triggered. When called the slot
980  * will invoke the functor with minimal copies.
981  * block() and unblock() can be used to block the functor's invocation
982  * from operator()() temporarily.
983  *
984  * You should use the more convenient unnumbered sigc::slot template.
985  *
986  * @ingroup slot
987  */
988 /* TODO: Where put the following bit of information? I can't make any
989  *       sense of the "because", by the way!
990  *
991  * Because slot is opaque, visit_each() will not visit its internal members.
992  */
993 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>
994 class slot7
995   : public slot_base
996 {
997 public:
998   typedef T_return result_type;
999   typedef typename type_trait<T_arg1>::take arg1_type_;
1000   typedef typename type_trait<T_arg2>::take arg2_type_;
1001   typedef typename type_trait<T_arg3>::take arg3_type_;
1002   typedef typename type_trait<T_arg4>::take arg4_type_;
1003   typedef typename type_trait<T_arg5>::take arg5_type_;
1004   typedef typename type_trait<T_arg6>::take arg6_type_;
1005   typedef typename type_trait<T_arg7>::take arg7_type_;
1006
1007
1008 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1009 private:
1010   typedef internal::slot_rep rep_type;
1011 public:
1012   typedef T_return (*call_type)(rep_type*, arg1_type_,arg2_type_,arg3_type_,arg4_type_,arg5_type_,arg6_type_,arg7_type_);
1013 #endif
1014
1015   /** Invoke the contained functor unless slot is in blocking state.
1016    * @param _A_a1 Argument to be passed on to the functor.
1017    * @param _A_a2 Argument to be passed on to the functor.
1018    * @param _A_a3 Argument to be passed on to the functor.
1019    * @param _A_a4 Argument to be passed on to the functor.
1020    * @param _A_a5 Argument to be passed on to the functor.
1021    * @param _A_a6 Argument to be passed on to the functor.
1022    * @param _A_a7 Argument to be passed on to the functor.
1023    * @return The return value of the functor invocation.
1024    */
1025   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
1026     {
1027       if (!empty() && !blocked())
1028         return (reinterpret_cast<call_type>(slot_base::rep_->call_))(slot_base::rep_, _A_a1,_A_a2,_A_a3,_A_a4,_A_a5,_A_a6,_A_a7);
1029       return T_return();
1030     }
1031
1032   inline slot7() {}
1033
1034   /** Constructs a slot from an arbitrary functor.
1035    * @param _A_func The desirer functor the new slot should be assigned to.
1036    */
1037   template <class T_functor>
1038   slot7(const T_functor& _A_func)
1039     : slot_base(new internal::typed_slot_rep<T_functor>(_A_func))
1040     {
1041       //The slot_base:: is necessary to stop the HP-UX aCC compiler from being confused. murrayc.
1042       slot_base::rep_->call_ = internal::slot_call7<T_functor, T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7>::address();
1043     }
1044
1045   slot7(const slot7& src)
1046     : slot_base(src) {}
1047
1048   /** Overrides this slot making a copy from another slot.
1049    * @param src The slot from which to make a copy.
1050    * @return @p this.
1051    */
1052   slot7& operator=(const slot7& src)
1053     { slot_base::operator=(src); return *this; }
1054 };
1055
1056
1057 /** Convenience wrapper for the numbered sigc::slot# templates.
1058  * Slots convert arbitrary functors to unified types which are opaque.
1059  * sigc::slot itself is a functor or to be more precise a closure. It contains
1060  * a single, arbitrary functor (or closure) that is executed in operator()().
1061  *
1062  * The template arguments determine the function signature of operator()():
1063  * - @e T_return The return type of operator()().
1064  * - @e T_arg1 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
1065  * - @e T_arg2 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
1066  * - @e T_arg3 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
1067  * - @e T_arg4 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
1068  * - @e T_arg5 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
1069  * - @e T_arg6 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
1070  * - @e T_arg7 Argument type used in the definition of operator()(). The default @p nil_ means no argument.
1071  *
1072  * To use simply assign the slot to the desired functor. If the functor
1073  * is not compatible with the parameter list defined with the template
1074  * arguments compiler errors are triggered. When called the slot
1075  * will invoke the functor with minimal copies.
1076  * block() and unblock() can be used to block the functor's invocation
1077  * from operator()() temporarily.
1078  *
1079  * @par Example:
1080  *   @code
1081  *   void foo(int) {}
1082  *   sigc::slot<void, long> s = sigc::ptr_fun(&foo);
1083  *   s(19);
1084  *   @endcode
1085  *
1086  * @ingroup slot
1087  */
1088 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_>
1089 class slot 
1090   : public slot7<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7>
1091 {
1092 public:
1093   typedef slot7<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7> parent_type;
1094
1095   inline slot() {}
1096
1097   /** Constructs a slot from an arbitrary functor.
1098    * @param _A_func The desirer functor the new slot should be assigned to.
1099    */
1100   template <class T_functor>
1101   slot(const T_functor& _A_func)
1102     : parent_type(_A_func) {}
1103
1104   slot(const slot& src)
1105     : parent_type(reinterpret_cast<const parent_type&>(src)) {}
1106 };
1107
1108
1109
1110 /** Convenience wrapper for the numbered sigc::slot0 template.
1111  * See the base class for useful methods.
1112  * This is the template specialization of the unnumbered sigc::slot
1113  * template for 0 argument(s), specialized for different numbers of arguments
1114  * This is possible because the template has default (nil_) template types.
1115  */
1116 template <class T_return>
1117 class slot <T_return, nil_, nil_, nil_, nil_, nil_, nil_, nil_>
1118   : public slot0<T_return>
1119 {
1120 public:
1121   typedef slot0<T_return> parent_type;
1122
1123   inline slot() {}
1124
1125   /** Constructs a slot from an arbitrary functor.
1126    * @param _A_func The desirer functor the new slot should be assigned to.
1127    */
1128   template <class T_functor>
1129   slot(const T_functor& _A_func)
1130     : parent_type(_A_func) {}
1131
1132   slot(const slot& src)
1133     : parent_type(reinterpret_cast<const parent_type&>(src)) {}
1134 };
1135
1136
1137 /** Convenience wrapper for the numbered sigc::slot1 template.
1138  * See the base class for useful methods.
1139  * This is the template specialization of the unnumbered sigc::slot
1140  * template for 1 argument(s), specialized for different numbers of arguments
1141  * This is possible because the template has default (nil_) template types.
1142  */
1143 template <class T_return, class T_arg1>
1144 class slot <T_return, T_arg1, nil_, nil_, nil_, nil_, nil_, nil_>
1145   : public slot1<T_return, T_arg1>
1146 {
1147 public:
1148   typedef slot1<T_return, T_arg1> parent_type;
1149
1150   inline slot() {}
1151
1152   /** Constructs a slot from an arbitrary functor.
1153    * @param _A_func The desirer functor the new slot should be assigned to.
1154    */
1155   template <class T_functor>
1156   slot(const T_functor& _A_func)
1157     : parent_type(_A_func) {}
1158
1159   slot(const slot& src)
1160     : parent_type(reinterpret_cast<const parent_type&>(src)) {}
1161 };
1162
1163
1164 /** Convenience wrapper for the numbered sigc::slot2 template.
1165  * See the base class for useful methods.
1166  * This is the template specialization of the unnumbered sigc::slot
1167  * template for 2 argument(s), specialized for different numbers of arguments
1168  * This is possible because the template has default (nil_) template types.
1169  */
1170 template <class T_return, class T_arg1,class T_arg2>
1171 class slot <T_return, T_arg1, T_arg2, nil_, nil_, nil_, nil_, nil_>
1172   : public slot2<T_return, T_arg1,T_arg2>
1173 {
1174 public:
1175   typedef slot2<T_return, T_arg1,T_arg2> parent_type;
1176
1177   inline slot() {}
1178
1179   /** Constructs a slot from an arbitrary functor.
1180    * @param _A_func The desirer functor the new slot should be assigned to.
1181    */
1182   template <class T_functor>
1183   slot(const T_functor& _A_func)
1184     : parent_type(_A_func) {}
1185
1186   slot(const slot& src)
1187     : parent_type(reinterpret_cast<const parent_type&>(src)) {}
1188 };
1189
1190
1191 /** Convenience wrapper for the numbered sigc::slot3 template.
1192  * See the base class for useful methods.
1193  * This is the template specialization of the unnumbered sigc::slot
1194  * template for 3 argument(s), specialized for different numbers of arguments
1195  * This is possible because the template has default (nil_) template types.
1196  */
1197 template <class T_return, class T_arg1,class T_arg2,class T_arg3>
1198 class slot <T_return, T_arg1, T_arg2, T_arg3, nil_, nil_, nil_, nil_>
1199   : public slot3<T_return, T_arg1,T_arg2,T_arg3>
1200 {
1201 public:
1202   typedef slot3<T_return, T_arg1,T_arg2,T_arg3> parent_type;
1203
1204   inline slot() {}
1205
1206   /** Constructs a slot from an arbitrary functor.
1207    * @param _A_func The desirer functor the new slot should be assigned to.
1208    */
1209   template <class T_functor>
1210   slot(const T_functor& _A_func)
1211     : parent_type(_A_func) {}
1212
1213   slot(const slot& src)
1214     : parent_type(reinterpret_cast<const parent_type&>(src)) {}
1215 };
1216
1217
1218 /** Convenience wrapper for the numbered sigc::slot4 template.
1219  * See the base class for useful methods.
1220  * This is the template specialization of the unnumbered sigc::slot
1221  * template for 4 argument(s), specialized for different numbers of arguments
1222  * This is possible because the template has default (nil_) template types.
1223  */
1224 template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4>
1225 class slot <T_return, T_arg1, T_arg2, T_arg3, T_arg4, nil_, nil_, nil_>
1226   : public slot4<T_return, T_arg1,T_arg2,T_arg3,T_arg4>
1227 {
1228 public:
1229   typedef slot4<T_return, T_arg1,T_arg2,T_arg3,T_arg4> parent_type;
1230
1231   inline slot() {}
1232
1233   /** Constructs a slot from an arbitrary functor.
1234    * @param _A_func The desirer functor the new slot should be assigned to.
1235    */
1236   template <class T_functor>
1237   slot(const T_functor& _A_func)
1238     : parent_type(_A_func) {}
1239
1240   slot(const slot& src)
1241     : parent_type(reinterpret_cast<const parent_type&>(src)) {}
1242 };
1243
1244
1245 /** Convenience wrapper for the numbered sigc::slot5 template.
1246  * See the base class for useful methods.
1247  * This is the template specialization of the unnumbered sigc::slot
1248  * template for 5 argument(s), specialized for different numbers of arguments
1249  * This is possible because the template has default (nil_) template types.
1250  */
1251 template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5>
1252 class slot <T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, nil_, nil_>
1253   : public slot5<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5>
1254 {
1255 public:
1256   typedef slot5<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5> parent_type;
1257
1258   inline slot() {}
1259
1260   /** Constructs a slot from an arbitrary functor.
1261    * @param _A_func The desirer functor the new slot should be assigned to.
1262    */
1263   template <class T_functor>
1264   slot(const T_functor& _A_func)
1265     : parent_type(_A_func) {}
1266
1267   slot(const slot& src)
1268     : parent_type(reinterpret_cast<const parent_type&>(src)) {}
1269 };
1270
1271
1272 /** Convenience wrapper for the numbered sigc::slot6 template.
1273  * See the base class for useful methods.
1274  * This is the template specialization of the unnumbered sigc::slot
1275  * template for 6 argument(s), specialized for different numbers of arguments
1276  * This is possible because the template has default (nil_) template types.
1277  */
1278 template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5,class T_arg6>
1279 class slot <T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, nil_>
1280   : public slot6<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6>
1281 {
1282 public:
1283   typedef slot6<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6> parent_type;
1284
1285   inline slot() {}
1286
1287   /** Constructs a slot from an arbitrary functor.
1288    * @param _A_func The desirer functor the new slot should be assigned to.
1289    */
1290   template <class T_functor>
1291   slot(const T_functor& _A_func)
1292     : parent_type(_A_func) {}
1293
1294   slot(const slot& src)
1295     : parent_type(reinterpret_cast<const parent_type&>(src)) {}
1296 };
1297
1298
1299
1300 } /* namespace sigc */
1301 #endif /* _SIGC_FUNCTORS_MACROS_SLOTHM4_ */