1 #ifndef __DALI_CALLBACK_H__
2 #define __DALI_CALLBACK_H__
5 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
25 #include <dali/public-api/common/dali-common.h>
26 #include <dali/public-api/signals/functor-delegate.h>
31 * @addtogroup dali_core_signals
38 * @brief Callback base class to hold the data for callback function and member function calls.
41 class DALI_IMPORT_API CallbackBase
46 * @brief Default constructor
58 * @brief Resets the object pointer so that we know not to call methods of this object any more.
64 * @brief Function to call the function or member function dispatcher
67 * @param[in] callback The callback to call.
69 static void Execute( CallbackBase& callback )
71 // if we point to a function, we can call it directly
72 // otherwise call the dispatcher function that knows the real type of the object
73 // Note that this template dispatcher lives in client code so the library containing
74 // the code has to be loaded, otherwise we crash boom bang
75 if( callback.mImpl && callback.mImpl->mObjectPointer )
77 Dispatcher dispatcher = callback.mImpl->mMemberFunctionDispatcher;
78 (*dispatcher)( callback );
80 // its also possible to have a member function pointer to a CallbackProvider
81 // that has been deleted, so check if we have impl still
82 else if( !callback.mImpl && callback.mFunction )
84 (*(callback.mFunction))();
88 DALI_ASSERT_ALWAYS( 0 && "no function to execute" );
93 * @brief Function to call the function or member function dispatcher.
96 * @param[in] callback The callback to call.
97 * @return value from the function
99 template< typename R >
100 static R ExecuteReturn( CallbackBase& callback )
103 // if we point to a function, we can call it directly
104 // otherwise call the dispatcher function that knows the real type of the object
105 // Note that this template dispatcher lives in client code so the library containing
106 // the code has to be loaded, otherwise we crash boom bang
107 if( callback.mImpl && callback.mImpl->mObjectPointer )
109 typedef R(*Dispatcher)(CallbackBase& base);
110 Dispatcher dispatcher = reinterpret_cast< Dispatcher >( callback.mImpl->mMemberFunctionDispatcher );
111 returnVal = (*dispatcher)( callback );
113 else if( !callback.mImpl && callback.mFunction )
115 typedef R(*Function1)();
116 returnVal = (*(reinterpret_cast< Function1 >( callback.mFunction )))();
123 * @brief Function to call the function or member function dispatcher.
125 * This function template gets instantiated at the call site
127 * @param[in] callback The callback to call.
128 * @param[in] param1 The first parameter to pass into the function.
130 template< typename P1 >
131 static void Execute( CallbackBase& callback, P1 param1 )
133 // if we point to a function, we can call it directly
134 // otherwise call the dispatcher function that knows the real type of the object
135 // Note that this template dispatcher lives in client code (where the callback was created)
136 // so the library containing the code has to be loaded, otherwise we crash boom bang
137 if( callback.mImpl && callback.mImpl->mObjectPointer )
139 typedef void(*Dispatcher)(CallbackBase& base,P1);
140 Dispatcher dispatcher = reinterpret_cast< Dispatcher >( callback.mImpl->mMemberFunctionDispatcher );
141 (*dispatcher)( callback, param1 );
143 else if( !callback.mImpl && callback.mFunction )
145 // convert function type
146 typedef void(*Function1)(P1);
147 (*(reinterpret_cast< Function1 >( callback.mFunction )))( param1 );
152 * @brief Function to call the function or member function dispatcher.
154 * This function template gets instantiated at the call site
156 * @param[in] callback The callback to call.
157 * @param[in] param1 The first parameter to pass into the function.
158 * @return the value from the function
160 template< typename R, typename P1 >
161 static R ExecuteReturn( CallbackBase& callback, P1 param1 )
164 // if we point to a function, we can call it directly
165 // otherwise call the dispatcher function that knows the real type of the object
166 // Note that this template dispatcher lives in client code (where the callback was created)
167 // so the library containing the code has to be loaded, otherwise we crash boom bang
168 if( callback.mImpl && callback.mImpl->mObjectPointer )
170 typedef R(*Dispatcher)(CallbackBase& base,P1);
171 Dispatcher dispatcher = reinterpret_cast< Dispatcher >( callback.mImpl->mMemberFunctionDispatcher );
172 returnVal = (*dispatcher)( callback, param1 );
174 else if( !callback.mImpl && callback.mFunction )
176 // convert function type
177 typedef R(*Function1)(P1);
178 returnVal = (*(reinterpret_cast< Function1 >( callback.mFunction )))( param1 );
185 * @brief Function to call the function or member function dispatcher.
187 * This function template gets instantiated at the call site.
189 * @param[in] callback The callback to call.
190 * @param[in] param1 The first parameter to pass into the function.
191 * @param[in] param2 The second parameter to pass into the function.
193 template< typename P1, typename P2 >
194 static void Execute( CallbackBase& callback, P1 param1, P2 param2 )
196 // if we point to a function, we can call it directly
197 // otherwise call the dispatcher function that knows the real type of the object
198 // Note that this template dispatcher lives in client code (where the callback was created)
199 // so the library containing the code has to be loaded, otherwise we crash boom bang
200 if( callback.mImpl && callback.mImpl->mObjectPointer )
202 typedef void(*Dispatcher)(CallbackBase& base,P1,P2);
203 Dispatcher dispatcher = reinterpret_cast< Dispatcher >( callback.mImpl->mMemberFunctionDispatcher );
204 (*dispatcher)( callback, param1, param2 );
206 else if( !callback.mImpl && callback.mFunction )
208 // convert function type
209 typedef void(*Function2)(P1,P2);
210 (*(reinterpret_cast< Function2 >( callback.mFunction )))( param1, param2 );
215 * @brief Function to call the function or member function dispatcher.
217 * This function template gets instantiated at the call site
219 * @param[in] callback The callback to call.
220 * @param[in] param1 The first parameter to pass into the function.
221 * @param[in] param2 The second parameter to pass into the function.
222 * @return The return value from the function
224 template< typename R, typename P1, typename P2 >
225 static R ExecuteReturn( CallbackBase& callback, P1 param1, P2 param2 )
228 // if we point to a function, we can call it directly
229 // otherwise call the dispatcher function that knows the real type of the object
230 // Note that this template dispatcher lives in client code (where the callback was created)
231 // so the library containing the code has to be loaded, otherwise we crash boom bang
232 if( callback.mImpl && callback.mImpl->mObjectPointer )
234 typedef R(*Dispatcher)(CallbackBase& base,P1,P2);
235 Dispatcher dispatcher = reinterpret_cast< Dispatcher >( callback.mImpl->mMemberFunctionDispatcher );
236 returnVal = (*dispatcher)( callback, param1, param2 );
238 else if( !callback.mImpl && callback.mFunction )
240 // convert function type
241 typedef R(*Function2)(P1,P2);
242 returnVal = (*(reinterpret_cast< Function2 >( callback.mFunction )))( param1, param2 );
249 * @brief Function to call the function or member function dispatcher.
251 * This function template gets instantiated at the call site.
253 * @param[in] callback The callback to call.
254 * @param[in] param1 The first parameter to pass into the function.
255 * @param[in] param2 The second parameter to pass into the function.
256 * @param[in] param3 The third parameter to pass into the function.
258 template< typename P1, typename P2, typename P3 >
259 static void Execute( CallbackBase& callback, P1 param1, P2 param2, P3 param3 )
261 // if we point to a function, we can call it directly
262 // otherwise call the dispatcher function that knows the real type of the object
263 // Note that this template dispatcher lives in client code (where the callback was created)
264 // so the library containing the code has to be loaded, otherwise we crash boom bang
265 if( callback.mImpl && callback.mImpl->mObjectPointer )
267 typedef void(*Dispatcher)(CallbackBase& base,P1,P2,P3);
268 Dispatcher dispatcher = reinterpret_cast< Dispatcher >( callback.mImpl->mMemberFunctionDispatcher );
269 (*dispatcher)( callback, param1, param2, param3 );
271 else if( !callback.mImpl && callback.mFunction )
273 // convert function type
274 typedef void(*Function2)(P1,P2,P3);
275 (*(reinterpret_cast< Function2 >( callback.mFunction )))( param1, param2, param3 );
280 * @brief Function to call the function or member function dispatcher.
282 * This function template gets instantiated at the call site
284 * @param[in] callback The callback to call.
285 * @param[in] param1 The first parameter to pass into the function.
286 * @param[in] param2 The second parameter to pass into the function.
287 * @param[in] param3 The third parameter to pass into the function.
288 * @return The return value from the function
290 template< typename R, typename P1, typename P2, typename P3 >
291 static R ExecuteReturn( CallbackBase& callback, P1 param1, P2 param2, P3 param3 )
294 // if we point to a function, we can call it directly
295 // otherwise call the dispatcher function that knows the real type of the object
296 // Note that this template dispatcher lives in client code (where the callback was created)
297 // so the library containing the code has to be loaded, otherwise we crash boom bang
298 if( callback.mImpl && callback.mImpl->mObjectPointer )
300 typedef R(*Dispatcher)(CallbackBase& base,P1,P2,P3);
301 Dispatcher dispatcher = reinterpret_cast< Dispatcher >( callback.mImpl->mMemberFunctionDispatcher );
302 returnVal = (*dispatcher)( callback, param1, param2, param3 );
304 else if( !callback.mImpl && callback.mFunction )
306 // convert function type
307 typedef R(*Function2)(P1,P2,P3);
308 returnVal = (*(reinterpret_cast< Function2 >( callback.mFunction )))( param1, param2, param3 );
314 protected: // Constructors for deriving classes
317 * @brief Function with static linkage
320 typedef void(*Function)(void);
323 * @brief Member function
326 typedef void (CallbackBase::*MemberFunction)( void );
329 * @brief Used to call the correct member function
332 typedef void (*Dispatcher)( CallbackBase& base );
335 * @brief Used to destroy mObjectPointer (NULL if not mObjectPointer is not owned)
338 typedef void(*Destructor)(void* object);
341 * @brief Copy constructor operator not declared.
344 CallbackBase( const CallbackBase& rhs );
346 * @brief assignment operator not declared.
349 const CallbackBase& operator=( const CallbackBase& rhs );
352 * @brief Constructor for function with static linkage.
355 * @param[in] function The function to call.
357 CallbackBase( Function function );
360 * @brief Constructor for member function.
363 * @param[in] object The object to call (not owned).
364 * @param[in] function The member function of the object.
365 * @param[in] dispatcher Used to call the actual object.
367 CallbackBase( void* object, MemberFunction function, Dispatcher dispatcher );
370 * @brief Constructor for member function.
373 * @param[in] object The object to call (owned).
374 * @param[in] function The member function of the object.
375 * @param dispatcher Used to call the actual object.
376 * @param destructor Used to delete the owned object.
378 CallbackBase( void* object, MemberFunction function, Dispatcher dispatcher, Destructor destructor );
380 public: // Data for deriving classes & Dispatchers
383 * @brief struct to hold the extra data needed for member functions.
388 Impl(); ///< Default constructor @SINCE_1_0.0
390 void* mObjectPointer; ///< Object whose member function will be called. Not owned if mDestructorDispatcher is NULL.
391 Dispatcher mMemberFunctionDispatcher; ///< Dispatcher for member functions
392 Destructor mDestructorDispatcher; ///< Destructor for owned objects. NULL if mDestructorDispatcher is not owned.
394 Impl* mImpl; ///< Implementation pointer
398 MemberFunction mMemberFunction; ///< Pointer to member function
399 Function mFunction; ///< Static function
404 * @brief Non-member equality operator
407 bool operator==( const CallbackBase& lhs, const CallbackBase& rhs );
410 * @brief Dispatcher to delete an object.
417 * @brief Dispatcher to delete an object.
420 static void Delete( void* object )
422 // CallbackBase owns the object but we're the only one who knows the real type so need
423 // to delete by "downcasting" from void* to the correct type
424 delete reinterpret_cast< T* >( object );
429 * @brief Dispatcher to call the actual member function.
436 * @brief Call an actual member function.
439 * @param[in] callback The callback information.
441 static void Dispatch( CallbackBase& callback )
443 // "downcast" the object and function type back to the correct ones
444 T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
445 typedef void(T::*MemberFunction)(void);
446 MemberFunction function = reinterpret_cast< MemberFunction >( callback.mMemberFunction );
447 (object->*function)();
452 * @brief Dispatcher to call the actual member function.
455 template< class T, typename P1 >
459 * @brief Call an actual member function.
462 * @param[in] callback The callback information.
463 * @param[in] param1 The first parameter to pass to the real member function.
465 static void Dispatch( CallbackBase& callback, P1 param1 )
467 // "downcast" the object and function type back to the correct ones
468 T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
469 typedef void(T::*MemberFunction)(P1);
470 MemberFunction function = reinterpret_cast< MemberFunction >( callback.mMemberFunction );
471 (object->*function)( param1 );
476 * @brief Dispatcher to call the actual member function.
479 template< class T, typename P1, typename P2 >
483 * @brief Call an actual member function.
486 * @param[in] callback The callback information.
487 * @param[in] param1 The first parameter to pass to the real member function.
488 * @param[in] param2 The second parameter to pass to the real member function.
490 static void Dispatch( CallbackBase& callback, P1 param1, P2 param2 )
492 // "downcast" the object and function type back to the correct ones
493 T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
494 typedef void(T::*MemberFunction)(P1, P2);
495 MemberFunction function = reinterpret_cast< MemberFunction >( callback.mMemberFunction );
496 (object->*function)( param1, param2 );
501 * @brief Dispatcher to call the actual member function.
504 template< class T, typename P1, typename P2, typename P3 >
508 * @brief Call an actual member function.
511 * @param[in] callback The callback information.
512 * @param[in] param1 The first parameter to pass to the real member function.
513 * @param[in] param2 The second parameter to pass to the real member function.
514 * @param[in] param3 The third parameter to pass to the real member function.
516 static void Dispatch( CallbackBase& callback, P1 param1, P2 param2, P3 param3 )
518 // "downcast" the object and function type back to the correct ones
519 T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
520 typedef void(T::*MemberFunction)(P1, P2, P3);
521 MemberFunction function = reinterpret_cast< MemberFunction >( callback.mMemberFunction );
522 (object->*function)( param1, param2, param3 );
527 * @brief Dispatcher to call the actual member function.
530 template< class T, typename R >
531 struct DispatcherReturn0
534 * @brief Call an actual member function.
537 * @param[in] callback The callback information.
540 static R Dispatch( CallbackBase& callback )
542 // "downcast" the object and function type back to the correct ones
543 T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
544 typedef R(T::*MemberFunction)(void);
545 MemberFunction function = reinterpret_cast< MemberFunction >( callback.mMemberFunction );
546 return (object->*function)();
551 * @brief Dispatcher to call the actual member function.
554 template< class T, typename R, typename P1 >
555 struct DispatcherReturn1
558 * @brief Call an actual member function.
561 * @param[in] callback The callback information.
562 * @param[in] param1 The first parameter to pass to the real member function.
563 * @return The return value from the function
565 static R Dispatch( CallbackBase& callback, P1 param1 )
567 // "downcast" the object and function type back to the correct ones
568 T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
569 typedef R(T::*MemberFunction)(P1);
570 MemberFunction function = reinterpret_cast< MemberFunction >( callback.mMemberFunction );
571 return (object->*function)( param1 );
576 * @brief Dispatcher to call the actual member function.
579 template< class T, typename R, typename P1, typename P2 >
580 struct DispatcherReturn2
583 * @brief Call an actual member function.
586 * @param[in] callback The callback information.
587 * @param[in] param1 The first parameter to pass to the real member function.
588 * @param[in] param2 The second parameter to pass to the real member function.
589 * @return The return value from the function
591 static R Dispatch( CallbackBase& callback, P1 param1, P2 param2 )
593 // "downcast" the object and function type back to the correct ones
594 T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
595 typedef R(T::*MemberFunction)(P1, P2);
596 MemberFunction function = reinterpret_cast< MemberFunction >( callback.mMemberFunction );
597 return (object->*function)( param1, param2 );
602 * @brief Dispatcher to call the actual member function.
605 template< class T, typename R, typename P1, typename P2, typename P3 >
606 struct DispatcherReturn3
609 * @brief Call an actual member function.
612 * @param[in] callback The callback information.
613 * @param[in] param1 The first parameter to pass to the real member function.
614 * @param[in] param2 The second parameter to pass to the real member function.
615 * @param[in] param3 The third parameter to pass to the real member function.
616 * @return The return value from the function
618 static R Dispatch( CallbackBase& callback, P1 param1, P2 param2, P3 param3 )
620 // "downcast" the object and function type back to the correct ones
621 T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
622 typedef R(T::*MemberFunction)(P1, P2, P3);
623 MemberFunction function = reinterpret_cast< MemberFunction >( callback.mMemberFunction );
624 return (object->*function)( param1, param2, param3 );
629 * @brief Dispatcher to call a functor.
633 struct FunctorDispatcher0
636 * @brief Call a function object.
639 * @param[in] callback The callback information.
641 static void Dispatch( CallbackBase& callback )
643 // "downcast" the object and function type back to the correct ones
644 T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
650 * @brief Dispatcher to call a functor.
653 template< class T, typename P1 >
654 struct FunctorDispatcher1
657 * @brief Call a function object.
660 * @param[in] callback The callback information.
661 * @param[in] param1 The first parameter to pass to the real member function.
663 static void Dispatch( CallbackBase& callback, P1 param1 )
665 // "downcast" the object and function type back to the correct ones
666 T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
672 * @brief Dispatcher to call a functor.
675 template< class T, typename P1, typename P2 >
676 struct FunctorDispatcher2
679 * @brief Call a function object.
682 * @param[in] callback The callback information.
683 * @param[in] param1 The first parameter to pass to the real member function.
684 * @param[in] param2 The second parameter to pass to the real member function.
686 static void Dispatch( CallbackBase& callback, P1 param1, P2 param2 )
688 // "downcast" the object and function type back to the correct ones
689 T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
690 (*object)( param1, param2 );
695 * @brief Dispatcher to call a functor.
698 template< class T, typename P1, typename P2, typename P3 >
699 struct FunctorDispatcher3
702 * @brief Call a function object.
705 * @param[in] callback The callback information.
706 * @param[in] param1 The first parameter to pass to the real member function.
707 * @param[in] param2 The second parameter to pass to the real member function.
708 * @param[in] param3 The third parameter to pass to the real member function.
710 static void Dispatch( CallbackBase& callback, P1 param1, P2 param2, P3 param3 )
712 // "downcast" the object and function type back to the correct ones
713 T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
714 (*object)( param1, param2, param3 );
719 * @brief Dispatcher to call a functor.
722 template< class T, typename R >
723 struct FunctorDispatcherReturn0
726 * @brief Call a function object.
729 * @param[in] callback The callback information.
732 static R Dispatch( CallbackBase& callback )
734 // "downcast" the object and function type back to the correct ones
735 T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
741 * @brief Dispatcher to call a functor.
744 template< class T, typename R, typename P1 >
745 struct FunctorDispatcherReturn1
748 * @brief Call a function object.
751 * @param[in] callback The callback information.
752 * @param[in] param1 The first parameter to pass to the real member function.
753 * @return The return value from the function
755 static R Dispatch( CallbackBase& callback, P1 param1 )
757 // "downcast" the object and function type back to the correct ones
758 T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
759 return (*object)( param1 );
764 * @brief Dispatcher to call a functor.
767 template< class T, typename R, typename P1, typename P2 >
768 struct FunctorDispatcherReturn2
771 * @brief Call a function object.
774 * @param[in] callback The callback information.
775 * @param[in] param1 The first parameter to pass to the real member function.
776 * @param[in] param2 The second parameter to pass to the real member function.
777 * @return The return value from the function
779 static R Dispatch( CallbackBase& callback, P1 param1, P2 param2 )
781 // "downcast" the object and function type back to the correct ones
782 T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
783 return (*object)( param1, param2 );
788 * @brief Dispatcher to call a functor.
791 template< class T, typename R, typename P1, typename P2, typename P3 >
792 struct FunctorDispatcherReturn3
795 * @brief Call a function object.
798 * @param[in] callback The callback information.
799 * @param[in] param1 The first parameter to pass to the real member function.
800 * @param[in] param2 The second parameter to pass to the real member function.
801 * @param[in] param3 The third parameter to pass to the real member function.
802 * @return The return value from the function
804 static R Dispatch( CallbackBase& callback, P1 param1, P2 param2, P3 param3 )
806 // "downcast" the object and function type back to the correct ones
807 T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
808 return (*object)( param1, param2, param3 );
813 * @brief Dispatcher to call a functor.
815 * This variant calls a specific void() member function.
819 struct VoidFunctorDispatcher0
822 * @brief Call a function object.
825 * @param[in] callback The callback information.
827 static void Dispatch( CallbackBase& callback )
829 // "downcast" the object and function type back to the correct ones
830 T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
831 typedef void(T::*MemberFunction)(void);
832 MemberFunction function = reinterpret_cast< MemberFunction >( callback.mMemberFunction );
833 (object->*function)();
838 * @brief Dispatcher to call a functor.
840 * This variant calls a void() member, ignoring any signal parameters
843 template< class T, typename P1 >
844 struct VoidFunctorDispatcher1
847 * @brief Call a function object.
850 * @param[in] callback The callback information.
851 * @param[in] param1 The first parameter to pass to the real member function.
853 static void Dispatch( CallbackBase& callback, P1 param1 )
855 // "downcast" the object and function type back to the correct ones
856 T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
857 typedef void(T::*MemberFunction)(void);
858 MemberFunction function = reinterpret_cast< MemberFunction >( callback.mMemberFunction );
859 (object->*function)(/*ignore params*/);
864 * @brief Dispatcher to call a functor.
866 * This variant calls a void() member, ignoring any signal parameters
869 template< class T, typename P1, typename P2 >
870 struct VoidFunctorDispatcher2
873 * @brief Call a function object.
876 * @param[in] callback The callback information.
877 * @param[in] param1 The first parameter to pass to the real member function.
878 * @param[in] param2 The second parameter to pass to the real member function.
880 static void Dispatch( CallbackBase& callback, P1 param1, P2 param2 )
882 // "downcast" the object and function type back to the correct ones
883 T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
884 typedef void(T::*MemberFunction)(void);
885 MemberFunction function = reinterpret_cast< MemberFunction >( callback.mMemberFunction );
886 (object->*function)(/*ignore params*/);
891 * @brief Dispatcher to call a functor.
893 * This variant calls a void() member, ignoring any signal parameters
896 template< class T, typename P1, typename P2, typename P3 >
897 struct VoidFunctorDispatcher3
900 * @brief Call a function object.
903 * @param[in] callback The callback information.
904 * @param[in] param1 The first parameter to pass to the real member function.
905 * @param[in] param2 The second parameter to pass to the real member function.
906 * @param[in] param3 The third parameter to pass to the real member function.
908 static void Dispatch( CallbackBase& callback, P1 param1, P2 param2, P3 param3 )
910 // "downcast" the object and function type back to the correct ones
911 T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
912 typedef void(T::*MemberFunction)(void);
913 MemberFunction function = reinterpret_cast< MemberFunction >( callback.mMemberFunction );
914 (object->*function)(/*ignore params*/);
919 * @brief Dispatcher to call a functor.
921 * This variant calls a void() member, and returns a default-constructed value
924 template< class T, typename R >
925 struct VoidFunctorDispatcherReturn0
928 * @brief Call a function object.
931 * @param[in] callback The callback information.
934 static R Dispatch( CallbackBase& callback )
936 // "downcast" the object and function type back to the correct ones
937 T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
938 typedef void(T::*MemberFunction)(void);
939 MemberFunction function = reinterpret_cast< MemberFunction >( callback.mMemberFunction );
940 (object->*function)(/*ignore params*/);
946 * @brief Dispatcher to call a functor.
948 * This variant calls a void() member, and returns a default-constructed value
951 template< class T, typename R, typename P1 >
952 struct VoidFunctorDispatcherReturn1
955 * @brief Call a function object.
958 * @param[in] callback The callback information.
959 * @param[in] param1 The first parameter to pass to the real member function.
960 * @return The return value from the function
962 static R Dispatch( CallbackBase& callback, P1 param1 )
964 // "downcast" the object and function type back to the correct ones
965 T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
966 typedef void(T::*MemberFunction)(void);
967 MemberFunction function = reinterpret_cast< MemberFunction >( callback.mMemberFunction );
968 (object->*function)(/*ignore params*/);
974 * @brief Dispatcher to call a functor.
976 * This variant calls a void() member, and returns a default-constructed value
979 template< class T, typename R, typename P1, typename P2 >
980 struct VoidFunctorDispatcherReturn2
983 * @brief Call a function object.
986 * @param[in] callback The callback information.
987 * @param[in] param1 The first parameter to pass to the real member function.
988 * @param[in] param2 The second parameter to pass to the real member function.
989 * @return The return value from the function
991 static R Dispatch( CallbackBase& callback, P1 param1, P2 param2 )
993 // "downcast" the object and function type back to the correct ones
994 T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
995 typedef void(T::*MemberFunction)(void);
996 MemberFunction function = reinterpret_cast< MemberFunction >( callback.mMemberFunction );
997 (object->*function)(/*ignore params*/);
1003 * @brief Dispatcher to call a functor.
1005 * This variant calls a void() member, and returns a default-constructed value
1008 template< class T, typename R, typename P1, typename P2, typename P3 >
1009 struct VoidFunctorDispatcherReturn3
1012 * @brief Call a function object.
1015 * @param[in] callback The callback information.
1016 * @param[in] param1 The first parameter to pass to the real member function.
1017 * @param[in] param2 The second parameter to pass to the real member function.
1018 * @param[in] param3 The third parameter to pass to the real member function.
1019 * @return The return value from the function
1021 static R Dispatch( CallbackBase& callback, P1 param1, P2 param2, P3 param3 )
1023 // "downcast" the object and function type back to the correct ones
1024 T* object = reinterpret_cast< T* >( callback.mImpl->mObjectPointer );
1025 typedef void(T::*MemberFunction)(void);
1026 MemberFunction function = reinterpret_cast< MemberFunction >( callback.mMemberFunction );
1027 (object->*function)(/*ignore params*/);
1033 * @brief Thin template to provide type safety for member function callbacks.
1035 * version with two parameters and return value
1039 class Callback : public CallbackBase
1044 * @brief Default constructor.
1054 * @brief Constructor for member function.
1056 * Copies the function object.
1058 * @param[in] object The object to call.
1059 * @param[in] memberFunction The member function of the object.
1061 Callback( T* object, void(T::*memberFunction)(void) )
1062 : CallbackBase( object,
1063 reinterpret_cast< CallbackBase::MemberFunction >( memberFunction ),
1064 reinterpret_cast< CallbackBase::Dispatcher >( &Dispatcher0<T>::Dispatch ) ) { }
1065 template< typename P1 >
1066 Callback( T* object, void(T::*memberFunction)(P1) )
1067 : CallbackBase( object,
1068 reinterpret_cast< CallbackBase::MemberFunction >( memberFunction ),
1069 reinterpret_cast< CallbackBase::Dispatcher >( &Dispatcher1<T,P1>::Dispatch ) ) { }
1070 template< typename P1, typename P2 >
1071 Callback( T* object, void(T::*memberFunction)(P1, P2) )
1072 : CallbackBase( object,
1073 reinterpret_cast< CallbackBase::MemberFunction >( memberFunction ),
1074 reinterpret_cast< CallbackBase::Dispatcher >( &Dispatcher2<T,P1,P2>::Dispatch ) ) { }
1075 template< typename P1, typename P2, typename P3 >
1076 Callback( T* object, void(T::*memberFunction)(P1, P2, P3) )
1077 : CallbackBase( object,
1078 reinterpret_cast< CallbackBase::MemberFunction >( memberFunction ),
1079 reinterpret_cast< CallbackBase::Dispatcher >( &Dispatcher3<T,P1,P2,P3>::Dispatch ) ) { }
1080 template< typename R >
1081 Callback( T* object, R(T::*memberFunction)(void) )
1082 : CallbackBase( object,
1083 reinterpret_cast< CallbackBase::MemberFunction >( memberFunction ),
1084 reinterpret_cast< CallbackBase::Dispatcher >( &DispatcherReturn0<T,R>::Dispatch ) ) { }
1085 template< typename R, typename P1 >
1086 Callback( T* object, R(T::*memberFunction)(P1) )
1087 : CallbackBase( object,
1088 reinterpret_cast< CallbackBase::MemberFunction >( memberFunction ),
1089 reinterpret_cast< CallbackBase::Dispatcher >( &DispatcherReturn1<T,R,P1>::Dispatch ) ) { }
1090 template< typename R, typename P1, typename P2 >
1091 Callback( T* object, R(T::*memberFunction)(P1, P2) )
1092 : CallbackBase( object,
1093 reinterpret_cast< CallbackBase::MemberFunction >( memberFunction ),
1094 reinterpret_cast< CallbackBase::Dispatcher >( &DispatcherReturn2<T,R,P1,P2>::Dispatch ) ) { }
1095 template< typename R, typename P1, typename P2, typename P3 >
1096 Callback( T* object, R(T::*memberFunction)(P1, P2, P3) )
1097 : CallbackBase( object,
1098 reinterpret_cast< CallbackBase::MemberFunction >( memberFunction ),
1099 reinterpret_cast< CallbackBase::Dispatcher >( &DispatcherReturn3<T,R,P1,P2,P3>::Dispatch ) ) { }
1104 * @brief Specializations for static function callbacks.
1107 class CallbackFunction : public CallbackBase
1112 * @brief Default constructor.
1121 * @brief Constructors for functions with static linkage.
1124 * @param[in] function The function to call.
1126 CallbackFunction( void(*function)() )
1127 : CallbackBase( reinterpret_cast< CallbackBase::Function >( function ) )
1129 template< typename R >
1130 CallbackFunction( R(*function)() )
1131 : CallbackBase( reinterpret_cast< CallbackBase::Function >( function ) )
1133 template< typename P1 >
1134 CallbackFunction( void(*function)(P1) )
1135 : CallbackBase( reinterpret_cast< CallbackBase::Function >( function ) )
1137 template< typename P1, typename R >
1138 CallbackFunction( R(*function)(P1) )
1139 : CallbackBase( reinterpret_cast< CallbackBase::Function >( function ) )
1141 template< typename P1, typename P2 >
1142 CallbackFunction( void(*function)(P1,P2) )
1143 : CallbackBase( reinterpret_cast< CallbackBase::Function >( function ) )
1145 template< typename P1, typename P2, typename R >
1146 CallbackFunction( R(*function)(P1,P2) )
1147 : CallbackBase( reinterpret_cast< CallbackBase::Function >( function ) )
1149 template< typename P1, typename P2, typename P3 >
1150 CallbackFunction( void(*function)(P1,P2,P3) )
1151 : CallbackBase( reinterpret_cast< CallbackBase::Function >( function ) )
1153 template< typename P1, typename P2, typename P3, typename R >
1154 CallbackFunction( R(*function)(P1,P2,P3) )
1155 : CallbackBase( reinterpret_cast< CallbackBase::Function >( function ) )
1161 * @brief Specializations for function object callbacks.
1165 class CallbackFunctor0 : public CallbackBase
1170 * @brief Constructor which copies a function object.
1173 * @param[in] object The object to copy.
1175 CallbackFunctor0( const T& object )
1176 : CallbackBase( reinterpret_cast< void* >( new T( object ) ), // copy the object
1177 NULL, // uses operator() instead of member function
1178 reinterpret_cast< CallbackBase::Dispatcher >( &FunctorDispatcher0<T>::Dispatch ),
1179 reinterpret_cast< CallbackBase::Destructor >( &Destroyer<T>::Delete ) ) { }
1183 * @brief Function object callback for connecting void() methods
1186 class CallbackFunctorDelegate0 : public CallbackBase
1191 * @brief Constructor which copies a function object.
1193 * This variant calls a void() member, ignoring any signal parameters.
1195 * @param[in] object A newly allocated object (ownership is transferred).
1197 CallbackFunctorDelegate0( FunctorDelegate* object )
1198 : CallbackBase( reinterpret_cast< void* >( object ), // transfer ownership
1199 reinterpret_cast< CallbackBase::MemberFunction >( &FunctorDelegate::Execute ),
1200 reinterpret_cast< CallbackBase::Dispatcher >( &VoidFunctorDispatcher0<FunctorDelegate>::Dispatch ),
1201 reinterpret_cast< CallbackBase::Destructor >( &Destroyer<FunctorDelegate>::Delete ) ) { }
1205 * @brief Function object callback for matching callbacks to signal signature.
1208 template< class T, typename P1 >
1209 class CallbackFunctor1 : public CallbackBase
1214 * @brief Constructor which copies a function object.
1217 * @param[in] object The object to copy.
1219 CallbackFunctor1( const T& object )
1220 : CallbackBase( reinterpret_cast< void* >( new T( object ) ), // copy the object
1221 NULL, // uses operator() instead of member function
1222 reinterpret_cast< CallbackBase::Dispatcher >( &FunctorDispatcher1<T,P1>::Dispatch ),
1223 reinterpret_cast< CallbackBase::Destructor >( &Destroyer<T>::Delete ) ) { }
1227 * @brief Function object callback for connecting void() methods.
1230 template< typename P1 >
1231 class CallbackFunctorDelegate1 : public CallbackBase
1236 * @brief Constructor which copies a function object.
1238 * This variant calls a void() member, ignoring any signal parameters.
1240 * @param[in] object The object to copy.
1242 CallbackFunctorDelegate1( FunctorDelegate* object )
1243 : CallbackBase( reinterpret_cast< void* >( object ), // transfer ownership
1244 reinterpret_cast< CallbackBase::MemberFunction >( &FunctorDelegate::Execute ),
1245 reinterpret_cast< CallbackBase::Dispatcher >( &VoidFunctorDispatcher1<FunctorDelegate,P1>::Dispatch ),
1246 reinterpret_cast< CallbackBase::Destructor >( &Destroyer<FunctorDelegate>::Delete ) ) { }
1250 * @brief Function object callback for matching callbacks to signal signature
1253 template< class T, typename P1, typename P2 >
1254 class CallbackFunctor2 : public CallbackBase
1259 * @brief Constructor which copies a function object.
1262 * @param[in] object The object to copy.
1264 CallbackFunctor2( const T& object )
1265 : CallbackBase( reinterpret_cast< void* >( new T( object ) ), // copy the object
1266 NULL, // uses operator() instead of member function
1267 reinterpret_cast< CallbackBase::Dispatcher >( &FunctorDispatcher2<T,P1,P2>::Dispatch ),
1268 reinterpret_cast< CallbackBase::Destructor >( &Destroyer<T>::Delete ) ) { }
1272 * @brief Function object callback for connecting void() methods
1275 template< typename P1, typename P2 >
1276 class CallbackFunctorDelegate2 : public CallbackBase
1281 * @brief Constructor which copies a function object.
1283 * This variant calls a void() member, ignoring any signal parameters.
1285 * @param[in] object The object to copy.
1287 CallbackFunctorDelegate2( FunctorDelegate* object )
1288 : CallbackBase( reinterpret_cast< void* >( object ), // transfer ownership
1289 reinterpret_cast< CallbackBase::MemberFunction >( &FunctorDelegate::Execute ),
1290 reinterpret_cast< CallbackBase::Dispatcher >( &VoidFunctorDispatcher2<FunctorDelegate,P1,P2>::Dispatch ),
1291 reinterpret_cast< CallbackBase::Destructor >( &Destroyer<FunctorDelegate>::Delete ) ) { }
1295 * @brief Function object callback for matching callbacks to signal signature
1298 template< class T, typename P1, typename P2, typename P3 >
1299 class CallbackFunctor3 : public CallbackBase
1304 * @brief Constructor which copies a function object.
1307 * @param[in] object The object to copy.
1309 CallbackFunctor3( const T& object )
1310 : CallbackBase( reinterpret_cast< void* >( new T( object ) ), // copy the object
1311 NULL, // uses operator() instead of member function
1312 reinterpret_cast< CallbackBase::Dispatcher >( &FunctorDispatcher3<T,P1,P2,P3>::Dispatch ),
1313 reinterpret_cast< CallbackBase::Destructor >( &Destroyer<T>::Delete ) ) { }
1317 * @brief Function object callback for connecting void() methods
1320 template< typename P1, typename P2, typename P3 >
1321 class CallbackFunctorDelegate3 : public CallbackBase
1327 * @brief Constructor which copies a function object.
1329 * This variant calls a void() member, ignoring any signal parameters.
1331 * @param[in] object The object to copy.
1333 CallbackFunctorDelegate3( FunctorDelegate* object )
1334 : CallbackBase( reinterpret_cast< void* >( object ), // transfer ownership
1335 reinterpret_cast< CallbackBase::MemberFunction >( &FunctorDelegate::Execute ),
1336 reinterpret_cast< CallbackBase::Dispatcher >( &VoidFunctorDispatcher3<FunctorDelegate,P1,P2,P3>::Dispatch ),
1337 reinterpret_cast< CallbackBase::Destructor >( &Destroyer<FunctorDelegate>::Delete ) ) { }
1341 * @brief Function object callback for matching callbacks to signal signature
1344 template< class T, typename R >
1345 class CallbackFunctorReturn0 : public CallbackBase
1350 * @brief Constructor which copies a function object.
1353 * @param[in] object The object to copy.
1355 CallbackFunctorReturn0( const T& object )
1356 : CallbackBase( reinterpret_cast< void* >( new T( object ) ), // copy the object
1357 NULL, // uses operator() instead of member function
1358 reinterpret_cast< CallbackBase::Dispatcher >( &FunctorDispatcherReturn0<T,R>::Dispatch ),
1359 reinterpret_cast< CallbackBase::Destructor >( &Destroyer<T>::Delete ) ) { }
1363 * @brief Function object callback for connecting void() methods
1366 template< typename R >
1367 class CallbackFunctorDelegateReturn0 : public CallbackBase
1372 * @brief Constructor which copies a function object.
1374 * This variant calls a void() member, ignoring any signal parameters.
1376 * @param[in] object The object to copy.
1378 CallbackFunctorDelegateReturn0( FunctorDelegate* object )
1379 : CallbackBase( reinterpret_cast< void* >( object ), // transfer ownership
1380 reinterpret_cast< CallbackBase::MemberFunction >( &FunctorDelegate::Execute ),
1381 reinterpret_cast< CallbackBase::Dispatcher >( &VoidFunctorDispatcherReturn0<FunctorDelegate,R>::Dispatch ),
1382 reinterpret_cast< CallbackBase::Destructor >( &Destroyer<FunctorDelegate>::Delete ) ) { }
1386 * @brief Function object callback for matching callbacks to signal signature
1389 template< class T, typename P1, typename R >
1390 class CallbackFunctorReturn1 : public CallbackBase
1395 * @brief Constructor which copies a function object.
1398 * @param[in] object The object to copy.
1400 CallbackFunctorReturn1( const T& object )
1401 : CallbackBase( reinterpret_cast< void* >( new T( object ) ), // copy the object
1402 NULL, // uses operator() instead of member function
1403 reinterpret_cast< CallbackBase::Dispatcher >( &FunctorDispatcherReturn1<T,R,P1>::Dispatch ),
1404 reinterpret_cast< CallbackBase::Destructor >( &Destroyer<T>::Delete ) ) { }
1408 * @brief Function object callback for connecting void() methods
1411 template< typename P1, typename R >
1412 class CallbackFunctorDelegateReturn1 : public CallbackBase
1417 * @brief Constructor which copies a function object.
1419 * This variant calls a void() member, ignoring any signal parameters.
1421 * @param[in] object The object to copy.
1423 CallbackFunctorDelegateReturn1( FunctorDelegate* object )
1424 : CallbackBase( reinterpret_cast< void* >( object ), // transfer ownership
1425 reinterpret_cast< CallbackBase::MemberFunction >( &FunctorDelegate::Execute ),
1426 reinterpret_cast< CallbackBase::Dispatcher >( &VoidFunctorDispatcherReturn1<FunctorDelegate,R,P1>::Dispatch ),
1427 reinterpret_cast< CallbackBase::Destructor >( &Destroyer<FunctorDelegate>::Delete ) ) { }
1431 * @brief Function object callback for matching callbacks to signal signature
1434 template< class T, typename P1, typename P2, typename R >
1435 class CallbackFunctorReturn2 : public CallbackBase
1440 * @brief Constructor which copies a function object.
1443 * @param[in] object The object to copy.
1445 CallbackFunctorReturn2( const T& object )
1446 : CallbackBase( reinterpret_cast< void* >( new T( object ) ), // copy the object
1447 NULL, // uses operator() instead of member function
1448 reinterpret_cast< CallbackBase::Dispatcher >( &FunctorDispatcherReturn2<T,R,P1,P2>::Dispatch ),
1449 reinterpret_cast< CallbackBase::Destructor >( &Destroyer<T>::Delete ) ) { }
1453 * @brief Function object callback for connecting void() methods
1456 template< typename P1, typename P2, typename R >
1457 class CallbackFunctorDelegateReturn2 : public CallbackBase
1462 * @brief Constructor which copies a function object.
1464 * This variant calls a void() member, ignoring any signal parameters.
1466 * @param[in] object The object to copy.
1468 CallbackFunctorDelegateReturn2( FunctorDelegate* object )
1469 : CallbackBase( reinterpret_cast< void* >( object ), // transfer ownership
1470 reinterpret_cast< CallbackBase::MemberFunction >( &FunctorDelegate::Execute ),
1471 reinterpret_cast< CallbackBase::Dispatcher >( &VoidFunctorDispatcherReturn2<FunctorDelegate,R,P1,P2>::Dispatch ),
1472 reinterpret_cast< CallbackBase::Destructor >( &Destroyer<FunctorDelegate>::Delete ) ) { }
1476 * @brief Function object callback for matching callbacks to signal signature
1479 template< class T, typename P1, typename P2, typename P3, typename R >
1480 class CallbackFunctorReturn3 : public CallbackBase
1485 * @brief Constructor which copies a function object.
1488 * @param[in] object The object to copy.
1490 CallbackFunctorReturn3( const T& object )
1491 : CallbackBase( reinterpret_cast< void* >( new T( object ) ), // copy the object
1492 NULL, // uses operator() instead of member function
1493 reinterpret_cast< CallbackBase::Dispatcher >( &FunctorDispatcherReturn3<T,R,P1,P2,P3>::Dispatch ),
1494 reinterpret_cast< CallbackBase::Destructor >( &Destroyer<T>::Delete ) ) { }
1498 * @brief Function object callback for connecting void() methods
1501 template< typename P1, typename P2, typename P3, typename R >
1502 class CallbackFunctorDelegateReturn3 : public CallbackBase
1507 * @brief Constructor which copies a function object.
1509 * This variant calls a void() member, ignoring any signal parameters.
1511 * @param[in] object The object to copy.
1513 CallbackFunctorDelegateReturn3( FunctorDelegate* object )
1514 : CallbackBase( reinterpret_cast< void* >( object ), // transfer ownership
1515 reinterpret_cast< CallbackBase::MemberFunction >( &FunctorDelegate::Execute ),
1516 reinterpret_cast< CallbackBase::Dispatcher >( &VoidFunctorDispatcherReturn3<FunctorDelegate,R,P1,P2,P3>::Dispatch ),
1517 reinterpret_cast< CallbackBase::Destructor >( &Destroyer<FunctorDelegate>::Delete ) ) { }
1520 // Callback creation thin templates
1523 * @brief Creates a callback from a C function or static member function with no parameters.
1526 * @param[in] function The function to call.
1527 * @return a newly allocated Callback object, ownership transferred to caller
1529 inline CallbackBase* MakeCallback( void(*function)(void) )
1531 return new CallbackFunction( function );
1535 * @brief Creates a callback from a C function or static member function with one parameter.
1538 * @param[in] function The function to call.
1539 * @return a newly allocated Callback object, ownership transferred to caller
1541 template< typename P1 >
1542 inline CallbackBase* MakeCallback( void(*function)(P1) )
1544 return new CallbackFunction( function );
1548 * @brief Creates a callback from a C function or static member function with no parameters and a return type.
1551 * @param[in] function The function to call.
1552 * @return a newly allocated Callback object, ownership transferred to caller
1554 template< typename R >
1555 inline CallbackBase* MakeCallback( R(*function)(void) )
1557 return new CallbackFunction( function );
1561 * @brief Creates a callback from a C function or static member function with one parameter and a return type.
1564 * @param[in] function The function to call.
1565 * @return a newly allocated Callback object, ownership transferred to caller
1567 template< typename R, typename P1 >
1568 inline CallbackBase* MakeCallback( R(*function)(P1) )
1570 return new CallbackFunction( function );
1574 * @brief Creates a callback from a C function or static member function with two parameters.
1577 * @param[in] function The function to call.
1578 * @return a newly allocated Callback object, ownership transferred to caller
1580 template< typename P1, typename P2 >
1581 inline CallbackBase* MakeCallback( void(*function)(P1,P2) )
1583 return new CallbackFunction( function );
1587 * @brief Creates a callback from a C function or static member function with two parameters and a return type.
1590 * @param[in] function The function to call.
1591 * @return a newly allocated Callback object, ownership transferred to caller
1593 template< typename R, typename P1, typename P2 >
1594 inline CallbackBase* MakeCallback( R(*function)(P1,P2) )
1596 return new CallbackFunction( function );
1600 * @brief Creates a callback from a C function or static member function with three parameters.
1603 * @param[in] function The function to call.
1604 * @return a newly allocated Callback object, ownership transferred to caller
1606 template< typename P1, typename P2, typename P3 >
1607 inline CallbackBase* MakeCallback( void(*function)(P1,P2,P3) )
1609 return new CallbackFunction( function );
1613 * @brief Creates a callback from a C function or static member function with three parameters and a return type.
1616 * @param[in] function The function to call.
1617 * @return a newly allocated Callback object, ownership transferred to caller
1619 template< typename R, typename P1, typename P2, typename P3 >
1620 inline CallbackBase* MakeCallback( R(*function)(P1,P2,P3) )
1622 return new CallbackFunction( function );
1626 * @brief Creates a callback from a class member function with no parameters.
1628 * requires the function to be member of the same class
1630 * @param[in] object The object to call.
1631 * @param[in] function The member function to call.
1632 * @return a newly allocated Callback object, ownership transferred to caller
1635 inline CallbackBase* MakeCallback( T* object, void(T::*function)(void) )
1637 return new Callback< T >( object, function );
1641 * @brief Creates a callback from a class member function with one parameter.
1643 * requires the function to be member of the same class
1645 * @param[in] object The object to call.
1646 * @param[in] function The member function to call.
1647 * @return a newly allocated Callback object, ownership transferred to caller
1649 template< class T, typename P1 >
1650 inline CallbackBase* MakeCallback( T* object, void(T::*function)(P1) )
1652 return new Callback< T >( object, function );
1656 * @brief Creates a callback from a class member function with two parameters.
1658 * requires the function to be member of the same class
1660 * @param[in] object The object to call.
1661 * @param[in] function The member function to call.
1662 * @return a newly allocated Callback object, ownership transferred to caller
1664 template< class T, typename P1, typename P2 >
1665 inline CallbackBase* MakeCallback( T* object, void(T::*function)(P1,P2) )
1667 return new Callback< T >( object, function );
1671 * @brief Creates a callback from a class member function with three parameters.
1673 * requires the function to be member of the same class
1675 * @param[in] object The object to call.
1676 * @param[in] function The member function to call.
1677 * @return a newly allocated Callback object, ownership transferred to caller
1679 template< class T, typename P1, typename P2, typename P3 >
1680 inline CallbackBase* MakeCallback( T* object, void(T::*function)(P1,P2,P3) )
1682 return new Callback< T >( object, function );
1686 * @brief Creates a callback from a class member function with no parameters and a return type.
1688 * requires the function to be member of the same class
1690 * @param[in] object The object to call.
1691 * @param[in] function The member function to call.
1692 * @return a newly allocated Callback object, ownership transferred to caller
1694 template< class T, typename R >
1695 inline CallbackBase* MakeCallback( T* object, R(T::*function)() )
1697 return new Callback< T >( object, function );
1701 * @brief Creates a callback from a class member function with one parameter and a return type.
1703 * requires the function to be member of the same class
1705 * @param[in] object The object to call.
1706 * @param[in] function The member function to call.
1707 * @return a newly allocated Callback object, ownership transferred to caller
1709 template< class T, typename P1, typename R >
1710 inline CallbackBase* MakeCallback( T* object, R(T::*function)(P1) )
1712 return new Callback< T >( object, function );
1716 * @brief Creates a callback from a class member function with two parameters and a return type.
1718 * requires the function to be member of the same class
1720 * @param[in] object The object to call.
1721 * @param[in] function The member function to call.
1722 * @return a newly allocated Callback object, ownership transferred to caller
1724 template< class T, typename P1, typename P2, typename R >
1725 inline CallbackBase* MakeCallback( T* object, R(T::*function)(P1,P2) )
1727 return new Callback< T >( object, function );
1731 * @brief Creates a callback from a class member function with three parameters and a return type.
1733 * requires the function to be member of the same class
1735 * @param[in] object The object to call.
1736 * @param[in] function The member function to call.
1737 * @return a newly allocated Callback object, ownership transferred to caller
1739 template< class T, typename P1, typename P2, typename P3, typename R >
1740 inline CallbackBase* MakeCallback( T* object, R(T::*function)(P1,P2,P3) )
1742 return new Callback< T >( object, function );
1746 * @brief Creates a callback from a class's parent member function with no parameters.
1748 * requires the function to be member of the same class
1750 * @param[in] object The object to call.
1751 * @param[in] function The member function to call.
1752 * @return a newly allocated Callback object, ownership transferred to caller
1754 template< class T, class Base >
1755 inline CallbackBase* MakeCallback( T* object, void(Base::*function)(void) )
1757 return new Callback< T >( object, function );
1760 * @brief Creates a callback from a class's parent member function with no parameters.
1762 * requires the function to be member of the same class
1764 * @param[in] object The object to call.
1765 * @param[in] function The member function to call.
1766 * @return a newly allocated Callback object, ownership transferred to caller
1768 template< class T, class Base >
1769 inline CallbackBase* MakeCallback( T& object, void(Base::*function)(void) )
1771 return new Callback< T >( object, function );
1779 #endif // __DALI_CALLBACK_H__