PixelLightAPI  .
Functor.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: Functor.h                                      *
00003  *
00004  *  Copyright (C) 2002-2012 The PixelLight Team (http://www.pixellight.org/)
00005  *
00006  *  This file is part of PixelLight.
00007  *
00008  *  PixelLight is free software: you can redistribute it and/or modify
00009  *  it under the terms of the GNU Lesser General Public License as published by
00010  *  the Free Software Foundation, either version 3 of the License, or
00011  *  (at your option) any later version.
00012  *
00013  *  PixelLight is distributed in the hope that it will be useful,
00014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00016  *  GNU Lesser General Public License for more details.
00017  *
00018  *  You should have received a copy of the GNU Lesser General Public License
00019  *  along with PixelLight. If not, see <http://www.gnu.org/licenses/>.
00020 \*********************************************************/
00021 
00022 
00023 #ifndef __PLCORE_FUNCTOR_H__
00024 #define __PLCORE_FUNCTOR_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include "PLCore/Base/Func/Func.h"
00032 #include "PLCore/Base/Func/FuncFunPtr.h"
00033 #include "PLCore/Base/Func/FuncMemPtr.h"
00034 
00035 
00036 //[-------------------------------------------------------]
00037 //[ Namespace                                             ]
00038 //[-------------------------------------------------------]
00039 namespace PLCore {
00040 
00041 
00042 //[-------------------------------------------------------]
00043 //[ Classes                                               ]
00044 //[-------------------------------------------------------]
00045 /**
00046 *  @brief
00047 *    Generic functor class (delegate, a form of type-safe function pointer, 'callback')
00048 *
00049 *  @remarks
00050 *    This class wraps a function and only makes it's signature (<Return> (<Parameters>))
00051 *    visible to the world. Other components can 'just use' the function without the need to know whether
00052 *    it's a static/global/member function. A functor is a specialized case of a function object (functoid)
00053 *    in that it points to another function it wraps (which can again be a function, method or functiod itself).
00054 *
00055 *  @verbatim
00056 *    Usage examples:
00057 *
00058 *    // A simple function returning a 'float' and taking 3 formal parameters:
00059 *    // -> 'cFunction' is 'a function' returning a 'float' and taking a 'int' and 'float' parameter
00060 *    //    (we do not know more about it and also don't need to know more, we just 'use' it :)
00061 *    // -> 'nValue' and 'fValue' are any values given to 'cFunction' that makes 'something' and
00062 *    //    is returning 'something'
00063 *    float MyArithmetic(Functor<float, int, float> &cFunction, int nValue, float fValue)
00064 *    {
00065 *        return cFunction(nValue, fValue);
00066 *    }
00067 *
00068 *    // A global function (same usage for static member methods/function)
00069 *    float MyAdditionFunction(int i, float f)
00070 *    {
00071 *        return i + f;
00072 *    }
00073 *    // -> Usage example: float fResult = MyArithmetic(Functor<float, int, float>(MyAdditionFunction), 1, 1.5f);
00074 *
00075 *    // An usual class with an usual method
00076 *    class MyClass {
00077 *        public:
00078 *            float Addition(int i, float f)
00079 *            {
00080 *                return i + f;
00081 *            }
00082 *    };
00083 *    // -> float fResult = MyArithmetic(Functor<float, int, float>(&MyClass::Addition, MyClass()), 1, 1.5f);
00084 *  @endverbatim
00085 */
00086 template <typename R, typename T0 = NullType, typename T1 = NullType, typename T2 = NullType, typename T3 = NullType, typename T4 = NullType, typename T5 = NullType, typename T6 = NullType, typename T7 = NullType, typename T8 = NullType, typename T9 = NullType, typename T10 = NullType, typename T11 = NullType, typename T12 = NullType, typename T13 = NullType, typename T14 = NullType, typename T15 = NullType>
00087 class Functor : public Func<R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> {
00088 
00089 
00090     //[-------------------------------------------------------]
00091     //[ Public data types                                     ]
00092     //[-------------------------------------------------------]
00093     public:
00094         // Storage types
00095         typedef typename Type<R>  ::_Type _R;
00096         typedef typename Type<T0> ::_Type _T0;
00097         typedef typename Type<T1> ::_Type _T1;
00098         typedef typename Type<T2> ::_Type _T2;
00099         typedef typename Type<T3> ::_Type _T3;
00100         typedef typename Type<T4> ::_Type _T4;
00101         typedef typename Type<T5> ::_Type _T5;
00102         typedef typename Type<T6> ::_Type _T6;
00103         typedef typename Type<T7> ::_Type _T7;
00104         typedef typename Type<T8> ::_Type _T8;
00105         typedef typename Type<T9> ::_Type _T9;
00106         typedef typename Type<T10>::_Type _T10;
00107         typedef typename Type<T11>::_Type _T11;
00108         typedef typename Type<T12>::_Type _T12;
00109         typedef typename Type<T13>::_Type _T13;
00110         typedef typename Type<T14>::_Type _T14;
00111         typedef typename Type<T15>::_Type _T15;
00112 
00113 
00114     //[-------------------------------------------------------]
00115     //[ Public functions                                      ]
00116     //[-------------------------------------------------------]
00117     public:
00118         /**
00119         *  @brief
00120         *    Constructor
00121         *
00122         *  @remarks
00123         *    Constructor for an empty functor
00124         */
00125         Functor() :
00126             m_pFunc(nullptr)
00127         {
00128         }
00129 
00130         /**
00131         *  @brief
00132         *    Constructor
00133         *
00134         *  @param[in] pFunc
00135         *    Pointer to a function object
00136         *
00137         *  @remarks
00138         *    Wrap a generic function object (functoid)
00139         */
00140         Functor(DynFunc *pFunc) :
00141             m_pFunc(pFunc)
00142         {
00143         }
00144 
00145         /**
00146         *  @brief
00147         *    Constructor
00148         *
00149         *  @param[in] pFunc
00150         *    Pointer to a static function
00151         *
00152         *  @remarks
00153         *    Wrap a static function pointer
00154         */
00155         Functor(const typename Signature<R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>::FuncType &pFunc) :
00156             m_pFunc(new FuncFunPtr<R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(pFunc))
00157         {
00158         }
00159 
00160         /**
00161         *  @brief
00162         *    Constructor
00163         *
00164         *  @param[in] pMemFunc
00165         *    Pointer to a member function of a class
00166         *  @param[in] pObject
00167         *    Pointer to an instance of that class
00168         *
00169         *  @remarks
00170         *    Wrap a member function pointer
00171         */
00172         template <class CLASS>
00173         Functor(const typename MethodSignature<CLASS, R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>::MemFuncType &pMemFunc, CLASS *pObject) :
00174             m_pFunc(new FuncMemPtr<CLASS, R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(pMemFunc, pObject))
00175         {
00176         }
00177 
00178         /**
00179         *  @brief
00180         *    Copy constructor
00181         *
00182         *  @param[in] cFunctor
00183         *    Source functor
00184         */
00185         Functor(const Functor &cFunctor) :
00186             m_pFunc(nullptr)
00187         {
00188             // Check wrapped function object
00189             if (cFunctor.m_pFunc) {
00190                 // Clone and copy wrapped function object
00191                 m_pFunc = cFunctor.m_pFunc->Clone();
00192             }
00193         }
00194 
00195         /**
00196         *  @brief
00197         *    Destructor
00198         */
00199         virtual ~Functor()
00200         {
00201             // Destroy wrapped function object
00202             if (m_pFunc)
00203                 delete m_pFunc;
00204         }
00205 
00206         /**
00207         *  @brief
00208         *    Copy operator
00209         *
00210         *  @param[in] cFunctor
00211         *    Source functor
00212         */
00213         Functor &operator =(const Functor &cFunctor)
00214         {
00215             // Check if the functor already wraps a function object
00216             if (m_pFunc) {
00217                 // Destroy old implementation
00218                 delete m_pFunc;
00219                 m_pFunc = nullptr;
00220             }
00221 
00222             // Check function object
00223             if (cFunctor.m_pFunc) {
00224                 // Clone and copy wrapped function object
00225                 m_pFunc = cFunctor.m_pFunc->Clone();
00226             }
00227 
00228             // Return this object
00229             return *this;
00230         }
00231 
00232 
00233     //[-------------------------------------------------------]
00234     //[ Public virtual DynFunc functions                      ]
00235     //[-------------------------------------------------------]
00236     public:
00237         virtual _R operator ()(_T0 t0, _T1 t1, _T2 t2, _T3 t3, _T4 t4, _T5 t5, _T6 t6, _T7 t7, _T8 t8, _T9 t9, _T10 t10, _T11 t11, _T12 t12, _T13 t13, _T14 t14, _T15 t15) override
00238         {
00239             if (m_pFunc)
00240                 return (*static_cast<Func<R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>* >(m_pFunc))(t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15);
00241             else
00242                 return DefaultValue<R>::Default();
00243         }
00244 
00245         virtual DynFunc *Clone() const override
00246         {
00247             return new Functor(m_pFunc ? m_pFunc->Clone() : nullptr);
00248         }
00249 
00250 
00251     //[-------------------------------------------------------]
00252     //[ Private data                                          ]
00253     //[-------------------------------------------------------]
00254     private:
00255         DynFunc *m_pFunc;   /**< Pointer to wrapped function object, can be a null pointer */
00256 
00257 
00258 };
00259 
00260 /**
00261 *  @brief
00262 *    Generic functor class (delegate, a form of type-safe function pointer, 'callback')
00263 *
00264 *  @remarks
00265 *    Implementation for 16 parameters without a return value
00266 */
00267 template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15>
00268 class Functor<void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> : public Func<void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> {
00269     public:
00270         typedef typename Type<T0> ::_Type _T0;
00271         typedef typename Type<T1> ::_Type _T1;
00272         typedef typename Type<T2> ::_Type _T2;
00273         typedef typename Type<T3> ::_Type _T3;
00274         typedef typename Type<T4> ::_Type _T4;
00275         typedef typename Type<T5> ::_Type _T5;
00276         typedef typename Type<T6> ::_Type _T6;
00277         typedef typename Type<T7> ::_Type _T7;
00278         typedef typename Type<T8> ::_Type _T8;
00279         typedef typename Type<T9> ::_Type _T9;
00280         typedef typename Type<T10>::_Type _T10;
00281         typedef typename Type<T11>::_Type _T11;
00282         typedef typename Type<T12>::_Type _T12;
00283         typedef typename Type<T13>::_Type _T13;
00284         typedef typename Type<T14>::_Type _T14;
00285         typedef typename Type<T15>::_Type _T15;
00286 
00287         Functor() : m_pFunc(nullptr)
00288         {
00289         }
00290 
00291         Functor(DynFunc *pFunc) : m_pFunc(pFunc)
00292         {
00293         }
00294 
00295         Functor(const typename Signature<void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>::FuncType &pFunc) :
00296             m_pFunc(new FuncFunPtr<void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(pFunc))
00297         {
00298         }
00299 
00300         template <class CLASS>
00301         Functor(const typename MethodSignature<CLASS, void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>::MemFuncType &pMemFunc, CLASS *pObject) :
00302             m_pFunc(new FuncMemPtr<CLASS, void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(pMemFunc, pObject))
00303         {
00304         }
00305 
00306         Functor(const Functor &cFunctor) : m_pFunc(nullptr)
00307         {
00308             // Check wrapped function object
00309             if (cFunctor.m_pFunc) {
00310                 // Clone and copy wrapped function object
00311                 m_pFunc = cFunctor.m_pFunc->Clone();
00312             }
00313         }
00314 
00315         virtual ~Functor()
00316         {
00317             // Destroy wrapped function object
00318             if (m_pFunc)
00319                 delete m_pFunc;
00320         }
00321 
00322         Functor &operator =(const Functor &cFunctor)
00323         {
00324             // Check if the functor already wraps a function object
00325             if (m_pFunc) {
00326                 // Destroy old implementation
00327                 delete m_pFunc;
00328                 m_pFunc = nullptr;
00329             }
00330 
00331             // Check function object
00332             if (cFunctor.m_pFunc) {
00333                 // Clone and copy wrapped function object
00334                 m_pFunc = cFunctor.m_pFunc->Clone();
00335             }
00336 
00337             // Return this object
00338             return *this;
00339         }
00340 
00341         virtual void operator ()(_T0 t0, _T1 t1, _T2 t2, _T3 t3, _T4 t4, _T5 t5, _T6 t6, _T7 t7, _T8 t8, _T9 t9, _T10 t10, _T11 t11, _T12 t12, _T13 t13, _T14 t14, _T15 t15) override
00342         {
00343             if (m_pFunc)
00344                 (*static_cast<Func<void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>* >(m_pFunc))(t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15);
00345         }
00346 
00347         virtual DynFunc *Clone() const override
00348         {
00349             return new Functor(m_pFunc ? m_pFunc->Clone() : nullptr);
00350         }
00351 
00352     private:
00353         DynFunc *m_pFunc;   /**< Pointer to wrapped function object, can be a null pointer */
00354 };
00355 
00356 /**
00357 *  @brief
00358 *    Generic functor class (delegate, a form of type-safe function pointer, 'callback')
00359 *
00360 *  @remarks
00361 *    Implementation for 15 parameters and a return value
00362 */
00363 template <typename R, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14>
00364 class Functor<R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> : public Func<R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> {
00365     public:
00366         typedef typename Type<R>  ::_Type _R;
00367         typedef typename Type<T0> ::_Type _T0;
00368         typedef typename Type<T1> ::_Type _T1;
00369         typedef typename Type<T2> ::_Type _T2;
00370         typedef typename Type<T3> ::_Type _T3;
00371         typedef typename Type<T4> ::_Type _T4;
00372         typedef typename Type<T5> ::_Type _T5;
00373         typedef typename Type<T6> ::_Type _T6;
00374         typedef typename Type<T7> ::_Type _T7;
00375         typedef typename Type<T8> ::_Type _T8;
00376         typedef typename Type<T9> ::_Type _T9;
00377         typedef typename Type<T10>::_Type _T10;
00378         typedef typename Type<T11>::_Type _T11;
00379         typedef typename Type<T12>::_Type _T12;
00380         typedef typename Type<T13>::_Type _T13;
00381         typedef typename Type<T14>::_Type _T14;
00382 
00383         Functor() : m_pFunc(nullptr)
00384         {
00385         }
00386 
00387         Functor(DynFunc *pFunc) : m_pFunc(pFunc)
00388         {
00389         }
00390 
00391         Functor(const typename Signature<R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>::FuncType &pFunc) :
00392             m_pFunc(new FuncFunPtr<R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(pFunc))
00393         {
00394         }
00395 
00396         template <class CLASS>
00397         Functor(const typename MethodSignature<CLASS, R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>::MemFuncType &pMemFunc, CLASS *pObject) :
00398             m_pFunc(new FuncMemPtr<CLASS, R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(pMemFunc, pObject))
00399         {
00400         }
00401 
00402         Functor(const Functor &cFunctor) : m_pFunc(nullptr)
00403         {
00404             // Check wrapped function object
00405             if (cFunctor.m_pFunc) {
00406                 // Clone and copy wrapped function object
00407                 m_pFunc = cFunctor.m_pFunc->Clone();
00408             }
00409         }
00410 
00411         virtual ~Functor()
00412         {
00413             // Destroy wrapped function object
00414             if (m_pFunc)
00415                 delete m_pFunc;
00416         }
00417 
00418         Functor &operator =(const Functor &cFunctor)
00419         {
00420             // Check if the functor already wraps a function object
00421             if (m_pFunc) {
00422                 // Destroy old implementation
00423                 delete m_pFunc;
00424                 m_pFunc = nullptr;
00425             }
00426 
00427             // Check function object
00428             if (cFunctor.m_pFunc) {
00429                 // Clone and copy wrapped function object
00430                 m_pFunc = cFunctor.m_pFunc->Clone();
00431             }
00432 
00433             // Return this object
00434             return *this;
00435         }
00436 
00437         virtual _R operator ()(_T0 t0, _T1 t1, _T2 t2, _T3 t3, _T4 t4, _T5 t5, _T6 t6, _T7 t7, _T8 t8, _T9 t9, _T10 t10, _T11 t11, _T12 t12, _T13 t13, _T14 t14) override
00438         {
00439             if (m_pFunc)
00440                 return (*static_cast<Func<R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>* >(m_pFunc))(t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14);
00441             else
00442                 return DefaultValue<R>::Default();
00443         }
00444 
00445         virtual DynFunc *Clone() const override
00446         {
00447             return new Functor(m_pFunc ? m_pFunc->Clone() : nullptr);
00448         }
00449 
00450     private:
00451         DynFunc *m_pFunc;   /**< Pointer to wrapped function object, can be a null pointer */
00452 };
00453 
00454 /**
00455 *  @brief
00456 *    Generic functor class (delegate, a form of type-safe function pointer, 'callback')
00457 *
00458 *  @remarks
00459 *    Implementation for 15 parameters without a return value
00460 */
00461 template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14>
00462 class Functor<void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> : public Func<void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> {
00463     public:
00464         typedef typename Type<T0> ::_Type _T0;
00465         typedef typename Type<T1> ::_Type _T1;
00466         typedef typename Type<T2> ::_Type _T2;
00467         typedef typename Type<T3> ::_Type _T3;
00468         typedef typename Type<T4> ::_Type _T4;
00469         typedef typename Type<T5> ::_Type _T5;
00470         typedef typename Type<T6> ::_Type _T6;
00471         typedef typename Type<T7> ::_Type _T7;
00472         typedef typename Type<T8> ::_Type _T8;
00473         typedef typename Type<T9> ::_Type _T9;
00474         typedef typename Type<T10>::_Type _T10;
00475         typedef typename Type<T11>::_Type _T11;
00476         typedef typename Type<T12>::_Type _T12;
00477         typedef typename Type<T13>::_Type _T13;
00478         typedef typename Type<T14>::_Type _T14;
00479 
00480         Functor() : m_pFunc(nullptr)
00481         {
00482         }
00483 
00484         Functor(DynFunc *pFunc) : m_pFunc(pFunc)
00485         {
00486         }
00487 
00488         Functor(const typename Signature<void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>::FuncType &pFunc) :
00489             m_pFunc(new FuncFunPtr<void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(pFunc))
00490         {
00491         }
00492 
00493         template <class CLASS>
00494         Functor(const typename MethodSignature<CLASS, void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>::MemFuncType &pMemFunc, CLASS *pObject) :
00495             m_pFunc(new FuncMemPtr<CLASS, void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(pMemFunc, pObject))
00496         {
00497         }
00498 
00499         Functor(const Functor &cFunctor) : m_pFunc(nullptr)
00500         {
00501             // Check wrapped function object
00502             if (cFunctor.m_pFunc) {
00503                 // Clone and copy wrapped function object
00504                 m_pFunc = cFunctor.m_pFunc->Clone();
00505             }
00506         }
00507 
00508         virtual ~Functor()
00509         {
00510             // Destroy wrapped function object
00511             if (m_pFunc)
00512                 delete m_pFunc;
00513         }
00514 
00515         Functor &operator =(const Functor &cFunctor)
00516         {
00517             // Check if the functor already wraps a function object
00518             if (m_pFunc) {
00519                 // Destroy old implementation
00520                 delete m_pFunc;
00521                 m_pFunc = nullptr;
00522             }
00523 
00524             // Check function object
00525             if (cFunctor.m_pFunc) {
00526                 // Clone and copy wrapped function object
00527                 m_pFunc = cFunctor.m_pFunc->Clone();
00528             }
00529 
00530             // Return this object
00531             return *this;
00532         }
00533 
00534         virtual void operator ()(_T0 t0, _T1 t1, _T2 t2, _T3 t3, _T4 t4, _T5 t5, _T6 t6, _T7 t7, _T8 t8, _T9 t9, _T10 t10, _T11 t11, _T12 t12, _T13 t13, _T14 t14) override
00535         {
00536             if (m_pFunc)
00537                 return (*static_cast<Func<void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>* >(m_pFunc))(t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14);
00538         }
00539 
00540         virtual DynFunc *Clone() const override
00541         {
00542             return new Functor(m_pFunc ? m_pFunc->Clone() : nullptr);
00543         }
00544 
00545     private:
00546         DynFunc *m_pFunc;   /**< Pointer to wrapped function object, can be a null pointer */
00547 };
00548 
00549 /**
00550 *  @brief
00551 *    Generic functor class (delegate, a form of type-safe function pointer, 'callback')
00552 *
00553 *  @remarks
00554 *    Implementation for 14 parameters and a return value
00555 */
00556 template <typename R, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13>
00557 class Functor<R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> : public Func<R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> {
00558     public:
00559         typedef typename Type<R>  ::_Type _R;
00560         typedef typename Type<T0> ::_Type _T0;
00561         typedef typename Type<T1> ::_Type _T1;
00562         typedef typename Type<T2> ::_Type _T2;
00563         typedef typename Type<T3> ::_Type _T3;
00564         typedef typename Type<T4> ::_Type _T4;
00565         typedef typename Type<T5> ::_Type _T5;
00566         typedef typename Type<T6> ::_Type _T6;
00567         typedef typename Type<T7> ::_Type _T7;
00568         typedef typename Type<T8> ::_Type _T8;
00569         typedef typename Type<T9> ::_Type _T9;
00570         typedef typename Type<T10>::_Type _T10;
00571         typedef typename Type<T11>::_Type _T11;
00572         typedef typename Type<T12>::_Type _T12;
00573         typedef typename Type<T13>::_Type _T13;
00574 
00575         Functor() : m_pFunc(nullptr)
00576         {
00577         }
00578 
00579         Functor(DynFunc *pFunc) : m_pFunc(pFunc)
00580         {
00581         }
00582 
00583         Functor(const typename Signature<R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>::FuncType &pFunc) :
00584             m_pFunc(new FuncFunPtr<R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(pFunc))
00585         {
00586         }
00587 
00588         template <class CLASS>
00589         Functor(const typename MethodSignature<CLASS, R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>::MemFuncType &pMemFunc, CLASS *pObject) :
00590             m_pFunc(new FuncMemPtr<CLASS, R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(pMemFunc, pObject))
00591         {
00592         }
00593 
00594         Functor(const Functor &cFunctor) : m_pFunc(nullptr)
00595         {
00596             // Check wrapped function object
00597             if (cFunctor.m_pFunc) {
00598                 // Clone and copy wrapped function object
00599                 m_pFunc = cFunctor.m_pFunc->Clone();
00600             }
00601         }
00602 
00603         virtual ~Functor()
00604         {
00605             // Destroy wrapped function object
00606             if (m_pFunc)
00607                 delete m_pFunc;
00608         }
00609 
00610         Functor &operator =(const Functor &cFunctor)
00611         {
00612             // Check if the functor already wraps a function object
00613             if (m_pFunc) {
00614                 // Destroy old implementation
00615                 delete m_pFunc;
00616                 m_pFunc = nullptr;
00617             }
00618 
00619             // Check function object
00620             if (cFunctor.m_pFunc) {
00621                 // Clone and copy wrapped function object
00622                 m_pFunc = cFunctor.m_pFunc->Clone();
00623             }
00624 
00625             // Return this object
00626             return *this;
00627         }
00628 
00629         virtual _R operator ()(_T0 t0, _T1 t1, _T2 t2, _T3 t3, _T4 t4, _T5 t5, _T6 t6, _T7 t7, _T8 t8, _T9 t9, _T10 t10, _T11 t11, _T12 t12, _T13 t13) override
00630         {
00631             if (m_pFunc)
00632                 return (*static_cast<Func<R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>* >(m_pFunc))(t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13);
00633             else
00634                 return DefaultValue<R>::Default();
00635         }
00636 
00637         virtual DynFunc *Clone() const override
00638         {
00639             return new Functor(m_pFunc ? m_pFunc->Clone() : nullptr);
00640         }
00641 
00642     private:
00643         DynFunc *m_pFunc;   /**< Pointer to wrapped function object, can be a null pointer */
00644 };
00645 
00646 /**
00647 *  @brief
00648 *    Generic functor class (delegate, a form of type-safe function pointer, 'callback')
00649 *
00650 *  @remarks
00651 *    Implementation for 14 parameters without a return value
00652 */
00653 template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13>
00654 class Functor<void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> : public Func<void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> {
00655     public:
00656         typedef typename Type<T0> ::_Type _T0;
00657         typedef typename Type<T1> ::_Type _T1;
00658         typedef typename Type<T2> ::_Type _T2;
00659         typedef typename Type<T3> ::_Type _T3;
00660         typedef typename Type<T4> ::_Type _T4;
00661         typedef typename Type<T5> ::_Type _T5;
00662         typedef typename Type<T6> ::_Type _T6;
00663         typedef typename Type<T7> ::_Type _T7;
00664         typedef typename Type<T8> ::_Type _T8;
00665         typedef typename Type<T9> ::_Type _T9;
00666         typedef typename Type<T10>::_Type _T10;
00667         typedef typename Type<T11>::_Type _T11;
00668         typedef typename Type<T12>::_Type _T12;
00669         typedef typename Type<T13>::_Type _T13;
00670 
00671         Functor() : m_pFunc(nullptr)
00672         {
00673         }
00674 
00675         Functor(DynFunc *pFunc) : m_pFunc(pFunc)
00676         {
00677         }
00678 
00679         Functor(const typename Signature<void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>::FuncType &pFunc) :
00680             m_pFunc(new FuncFunPtr<void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(pFunc))
00681         {
00682         }
00683 
00684         template <class CLASS>
00685         Functor(const typename MethodSignature<CLASS, void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>::MemFuncType &pMemFunc, CLASS *pObject) :
00686             m_pFunc(new FuncMemPtr<CLASS, void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(pMemFunc, pObject))
00687         {
00688         }
00689 
00690         Functor(const Functor &cFunctor) : m_pFunc(nullptr)
00691         {
00692             // Check wrapped function object
00693             if (cFunctor.m_pFunc) {
00694                 // Clone and copy wrapped function object
00695                 m_pFunc = cFunctor.m_pFunc->Clone();
00696             }
00697         }
00698 
00699         virtual ~Functor()
00700         {
00701             // Destroy wrapped function object
00702             if (m_pFunc)
00703                 delete m_pFunc;
00704         }
00705 
00706         Functor &operator =(const Functor &cFunctor)
00707         {
00708             // Check if the functor already wraps a function object
00709             if (m_pFunc) {
00710                 // Destroy old implementation
00711                 delete m_pFunc;
00712                 m_pFunc = nullptr;
00713             }
00714 
00715             // Check function object
00716             if (cFunctor.m_pFunc) {
00717                 // Clone and copy wrapped function object
00718                 m_pFunc = cFunctor.m_pFunc->Clone();
00719             }
00720 
00721             // Return this object
00722             return *this;
00723         }
00724 
00725         virtual void operator ()(_T0 t0, _T1 t1, _T2 t2, _T3 t3, _T4 t4, _T5 t5, _T6 t6, _T7 t7, _T8 t8, _T9 t9, _T10 t10, _T11 t11, _T12 t12, _T13 t13) override
00726         {
00727             if (m_pFunc)
00728                 (*static_cast<Func<void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>* >(m_pFunc))(t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13);
00729         }
00730 
00731         virtual DynFunc *Clone() const override
00732         {
00733             return new Functor(m_pFunc ? m_pFunc->Clone() : nullptr);
00734         }
00735 
00736     private:
00737         DynFunc *m_pFunc;   /**< Pointer to wrapped function object, can be a null pointer */
00738 };
00739 
00740 /**
00741 *  @brief
00742 *    Generic functor class (delegate, a form of type-safe function pointer, 'callback')
00743 *
00744 *  @remarks
00745 *    Implementation for 13 parameters and a return value
00746 */
00747 template <typename R, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12>
00748 class Functor<R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> : public Func<R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> {
00749     public:
00750         typedef typename Type<R>  ::_Type _R;
00751         typedef typename Type<T0> ::_Type _T0;
00752         typedef typename Type<T1> ::_Type _T1;
00753         typedef typename Type<T2> ::_Type _T2;
00754         typedef typename Type<T3> ::_Type _T3;
00755         typedef typename Type<T4> ::_Type _T4;
00756         typedef typename Type<T5> ::_Type _T5;
00757         typedef typename Type<T6> ::_Type _T6;
00758         typedef typename Type<T7> ::_Type _T7;
00759         typedef typename Type<T8> ::_Type _T8;
00760         typedef typename Type<T9> ::_Type _T9;
00761         typedef typename Type<T10>::_Type _T10;
00762         typedef typename Type<T11>::_Type _T11;
00763         typedef typename Type<T12>::_Type _T12;
00764 
00765         Functor() : m_pFunc(nullptr)
00766         {
00767         }
00768 
00769         Functor(DynFunc *pFunc) : m_pFunc(pFunc)
00770         {
00771         }
00772 
00773         Functor(const typename Signature<R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>::FuncType &pFunc) :
00774             m_pFunc(new FuncFunPtr<R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(pFunc))
00775         {
00776         }
00777 
00778         template <class CLASS>
00779         Functor(const typename MethodSignature<CLASS, R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>::MemFuncType &pMemFunc, CLASS *pObject) :
00780             m_pFunc(new FuncMemPtr<CLASS, R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(pMemFunc, pObject))
00781         {
00782         }
00783 
00784         Functor(const Functor &cFunctor) : m_pFunc(nullptr)
00785         {
00786             // Check wrapped function object
00787             if (cFunctor.m_pFunc) {
00788                 // Clone and copy wrapped function object
00789                 m_pFunc = cFunctor.m_pFunc->Clone();
00790             }
00791         }
00792 
00793         virtual ~Functor()
00794         {
00795             // Destroy wrapped function object
00796             if (m_pFunc)
00797                 delete m_pFunc;
00798         }
00799 
00800         Functor &operator =(const Functor &cFunctor)
00801         {
00802             // Check if the functor already wraps a function object
00803             if (m_pFunc) {
00804                 // Destroy old implementation
00805                 delete m_pFunc;
00806                 m_pFunc = nullptr;
00807             }
00808 
00809             // Check function object
00810             if (cFunctor.m_pFunc) {
00811                 // Clone and copy wrapped function object
00812                 m_pFunc = cFunctor.m_pFunc->Clone();
00813             }
00814 
00815             // Return this object
00816             return *this;
00817         }
00818 
00819         virtual _R operator ()(_T0 t0, _T1 t1, _T2 t2, _T3 t3, _T4 t4, _T5 t5, _T6 t6, _T7 t7, _T8 t8, _T9 t9, _T10 t10, _T11 t11, _T12 t12) override
00820         {
00821             if (m_pFunc)
00822                 return (*static_cast<Func<R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>* >(m_pFunc))(t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12);
00823             else
00824                 return DefaultValue<R>::Default();
00825         }
00826 
00827         virtual DynFunc *Clone() const override
00828         {
00829             return new Functor(m_pFunc ? m_pFunc->Clone() : nullptr);
00830         }
00831 
00832     private:
00833         DynFunc *m_pFunc;   /**< Pointer to wrapped function object, can be a null pointer */
00834 };
00835 
00836 
00837 /**
00838 *  @brief
00839 *    Generic functor class (delegate, a form of type-safe function pointer, 'callback')
00840 *
00841 *  @remarks
00842 *    Implementation for 13 parameters without a return value
00843 */
00844 template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12>
00845 class Functor<void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> : public Func<void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> {
00846     public:
00847         typedef typename Type<T0> ::_Type _T0;
00848         typedef typename Type<T1> ::_Type _T1;
00849         typedef typename Type<T2> ::_Type _T2;
00850         typedef typename Type<T3> ::_Type _T3;
00851         typedef typename Type<T4> ::_Type _T4;
00852         typedef typename Type<T5> ::_Type _T5;
00853         typedef typename Type<T6> ::_Type _T6;
00854         typedef typename Type<T7> ::_Type _T7;
00855         typedef typename Type<T8> ::_Type _T8;
00856         typedef typename Type<T9> ::_Type _T9;
00857         typedef typename Type<T10>::_Type _T10;
00858         typedef typename Type<T11>::_Type _T11;
00859         typedef typename Type<T12>::_Type _T12;
00860 
00861         Functor() : m_pFunc(nullptr)
00862         {
00863         }
00864 
00865         Functor(DynFunc *pFunc) : m_pFunc(pFunc)
00866         {
00867         }
00868 
00869         Functor(const typename Signature<void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>::FuncType &pFunc) :
00870             m_pFunc(new FuncFunPtr<void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(pFunc))
00871         {
00872         }
00873 
00874         template <class CLASS>
00875         Functor(const typename MethodSignature<CLASS, void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>::MemFuncType &pMemFunc, CLASS *pObject) :
00876             m_pFunc(new FuncMemPtr<CLASS, void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(pMemFunc, pObject))
00877         {
00878         }
00879 
00880         Functor(const Functor &cFunctor) : m_pFunc(nullptr)
00881         {
00882             // Check wrapped function object
00883             if (cFunctor.m_pFunc) {
00884                 // Clone and copy wrapped function object
00885                 m_pFunc = cFunctor.m_pFunc->Clone();
00886             }
00887         }
00888 
00889         virtual ~Functor()
00890         {
00891             // Destroy wrapped function object
00892             if (m_pFunc)
00893                 delete m_pFunc;
00894         }
00895 
00896         Functor &operator =(const Functor &cFunctor)
00897         {
00898             // Check if the functor already wraps a function object
00899             if (m_pFunc) {
00900                 // Destroy old implementation
00901                 delete m_pFunc;
00902                 m_pFunc = nullptr;
00903             }
00904 
00905             // Check function object
00906             if (cFunctor.m_pFunc) {
00907                 // Clone and copy wrapped function object
00908                 m_pFunc = cFunctor.m_pFunc->Clone();
00909             }
00910 
00911             // Return this object
00912             return *this;
00913         }
00914 
00915         virtual void operator ()(_T0 t0, _T1 t1, _T2 t2, _T3 t3, _T4 t4, _T5 t5, _T6 t6, _T7 t7, _T8 t8, _T9 t9, _T10 t10, _T11 t11, _T12 t12) override
00916         {
00917             if (m_pFunc)
00918                 (*static_cast<Func<void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>* >(m_pFunc))(t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12);
00919         }
00920 
00921         virtual DynFunc *Clone() const override
00922         {
00923             return new Functor(m_pFunc ? m_pFunc->Clone() : nullptr);
00924         }
00925 
00926     private:
00927         DynFunc *m_pFunc;   /**< Pointer to wrapped function object, can be a null pointer */
00928 };
00929 
00930 /**
00931 *  @brief
00932 *    Generic functor class (delegate, a form of type-safe function pointer, 'callback')
00933 *
00934 *  @remarks
00935 *    Implementation for 12 parameters and a return value
00936 */
00937 template <typename R, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11>
00938 class Functor<R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> : public Func<R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> {
00939     public:
00940         typedef typename Type<R>  ::_Type _R;
00941         typedef typename Type<T0> ::_Type _T0;
00942         typedef typename Type<T1> ::_Type _T1;
00943         typedef typename Type<T2> ::_Type _T2;
00944         typedef typename Type<T3> ::_Type _T3;
00945         typedef typename Type<T4> ::_Type _T4;
00946         typedef typename Type<T5> ::_Type _T5;
00947         typedef typename Type<T6> ::_Type _T6;
00948         typedef typename Type<T7> ::_Type _T7;
00949         typedef typename Type<T8> ::_Type _T8;
00950         typedef typename Type<T9> ::_Type _T9;
00951         typedef typename Type<T10>::_Type _T10;
00952         typedef typename Type<T11>::_Type _T11;
00953 
00954         Functor() : m_pFunc(nullptr)
00955         {
00956         }
00957 
00958         Functor(DynFunc *pFunc) : m_pFunc(pFunc)
00959         {
00960         }
00961 
00962         Functor(const typename Signature<R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>::FuncType &pFunc) :
00963             m_pFunc(new FuncFunPtr<R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(pFunc))
00964         {
00965         }
00966 
00967         template <class CLASS>
00968         Functor(const typename MethodSignature<CLASS, R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>::MemFuncType &pMemFunc, CLASS *pObject) :
00969             m_pFunc(new FuncMemPtr<CLASS, R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(pMemFunc, pObject))
00970         {
00971         }
00972 
00973         Functor(const Functor &cFunctor) : m_pFunc(nullptr)
00974         {
00975             // Check wrapped function object
00976             if (cFunctor.m_pFunc) {
00977                 // Clone and copy wrapped function object
00978                 m_pFunc = cFunctor.m_pFunc->Clone();
00979             }
00980         }
00981 
00982         virtual ~Functor()
00983         {
00984             // Destroy wrapped function object
00985             if (m_pFunc)
00986                 delete m_pFunc;
00987         }
00988 
00989         Functor &operator =(const Functor &cFunctor)
00990         {
00991             // Check if the functor already wraps a function object
00992             if (m_pFunc) {
00993                 // Destroy old implementation
00994                 delete m_pFunc;
00995                 m_pFunc = nullptr;
00996             }
00997 
00998             // Check function object
00999             if (cFunctor.m_pFunc) {
01000                 // Clone and copy wrapped function object
01001                 m_pFunc = cFunctor.m_pFunc->Clone();
01002             }
01003 
01004             // Return this object
01005             return *this;
01006         }
01007 
01008         virtual _R operator ()(_T0 t0, _T1 t1, _T2 t2, _T3 t3, _T4 t4, _T5 t5, _T6 t6, _T7 t7, _T8 t8, _T9 t9, _T10 t10, _T11 t11) override
01009         {
01010             if (m_pFunc)
01011                 return (*static_cast<Func<R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>* >(m_pFunc))(t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11);
01012             else
01013                 return DefaultValue<R>::Default();
01014         }
01015 
01016         virtual DynFunc *Clone() const override
01017         {
01018             return new Functor(m_pFunc ? m_pFunc->Clone() : nullptr);
01019         }
01020 
01021     private:
01022         DynFunc *m_pFunc;   /**< Pointer to wrapped function object, can be a null pointer */
01023 };
01024 
01025 
01026 /**
01027 *  @brief
01028 *    Generic functor class (delegate, a form of type-safe function pointer, 'callback')
01029 *
01030 *  @remarks
01031 *    Implementation for 12 parameters without a return value
01032 */
01033 template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11>
01034 class Functor<void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> : public Func<void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> {
01035     public:
01036         typedef typename Type<T0> ::_Type _T0;
01037         typedef typename Type<T1> ::_Type _T1;
01038         typedef typename Type<T2> ::_Type _T2;
01039         typedef typename Type<T3> ::_Type _T3;
01040         typedef typename Type<T4> ::_Type _T4;
01041         typedef typename Type<T5> ::_Type _T5;
01042         typedef typename Type<T6> ::_Type _T6;
01043         typedef typename Type<T7> ::_Type _T7;
01044         typedef typename Type<T8> ::_Type _T8;
01045         typedef typename Type<T9> ::_Type _T9;
01046         typedef typename Type<T10>::_Type _T10;
01047         typedef typename Type<T11>::_Type _T11;
01048 
01049         Functor() : m_pFunc(nullptr)
01050         {
01051         }
01052 
01053         Functor(DynFunc *pFunc) : m_pFunc(pFunc)
01054         {
01055         }
01056 
01057         Functor(const typename Signature<void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>::FuncType &pFunc) :
01058             m_pFunc(new FuncFunPtr<void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(pFunc))
01059         {
01060         }
01061 
01062         template <class CLASS>
01063         Functor(const typename MethodSignature<CLASS, void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>::MemFuncType &pMemFunc, CLASS *pObject) :
01064             m_pFunc(new FuncMemPtr<CLASS, void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(pMemFunc, pObject))
01065         {
01066         }
01067 
01068         Functor(const Functor &cFunctor) : m_pFunc(nullptr)
01069         {
01070             // Check wrapped function object
01071             if (cFunctor.m_pFunc) {
01072                 // Clone and copy wrapped function object
01073                 m_pFunc = cFunctor.m_pFunc->Clone();
01074             }
01075         }
01076 
01077         virtual ~Functor()
01078         {
01079             // Destroy wrapped function object
01080             if (m_pFunc)
01081                 delete m_pFunc;
01082         }
01083 
01084         Functor &operator =(const Functor &cFunctor)
01085         {
01086             // Check if the functor already wraps a function object
01087             if (m_pFunc) {
01088                 // Destroy old implementation
01089                 delete m_pFunc;
01090                 m_pFunc = nullptr;
01091             }
01092 
01093             // Check function object
01094             if (cFunctor.m_pFunc) {
01095                 // Clone and copy wrapped function object
01096                 m_pFunc = cFunctor.m_pFunc->Clone();
01097             }
01098 
01099             // Return this object
01100             return *this;
01101         }
01102 
01103         virtual void operator ()(_T0 t0, _T1 t1, _T2 t2, _T3 t3, _T4 t4, _T5 t5, _T6 t6, _T7 t7, _T8 t8, _T9 t9, _T10 t10, _T11 t11) override
01104         {
01105             if (m_pFunc)
01106                 (*static_cast<Func<void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>* >(m_pFunc))(t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11);
01107         }
01108 
01109         virtual DynFunc *Clone() const override
01110         {
01111             return new Functor(m_pFunc ? m_pFunc->Clone() : nullptr);
01112         }
01113 
01114     private:
01115         DynFunc *m_pFunc;   /**< Pointer to wrapped function object, can be a null pointer */
01116 };
01117 
01118 /**
01119 *  @brief
01120 *    Generic functor class (delegate, a form of type-safe function pointer, 'callback')
01121 *
01122 *  @remarks
01123 *    Implementation for 11 parameters and a return value
01124 */
01125 template <typename R, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10>
01126 class Functor<R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> : public Func<R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> {
01127     public:
01128         typedef typename Type<R>  ::_Type _R;
01129         typedef typename Type<T0> ::_Type _T0;
01130         typedef typename Type<T1> ::_Type _T1;
01131         typedef typename Type<T2> ::_Type _T2;
01132         typedef typename Type<T3> ::_Type _T3;
01133         typedef typename Type<T4> ::_Type _T4;
01134         typedef typename Type<T5> ::_Type _T5;
01135         typedef typename Type<T6> ::_Type _T6;
01136         typedef typename Type<T7> ::_Type _T7;
01137         typedef typename Type<T8> ::_Type _T8;
01138         typedef typename Type<T9> ::_Type _T9;
01139         typedef typename Type<T10>::_Type _T10;
01140 
01141         Functor() : m_pFunc(nullptr)
01142         {
01143         }
01144 
01145         Functor(DynFunc *pFunc) : m_pFunc(pFunc)
01146         {
01147         }
01148 
01149         Functor(const typename Signature<R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>::FuncType &pFunc) :
01150             m_pFunc(new FuncFunPtr<R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(pFunc))
01151         {
01152         }
01153 
01154         template <class CLASS>
01155         Functor(const typename MethodSignature<CLASS, R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>::MemFuncType &pMemFunc, CLASS *pObject) :
01156             m_pFunc(new FuncMemPtr<CLASS, R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(pMemFunc, pObject))
01157         {
01158         }
01159 
01160         Functor(const Functor &cFunctor) : m_pFunc(nullptr)
01161         {
01162             // Check wrapped function object
01163             if (cFunctor.m_pFunc) {
01164                 // Clone and copy wrapped function object
01165                 m_pFunc = cFunctor.m_pFunc->Clone();
01166             }
01167         }
01168 
01169         virtual ~Functor()
01170         {
01171             // Destroy wrapped function object
01172             if (m_pFunc)
01173                 delete m_pFunc;
01174         }
01175 
01176         Functor &operator =(const Functor &cFunctor)
01177         {
01178             // Check if the functor already wraps a function object
01179             if (m_pFunc) {
01180                 // Destroy old implementation
01181                 delete m_pFunc;
01182                 m_pFunc = nullptr;
01183             }
01184 
01185             // Check function object
01186             if (cFunctor.m_pFunc) {
01187                 // Clone and copy wrapped function object
01188                 m_pFunc = cFunctor.m_pFunc->Clone();
01189             }
01190 
01191             // Return this object
01192             return *this;
01193         }
01194 
01195         virtual _R operator ()(_T0 t0, _T1 t1, _T2 t2, _T3 t3, _T4 t4, _T5 t5, _T6 t6, _T7 t7, _T8 t8, _T9 t9, _T10 t10) override
01196         {
01197             if (m_pFunc)
01198                 return (*static_cast<Func<R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>* >(m_pFunc))(t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10);
01199             else
01200                 return DefaultValue<R>::Default();
01201         }
01202 
01203         virtual DynFunc *Clone() const override
01204         {
01205             return new Functor(m_pFunc ? m_pFunc->Clone() : nullptr);
01206         }
01207 
01208     private:
01209         DynFunc *m_pFunc;   /**< Pointer to wrapped function object, can be a null pointer */
01210 };
01211 
01212 
01213 /**
01214 *  @brief
01215 *    Generic functor class (delegate, a form of type-safe function pointer, 'callback')
01216 *
01217 *  @remarks
01218 *    Implementation for 11 parameters without a return value
01219 */
01220 template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10>
01221 class Functor<void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> : public Func<void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> {
01222     public:
01223         typedef typename Type<T0> ::_Type _T0;
01224         typedef typename Type<T1> ::_Type _T1;
01225         typedef typename Type<T2> ::_Type _T2;
01226         typedef typename Type<T3> ::_Type _T3;
01227         typedef typename Type<T4> ::_Type _T4;
01228         typedef typename Type<T5> ::_Type _T5;
01229         typedef typename Type<T6> ::_Type _T6;
01230         typedef typename Type<T7> ::_Type _T7;
01231         typedef typename Type<T8> ::_Type _T8;
01232         typedef typename Type<T9> ::_Type _T9;
01233         typedef typename Type<T10>::_Type _T10;
01234 
01235         Functor() : m_pFunc(nullptr)
01236         {
01237         }
01238 
01239         Functor(DynFunc *pFunc) : m_pFunc(pFunc)
01240         {
01241         }
01242 
01243         Functor(const typename Signature<void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>::FuncType &pFunc) :
01244             m_pFunc(new FuncFunPtr<void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(pFunc))
01245         {
01246         }
01247 
01248         template <class CLASS>
01249         Functor(const typename MethodSignature<CLASS, void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>::MemFuncType &pMemFunc, CLASS *pObject) :
01250             m_pFunc(new FuncMemPtr<CLASS, void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(pMemFunc, pObject))
01251         {
01252         }
01253 
01254         Functor(const Functor &cFunctor) : m_pFunc(nullptr)
01255         {
01256             // Check wrapped function object
01257             if (cFunctor.m_pFunc) {
01258                 // Clone and copy wrapped function object
01259                 m_pFunc = cFunctor.m_pFunc->Clone();
01260             }
01261         }
01262 
01263         virtual ~Functor()
01264         {
01265             // Destroy wrapped function object
01266             if (m_pFunc)
01267                 delete m_pFunc;
01268         }
01269 
01270         Functor &operator =(const Functor &cFunctor)
01271         {
01272             // Check if the functor already wraps a function object
01273             if (m_pFunc) {
01274                 // Destroy old implementation
01275                 delete m_pFunc;
01276                 m_pFunc = nullptr;
01277             }
01278 
01279             // Check function object
01280             if (cFunctor.m_pFunc) {
01281                 // Clone and copy wrapped function object
01282                 m_pFunc = cFunctor.m_pFunc->Clone();
01283             }
01284 
01285             // Return this object
01286             return *this;
01287         }
01288 
01289         virtual void operator ()(_T0 t0, _T1 t1, _T2 t2, _T3 t3, _T4 t4, _T5 t5, _T6 t6, _T7 t7, _T8 t8, _T9 t9, _T10 t10) override
01290         {
01291             if (m_pFunc)
01292                 (*static_cast<Func<void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>* >(m_pFunc))(t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10);
01293         }
01294 
01295         virtual DynFunc *Clone() const override
01296         {
01297             return new Functor(m_pFunc ? m_pFunc->Clone() : nullptr);
01298         }
01299 
01300     private:
01301         DynFunc *m_pFunc;   /**< Pointer to wrapped function object, can be a null pointer */
01302 };
01303 
01304 /**
01305 *  @brief
01306 *    Generic functor class (delegate, a form of type-safe function pointer, 'callback')
01307 *
01308 *  @remarks
01309 *    Implementation for 10 parameters and a return value
01310 */
01311 template <typename R, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
01312 class Functor<R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> : public Func<R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> {
01313     public:
01314         typedef typename Type<R>  ::_Type _R;
01315         typedef typename Type<T0> ::_Type _T0;
01316         typedef typename Type<T1> ::_Type _T1;
01317         typedef typename Type<T2> ::_Type _T2;
01318         typedef typename Type<T3> ::_Type _T3;
01319         typedef typename Type<T4> ::_Type _T4;
01320         typedef typename Type<T5> ::_Type _T5;
01321         typedef typename Type<T6> ::_Type _T6;
01322         typedef typename Type<T7> ::_Type _T7;
01323         typedef typename Type<T8> ::_Type _T8;
01324         typedef typename Type<T9> ::_Type _T9;
01325 
01326         Functor() : m_pFunc(nullptr)
01327         {
01328         }
01329 
01330         Functor(DynFunc *pFunc) : m_pFunc(pFunc)
01331         {
01332         }
01333 
01334         Functor(const typename Signature<R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>::FuncType &pFunc) :
01335             m_pFunc(new FuncFunPtr<R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(pFunc))
01336         {
01337         }
01338 
01339         template <class CLASS>
01340         Functor(const typename MethodSignature<CLASS, R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>::MemFuncType &pMemFunc, CLASS *pObject) :
01341             m_pFunc(new FuncMemPtr<CLASS, R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(pMemFunc, pObject))
01342         {
01343         }
01344 
01345         Functor(const Functor &cFunctor) : m_pFunc(nullptr)
01346         {
01347             // Check wrapped function object
01348             if (cFunctor.m_pFunc) {
01349                 // Clone and copy wrapped function object
01350                 m_pFunc = cFunctor.m_pFunc->Clone();
01351             }
01352         }
01353 
01354         virtual ~Functor()
01355         {
01356             // Destroy wrapped function object
01357             if (m_pFunc)
01358                 delete m_pFunc;
01359         }
01360 
01361         Functor &operator =(const Functor &cFunctor)
01362         {
01363             // Check if the functor already wraps a function object
01364             if (m_pFunc) {
01365                 // Destroy old implementation
01366                 delete m_pFunc;
01367                 m_pFunc = nullptr;
01368             }
01369 
01370             // Check function object
01371             if (cFunctor.m_pFunc) {
01372                 // Clone and copy wrapped function object
01373                 m_pFunc = cFunctor.m_pFunc->Clone();
01374             }
01375 
01376             // Return this object
01377             return *this;
01378         }
01379 
01380         virtual _R operator ()(_T0 t0, _T1 t1, _T2 t2, _T3 t3, _T4 t4, _T5 t5, _T6 t6, _T7 t7, _T8 t8, _T9 t9) override
01381         {
01382             if (m_pFunc)
01383                 return (*static_cast<Func<R, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>* >(m_pFunc))(t0, t1, t2, t3, t4, t5, t6, t7, t8, t9);
01384             else
01385                 return DefaultValue<R>::Default();
01386         }
01387 
01388         virtual DynFunc *Clone() const override
01389         {
01390             return new Functor(m_pFunc ? m_pFunc->Clone() : nullptr);
01391         }
01392 
01393     private:
01394         DynFunc *m_pFunc;   /**< Pointer to wrapped function object, can be a null pointer */
01395 };
01396 
01397 /**
01398 *  @brief
01399 *    Generic functor class (delegate, a form of type-safe function pointer, 'callback')
01400 *
01401 *  @remarks
01402 *    Implementation for 10 parameters without a return value
01403 */
01404 template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
01405 class Functor<void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> : public Func<void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> {
01406     public:
01407         typedef typename Type<T0> ::_Type _T0;
01408         typedef typename Type<T1> ::_Type _T1;
01409         typedef typename Type<T2> ::_Type _T2;
01410         typedef typename Type<T3> ::_Type _T3;
01411         typedef typename Type<T4> ::_Type _T4;
01412         typedef typename Type<T5> ::_Type _T5;
01413         typedef typename Type<T6> ::_Type _T6;
01414         typedef typename Type<T7> ::_Type _T7;
01415         typedef typename Type<T8> ::_Type _T8;
01416         typedef typename Type<T9> ::_Type _T9;
01417 
01418         Functor() : m_pFunc(nullptr)
01419         {
01420         }
01421 
01422         Functor(DynFunc *pFunc) : m_pFunc(pFunc)
01423         {
01424         }
01425 
01426         Functor(const typename Signature<void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>::FuncType &pFunc) :
01427             m_pFunc(new FuncFunPtr<void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(pFunc))
01428         {
01429         }
01430 
01431         template <class CLASS>
01432         Functor(const typename MethodSignature<CLASS, void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>::MemFuncType &pMemFunc, CLASS *pObject) :
01433             m_pFunc(new FuncMemPtr<CLASS, void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(pMemFunc, pObject))
01434         {
01435         }
01436 
01437         Functor(const Functor &cFunctor) : m_pFunc(nullptr)
01438         {
01439             // Check wrapped function object
01440             if (cFunctor.m_pFunc) {
01441                 // Clone and copy wrapped function object
01442                 m_pFunc = cFunctor.m_pFunc->Clone();
01443             }
01444         }
01445 
01446         virtual ~Functor()
01447         {
01448             // Destroy wrapped function object
01449             if (m_pFunc)
01450                 delete m_pFunc;
01451         }
01452 
01453         Functor &operator =(const Functor &cFunctor)
01454         {
01455             // Check if the functor already wraps a function object
01456             if (m_pFunc) {
01457                 // Destroy old implementation
01458                 delete m_pFunc;
01459                 m_pFunc = nullptr;
01460             }
01461 
01462             // Check function object
01463             if (cFunctor.m_pFunc) {
01464                 // Clone and copy wrapped function object
01465                 m_pFunc = cFunctor.m_pFunc->Clone();
01466             }
01467 
01468             // Return this object
01469             return *this;
01470         }
01471 
01472         virtual void operator ()(_T0 t0, _T1 t1, _T2 t2, _T3 t3, _T4 t4, _T5 t5, _T6 t6, _T7 t7, _T8 t8, _T9 t9) override
01473         {
01474             if (m_pFunc)
01475                 (*static_cast<Func<void, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>* >(m_pFunc))(t0, t1, t2, t3, t4, t5, t6, t7, t8, t9);
01476         }
01477 
01478         virtual DynFunc *Clone() const override
01479         {
01480             return new Functor(m_pFunc ? m_pFunc->Clone() : nullptr);
01481         }
01482 
01483     private:
01484         DynFunc *m_pFunc;   /**< Pointer to wrapped function object, can be a null pointer */
01485 };
01486 
01487 /**
01488 *  @brief
01489 *    Generic functor class (delegate, a form of type-safe function pointer, 'callback')
01490 *
01491 *  @remarks
01492 *    Implementation for 9 parameters and a return value
01493 */
01494 template <typename R, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
01495 class Functor<R, T0, T1, T2, T3, T4, T5, T6, T7, T8> : public Func<R, T0, T1, T2, T3, T4, T5, T6, T7, T8> {
01496     public:
01497         typedef typename Type<R>  ::_Type _R;
01498         typedef typename Type<T0> ::_Type _T0;
01499         typedef typename Type<T1> ::_Type _T1;
01500         typedef typename Type<T2> ::_Type _T2;
01501         typedef typename Type<T3> ::_Type _T3;
01502         typedef typename Type<T4> ::_Type _T4;
01503         typedef typename Type<T5> ::_Type _T5;
01504         typedef typename Type<T6> ::_Type _T6;
01505         typedef typename Type<T7> ::_Type _T7;
01506         typedef typename Type<T8> ::_Type _T8;
01507 
01508         Functor() : m_pFunc(nullptr)
01509         {
01510         }
01511 
01512         Functor(DynFunc *pFunc) : m_pFunc(pFunc)
01513         {
01514         }
01515 
01516         Functor(const typename Signature<R, T0, T1, T2, T3, T4, T5, T6, T7, T8>::FuncType &pFunc) :
01517             m_pFunc(new FuncFunPtr<R, T0, T1, T2, T3, T4, T5, T6, T7, T8>(pFunc))
01518         {
01519         }
01520 
01521         template <class CLASS>
01522         Functor(const typename MethodSignature<CLASS, R, T0, T1, T2, T3, T4, T5, T6, T7, T8>::MemFuncType &pMemFunc, CLASS *pObject) :
01523             m_pFunc(new FuncMemPtr<CLASS, R, T0, T1, T2, T3, T4, T5, T6, T7, T8>(pMemFunc, pObject))
01524         {
01525         }
01526 
01527         Functor(const Functor &cFunctor) : m_pFunc(nullptr)
01528         {
01529             // Check wrapped function object
01530             if (cFunctor.m_pFunc) {
01531                 // Clone and copy wrapped function object
01532                 m_pFunc = cFunctor.m_pFunc->Clone();
01533             }
01534         }
01535 
01536         virtual ~Functor()
01537         {
01538             // Destroy wrapped function object
01539             if (m_pFunc)
01540                 delete m_pFunc;
01541         }
01542 
01543         Functor &operator =(const Functor &cFunctor)
01544         {
01545             // Check if the functor already wraps a function object
01546             if (m_pFunc) {
01547                 // Destroy old implementation
01548                 delete m_pFunc;
01549                 m_pFunc = nullptr;
01550             }
01551 
01552             // Check function object
01553             if (cFunctor.m_pFunc) {
01554                 // Clone and copy wrapped function object
01555                 m_pFunc = cFunctor.m_pFunc->Clone();
01556             }
01557 
01558             // Return this object
01559             return *this;
01560         }
01561 
01562         virtual _R operator ()(_T0 t0, _T1 t1, _T2 t2, _T3 t3, _T4 t4, _T5 t5, _T6 t6, _T7 t7, _T8 t8) override
01563         {
01564             if (m_pFunc)
01565                 return (*static_cast<Func<R, T0, T1, T2, T3, T4, T5, T6, T7, T8>* >(m_pFunc))(t0, t1, t2, t3, t4, t5, t6, t7, t8);
01566             else
01567                 return DefaultValue<R>::Default();
01568         }
01569 
01570         virtual DynFunc *Clone() const override
01571         {
01572             return new Functor(m_pFunc ? m_pFunc->Clone() : nullptr);
01573         }
01574 
01575     private:
01576         DynFunc *m_pFunc;   /**< Pointer to wrapped function object, can be a null pointer */
01577 };
01578 
01579 /**
01580 *  @brief
01581 *    Generic functor class (delegate, a form of type-safe function pointer, 'callback')
01582 *
01583 *  @remarks
01584 *    Implementation for 9 parameters without a return value
01585 */
01586 template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
01587 class Functor<void, T0, T1, T2, T3, T4, T5, T6, T7, T8> : public Func<void, T0, T1, T2, T3, T4, T5, T6, T7, T8> {
01588     public:
01589         typedef typename Type<T0> ::_Type _T0;
01590         typedef typename Type<T1> ::_Type _T1;
01591         typedef typename Type<T2> ::_Type _T2;
01592         typedef typename Type<T3> ::_Type _T3;
01593         typedef typename Type<T4> ::_Type _T4;
01594         typedef typename Type<T5> ::_Type _T5;
01595         typedef typename Type<T6> ::_Type _T6;
01596         typedef typename Type<T7> ::_Type _T7;
01597         typedef typename Type<T8> ::_Type _T8;
01598 
01599         Functor() : m_pFunc(nullptr)
01600         {
01601         }
01602 
01603         Functor(DynFunc *pFunc) : m_pFunc(pFunc)
01604         {
01605         }
01606 
01607         Functor(const typename Signature<void, T0, T1, T2, T3, T4, T5, T6, T7, T8>::FuncType &pFunc) :
01608             m_pFunc(new FuncFunPtr<void, T0, T1, T2, T3, T4, T5, T6, T7, T8>(pFunc))
01609         {
01610         }
01611 
01612         template <class CLASS>
01613         Functor(const typename MethodSignature<CLASS, void, T0, T1, T2, T3, T4, T5, T6, T7, T8>::MemFuncType &pMemFunc, CLASS *pObject) :
01614             m_pFunc(new FuncMemPtr<CLASS, void, T0, T1, T2, T3, T4, T5, T6, T7, T8>(pMemFunc, pObject))
01615         {
01616         }
01617 
01618         Functor(const Functor &cFunctor) : m_pFunc(nullptr)
01619         {
01620             // Check wrapped function object
01621             if (cFunctor.m_pFunc) {
01622                 // Clone and copy wrapped function object
01623                 m_pFunc = cFunctor.m_pFunc->Clone();
01624             }
01625         }
01626 
01627         virtual ~Functor()
01628         {
01629             // Destroy wrapped function object
01630             if (m_pFunc)
01631                 delete m_pFunc;
01632         }
01633 
01634         Functor &operator =(const Functor &cFunctor)
01635         {
01636             // Check if the functor already wraps a function object
01637             if (m_pFunc) {
01638                 // Destroy old implementation
01639                 delete m_pFunc;
01640                 m_pFunc = nullptr;
01641             }
01642 
01643             // Check function object
01644             if (cFunctor.m_pFunc) {
01645                 // Clone and copy wrapped function object
01646                 m_pFunc = cFunctor.m_pFunc->Clone();
01647             }
01648 
01649             // Return this object
01650             return *this;
01651         }
01652 
01653         virtual void operator ()(_T0 t0, _T1 t1, _T2 t2, _T3 t3, _T4 t4, _T5 t5, _T6 t6, _T7 t7, _T8 t8) override
01654         {
01655             if (m_pFunc)
01656                 (*static_cast<Func<void, T0, T1, T2, T3, T4, T5, T6, T7, T8>* >(m_pFunc))(t0, t1, t2, t3, t4, t5, t6, t7, t8);
01657         }
01658 
01659         virtual DynFunc *Clone() const override
01660         {
01661             return new Functor(m_pFunc ? m_pFunc->Clone() : nullptr);
01662         }
01663 
01664     private:
01665         DynFunc *m_pFunc;   /**< Pointer to wrapped function object, can be a null pointer */
01666 };
01667 
01668 /**
01669 *  @brief
01670 *    Generic functor class (delegate, a form of type-safe function pointer, 'callback')
01671 *
01672 *  @remarks
01673 *    Implementation for 8 parameters and a return value
01674 */
01675 template <typename R, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
01676 class Functor<R, T0, T1, T2, T3, T4, T5, T6, T7> : public Func<R, T0, T1, T2, T3, T4, T5, T6, T7> {
01677     public:
01678         typedef typename Type<R>  ::_Type _R;
01679         typedef typename Type<T0> ::_Type _T0;
01680         typedef typename Type<T1> ::_Type _T1;
01681         typedef typename Type<T2> ::_Type _T2;
01682         typedef typename Type<T3> ::_Type _T3;
01683         typedef typename Type<T4> ::_Type _T4;
01684         typedef typename Type<T5> ::_Type _T5;
01685         typedef typename Type<T6> ::_Type _T6;
01686         typedef typename Type<T7> ::_Type _T7;
01687 
01688         Functor() : m_pFunc(nullptr)
01689         {
01690         }
01691 
01692         Functor(DynFunc *pFunc) : m_pFunc(pFunc)
01693         {
01694         }
01695 
01696         Functor(const typename Signature<R, T0, T1, T2, T3, T4, T5, T6, T7>::FuncType &pFunc) :
01697             m_pFunc(new FuncFunPtr<R, T0, T1, T2, T3, T4, T5, T6, T7>(pFunc))
01698         {
01699         }
01700 
01701         template <class CLASS>
01702         Functor(const typename MethodSignature<CLASS, R, T0, T1, T2, T3, T4, T5, T6, T7>::MemFuncType &pMemFunc, CLASS *pObject) :
01703             m_pFunc(new FuncMemPtr<CLASS, R, T0, T1, T2, T3, T4, T5, T6, T7>(pMemFunc, pObject))
01704         {
01705         }
01706 
01707         Functor(const Functor &cFunctor) : m_pFunc(nullptr)
01708         {
01709             // Check wrapped function object
01710             if (cFunctor.m_pFunc) {
01711                 // Clone and copy wrapped function object
01712                 m_pFunc = cFunctor.m_pFunc->Clone();
01713             }
01714         }
01715 
01716         virtual ~Functor()
01717         {
01718             // Destroy wrapped function object
01719             if (m_pFunc)
01720                 delete m_pFunc;
01721         }
01722 
01723         Functor &operator =(const Functor &cFunctor)
01724         {
01725             // Check if the functor already wraps a function object
01726             if (m_pFunc) {
01727                 // Destroy old implementation
01728                 delete m_pFunc;
01729                 m_pFunc = nullptr;
01730             }
01731 
01732             // Check function object
01733             if (cFunctor.m_pFunc) {
01734                 // Clone and copy wrapped function object
01735                 m_pFunc = cFunctor.m_pFunc->Clone();
01736             }
01737 
01738             // Return this object
01739             return *this;
01740         }
01741 
01742         virtual _R operator ()(_T0 t0, _T1 t1, _T2 t2, _T3 t3, _T4 t4, _T5 t5, _T6 t6, _T7 t7) override
01743         {
01744             if (m_pFunc)
01745                 return (*static_cast<Func<R, T0, T1, T2, T3, T4, T5, T6, T7>* >(m_pFunc))(t0, t1, t2, t3, t4, t5, t6, t7);
01746             else
01747                 return DefaultValue<R>::Default();
01748         }
01749 
01750         virtual DynFunc *Clone() const override
01751         {
01752             return new Functor(m_pFunc ? m_pFunc->Clone() : nullptr);
01753         }
01754 
01755     private:
01756         DynFunc *m_pFunc;   /**< Pointer to wrapped function object, can be a null pointer */
01757 };
01758 
01759 /**
01760 *  @brief
01761 *    Generic functor class (delegate, a form of type-safe function pointer, 'callback')
01762 *
01763 *  @remarks
01764 *    Implementation for 8 parameters without a return value
01765 */
01766 template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
01767 class Functor<void, T0, T1, T2, T3, T4, T5, T6, T7> : public Func<void, T0, T1, T2, T3, T4, T5, T6, T7> {
01768     public:
01769         typedef typename Type<T0> ::_Type _T0;
01770         typedef typename Type<T1> ::_Type _T1;
01771         typedef typename Type<T2> ::_Type _T2;
01772         typedef typename Type<T3> ::_Type _T3;
01773         typedef typename Type<T4> ::_Type _T4;
01774         typedef typename Type<T5> ::_Type _T5;
01775         typedef typename Type<T6> ::_Type _T6;
01776         typedef typename Type<T7> ::_Type _T7;
01777 
01778         Functor() : m_pFunc(nullptr)
01779         {
01780         }
01781 
01782         Functor(DynFunc *pFunc) : m_pFunc(pFunc)
01783         {
01784         }
01785 
01786         Functor(const typename Signature<void, T0, T1, T2, T3, T4, T5, T6, T7>::FuncType &pFunc) :
01787             m_pFunc(new FuncFunPtr<void, T0, T1, T2, T3, T4, T5, T6, T7>(pFunc))
01788         {
01789         }
01790 
01791         template <class CLASS>
01792         Functor(const typename MethodSignature<CLASS, void, T0, T1, T2, T3, T4, T5, T6, T7>::MemFuncType &pMemFunc, CLASS *pObject) :
01793             m_pFunc(new FuncMemPtr<CLASS, void, T0, T1, T2, T3, T4, T5, T6, T7>(pMemFunc, pObject))
01794         {
01795         }
01796 
01797         Functor(const Functor &cFunctor) : m_pFunc(nullptr)
01798         {
01799             // Check wrapped function object
01800             if (cFunctor.m_pFunc) {
01801                 // Clone and copy wrapped function object
01802                 m_pFunc = cFunctor.m_pFunc->Clone();
01803             }
01804         }
01805 
01806         virtual ~Functor()
01807         {
01808             // Destroy wrapped function object
01809             if (m_pFunc)
01810                 delete m_pFunc;
01811         }
01812 
01813         Functor &operator =(const Functor &cFunctor)
01814         {
01815             // Check if the functor already wraps a function object
01816             if (m_pFunc) {
01817                 // Destroy old implementation
01818                 delete m_pFunc;
01819                 m_pFunc = nullptr;
01820             }
01821 
01822             // Check function object
01823             if (cFunctor.m_pFunc) {
01824                 // Clone and copy wrapped function object
01825                 m_pFunc = cFunctor.m_pFunc->Clone();
01826             }
01827 
01828             // Return this object
01829             return *this;
01830         }
01831 
01832         virtual void operator ()(_T0 t0, _T1 t1, _T2 t2, _T3 t3, _T4 t4, _T5 t5, _T6 t6, _T7 t7) override
01833         {
01834             if (m_pFunc)
01835                 (*static_cast<Func<void, T0, T1, T2, T3, T4, T5, T6, T7>* >(m_pFunc))(t0, t1, t2, t3, t4, t5, t6, t7);
01836         }
01837 
01838         virtual DynFunc *Clone() const override
01839         {
01840             return new Functor(m_pFunc ? m_pFunc->Clone() : nullptr);
01841         }
01842 
01843     private:
01844         DynFunc *m_pFunc;   /**< Pointer to wrapped function object, can be a null pointer */
01845 };
01846 
01847 /**
01848 *  @brief
01849 *    Generic functor class (delegate, a form of type-safe function pointer, 'callback')
01850 *
01851 *  @remarks
01852 *    Implementation for 7 parameters and a return value
01853 */
01854 template <typename R, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
01855 class Functor<R, T0, T1, T2, T3, T4, T5, T6> : public Func<R, T0, T1, T2, T3, T4, T5, T6> {
01856     public:
01857         typedef typename Type<R>  ::_Type _R;
01858         typedef typename Type<T0> ::_Type _T0;
01859         typedef typename Type<T1> ::_Type _T1;
01860         typedef typename Type<T2> ::_Type _T2;
01861         typedef typename Type<T3> ::_Type _T3;
01862         typedef typename Type<T4> ::_Type _T4;
01863         typedef typename Type<T5> ::_Type _T5;
01864         typedef typename Type<T6> ::_Type _T6;
01865 
01866         Functor() : m_pFunc(nullptr)
01867         {
01868         }
01869 
01870         Functor(DynFunc *pFunc) : m_pFunc(pFunc)
01871         {
01872         }
01873 
01874         Functor(const typename Signature<R, T0, T1, T2, T3, T4, T5, T6>::FuncType &pFunc) :
01875             m_pFunc(new FuncFunPtr<R, T0, T1, T2, T3, T4, T5, T6>(pFunc))
01876         {
01877         }
01878 
01879         template <class CLASS>
01880         Functor(const typename MethodSignature<CLASS, R, T0, T1, T2, T3, T4, T5, T6>::MemFuncType &pMemFunc, CLASS *pObject) :
01881             m_pFunc(new FuncMemPtr<CLASS, R, T0, T1, T2, T3, T4, T5, T6>(pMemFunc, pObject))
01882         {
01883         }
01884 
01885         Functor(const Functor &cFunctor) : m_pFunc(nullptr)
01886         {
01887             // Check wrapped function object
01888             if (cFunctor.m_pFunc) {
01889                 // Clone and copy wrapped function object
01890                 m_pFunc = cFunctor.m_pFunc->Clone();
01891             }
01892         }
01893 
01894         virtual ~Functor()
01895         {
01896             // Destroy wrapped function object
01897             if (m_pFunc)
01898                 delete m_pFunc;
01899         }
01900 
01901         Functor &operator =(const Functor &cFunctor)
01902         {
01903             // Check if the functor already wraps a function object
01904             if (m_pFunc) {
01905                 // Destroy old implementation
01906                 delete m_pFunc;
01907                 m_pFunc = nullptr;
01908             }
01909 
01910             // Check function object
01911             if (cFunctor.m_pFunc) {
01912                 // Clone and copy wrapped function object
01913                 m_pFunc = cFunctor.m_pFunc->Clone();
01914             }
01915 
01916             // Return this object
01917             return *this;
01918         }
01919 
01920         virtual _R operator ()(_T0 t0, _T1 t1, _T2 t2, _T3 t3, _T4 t4, _T5 t5, _T6 t6) override
01921         {
01922             if (m_pFunc)
01923                 return (*static_cast<Func<R, T0, T1, T2, T3, T4, T5, T6>* >(m_pFunc))(t0, t1, t2, t3, t4, t5, t6);
01924             else
01925                 return DefaultValue<R>::Default();
01926         }
01927 
01928         virtual DynFunc *Clone() const override
01929         {
01930             return new Functor(m_pFunc ? m_pFunc->Clone() : nullptr);
01931         }
01932 
01933     private:
01934         DynFunc *m_pFunc;   /**< Pointer to wrapped function object, can be a null pointer */
01935 };
01936 
01937 /**
01938 *  @brief
01939 *    Generic functor class (delegate, a form of type-safe function pointer, 'callback')
01940 *
01941 *  @remarks
01942 *    Implementation for 7 parameters without a return value
01943 */
01944 template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
01945 class Functor<void, T0, T1, T2, T3, T4, T5, T6> : public Func<void, T0, T1, T2, T3, T4, T5, T6> {
01946     public:
01947         typedef typename Type<T0> ::_Type _T0;
01948         typedef typename Type<T1> ::_Type _T1;
01949         typedef typename Type<T2> ::_Type _T2;
01950         typedef typename Type<T3> ::_Type _T3;
01951         typedef typename Type<T4> ::_Type _T4;
01952         typedef typename Type<T5> ::_Type _T5;
01953         typedef typename Type<T6> ::_Type _T6;
01954 
01955         Functor() : m_pFunc(nullptr)
01956         {
01957         }
01958 
01959         Functor(DynFunc *pFunc) : m_pFunc(pFunc)
01960         {
01961         }
01962 
01963         Functor(const typename Signature<void, T0, T1, T2, T3, T4, T5, T6>::FuncType &pFunc) :
01964             m_pFunc(new FuncFunPtr<void, T0, T1, T2, T3, T4, T5, T6>(pFunc))
01965         {
01966         }
01967 
01968         template <class CLASS>
01969         Functor(const typename MethodSignature<CLASS, void, T0, T1, T2, T3, T4, T5, T6>::MemFuncType &pMemFunc, CLASS *pObject) :
01970             m_pFunc(new FuncMemPtr<CLASS, void, T0, T1, T2, T3, T4, T5, T6>(pMemFunc, pObject))
01971         {
01972         }
01973 
01974         Functor(const Functor &cFunctor) : m_pFunc(nullptr)
01975         {
01976             // Check wrapped function object
01977             if (cFunctor.m_pFunc) {
01978                 // Clone and copy wrapped function object
01979                 m_pFunc = cFunctor.m_pFunc->Clone();
01980             }
01981         }
01982 
01983         virtual ~Functor()
01984         {
01985             // Destroy wrapped function object
01986             if (m_pFunc)
01987                 delete m_pFunc;
01988         }
01989 
01990         Functor &operator =(const Functor &cFunctor)
01991         {
01992             // Check if the functor already wraps a function object
01993             if (m_pFunc) {
01994                 // Destroy old implementation
01995                 delete m_pFunc;
01996                 m_pFunc = nullptr;
01997             }
01998 
01999             // Check function object
02000             if (cFunctor.m_pFunc) {
02001                 // Clone and copy wrapped function object
02002                 m_pFunc = cFunctor.m_pFunc->Clone();
02003             }
02004 
02005             // Return this object
02006             return *this;
02007         }
02008 
02009         virtual void operator ()(_T0 t0, _T1 t1, _T2 t2, _T3 t3, _T4 t4, _T5 t5, _T6 t6) override
02010         {
02011             if (m_pFunc)
02012                 (*static_cast<Func<void, T0, T1, T2, T3, T4, T5, T6>* >(m_pFunc))(t0, t1, t2, t3, t4, t5, t6);
02013         }
02014 
02015         virtual DynFunc *Clone() const override
02016         {
02017             return new Functor(m_pFunc ? m_pFunc->Clone() : nullptr);
02018         }
02019 
02020     private:
02021         DynFunc *m_pFunc;   /**< Pointer to wrapped function object, can be a null pointer */
02022 };
02023 
02024 /**
02025 *  @brief
02026 *    Generic functor class (delegate, a form of type-safe function pointer, 'callback')
02027 *
02028 *  @remarks
02029 *    Implementation for 6 parameters and a return value
02030 */
02031 template <typename R, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
02032 class Functor<R, T0, T1, T2, T3, T4, T5> : public Func<R, T0, T1, T2, T3, T4, T5> {
02033     public:
02034         typedef typename Type<R>  ::_Type _R;
02035         typedef typename Type<T0> ::_Type _T0;
02036         typedef typename Type<T1> ::_Type _T1;
02037         typedef typename Type<T2> ::_Type _T2;
02038         typedef typename Type<T3> ::_Type _T3;
02039         typedef typename Type<T4> ::_Type _T4;
02040         typedef typename Type<T5> ::_Type _T5;
02041 
02042         Functor() : m_pFunc(nullptr)
02043         {
02044         }
02045 
02046         Functor(DynFunc *pFunc) : m_pFunc(pFunc)
02047         {
02048         }
02049 
02050         Functor(const typename Signature<R, T0, T1, T2, T3, T4, T5>::FuncType &pFunc) :
02051             m_pFunc(new FuncFunPtr<R, T0, T1, T2, T3, T4, T5>(pFunc))
02052         {
02053         }
02054 
02055         template <class CLASS>
02056         Functor(const typename MethodSignature<CLASS, R, T0, T1, T2, T3, T4, T5>::MemFuncType &pMemFunc, CLASS *pObject) :
02057             m_pFunc(new FuncMemPtr<CLASS, R, T0, T1, T2, T3, T4, T5>(pMemFunc, pObject))
02058         {
02059         }
02060 
02061         Functor(const Functor &cFunctor) : m_pFunc(nullptr)
02062         {
02063             // Check wrapped function object
02064             if (cFunctor.m_pFunc) {
02065                 // Clone and copy wrapped function object
02066                 m_pFunc = cFunctor.m_pFunc->Clone();
02067             }
02068         }
02069 
02070         virtual ~Functor()
02071         {
02072             // Destroy wrapped function object
02073             if (m_pFunc)
02074                 delete m_pFunc;
02075         }
02076 
02077         Functor &operator =(const Functor &cFunctor)
02078         {
02079             // Check if the functor already wraps a function object
02080             if (m_pFunc) {
02081                 // Destroy old implementation
02082                 delete m_pFunc;
02083                 m_pFunc = nullptr;
02084             }
02085 
02086             // Check function object
02087             if (cFunctor.m_pFunc) {
02088                 // Clone and copy wrapped function object
02089                 m_pFunc = cFunctor.m_pFunc->Clone();
02090             }
02091 
02092             // Return this object
02093             return *this;
02094         }
02095 
02096         virtual _R operator ()(_T0 t0, _T1 t1, _T2 t2, _T3 t3, _T4 t4, _T5 t5) override
02097         {
02098             if (m_pFunc)
02099                 return (*static_cast<Func<R, T0, T1, T2, T3, T4, T5>* >(m_pFunc))(t0, t1, t2, t3, t4, t5);
02100             else
02101                 return DefaultValue<R>::Default();
02102         }
02103 
02104         virtual DynFunc *Clone() const override
02105         {
02106             return new Functor(m_pFunc ? m_pFunc->Clone() : nullptr);
02107         }
02108 
02109     private:
02110         DynFunc *m_pFunc;   /**< Pointer to wrapped function object, can be a null pointer */
02111 };
02112 
02113 /**
02114 *  @brief
02115 *    Generic functor class (delegate, a form of type-safe function pointer, 'callback')
02116 *
02117 *  @remarks
02118 *    Implementation for 6 parameters without a return value
02119 */
02120 template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
02121 class Functor<void, T0, T1, T2, T3, T4, T5> : public Func<void, T0, T1, T2, T3, T4, T5> {
02122     public:
02123         typedef typename Type<T0> ::_Type _T0;
02124         typedef typename Type<T1> ::_Type _T1;
02125         typedef typename Type<T2> ::_Type _T2;
02126         typedef typename Type<T3> ::_Type _T3;
02127         typedef typename Type<T4> ::_Type _T4;
02128         typedef typename Type<T5> ::_Type _T5;
02129 
02130         Functor() : m_pFunc(nullptr)
02131         {
02132         }
02133 
02134         Functor(DynFunc *pFunc) : m_pFunc(pFunc)
02135         {
02136         }
02137 
02138         Functor(const typename Signature<void, T0, T1, T2, T3, T4, T5>::FuncType &pFunc) :
02139             m_pFunc(new FuncFunPtr<void, T0, T1, T2, T3, T4, T5>(pFunc))
02140         {
02141         }
02142 
02143         template <class CLASS>
02144         Functor(const typename MethodSignature<CLASS, void, T0, T1, T2, T3, T4, T5>::MemFuncType &pMemFunc, CLASS *pObject) :
02145             m_pFunc(new FuncMemPtr<CLASS, void, T0, T1, T2, T3, T4, T5>(pMemFunc, pObject))
02146         {
02147         }
02148 
02149         Functor(const Functor &cFunctor) : m_pFunc(nullptr)
02150         {
02151             // Check wrapped function object
02152             if (cFunctor.m_pFunc) {
02153                 // Clone and copy wrapped function object
02154                 m_pFunc = cFunctor.m_pFunc->Clone();
02155             }
02156         }
02157 
02158         virtual ~Functor()
02159         {
02160             // Destroy wrapped function object
02161             if (m_pFunc)
02162                 delete m_pFunc;
02163         }
02164 
02165         Functor &operator =(const Functor &cFunctor)
02166         {
02167             // Check if the functor already wraps a function object
02168             if (m_pFunc) {
02169                 // Destroy old implementation
02170                 delete m_pFunc;
02171                 m_pFunc = nullptr;
02172             }
02173 
02174             // Check function object
02175             if (cFunctor.m_pFunc) {
02176                 // Clone and copy wrapped function object
02177                 m_pFunc = cFunctor.m_pFunc->Clone();
02178             }
02179 
02180             // Return this object
02181             return *this;
02182         }
02183 
02184         virtual void operator ()(_T0 t0, _T1 t1, _T2 t2, _T3 t3, _T4 t4, _T5 t5) override
02185         {
02186             if (m_pFunc)
02187                 (*static_cast<Func<void, T0, T1, T2, T3, T4, T5>* >(m_pFunc))(t0, t1, t2, t3, t4, t5);
02188         }
02189 
02190         virtual DynFunc *Clone() const override
02191         {
02192             return new Functor(m_pFunc ? m_pFunc->Clone() : nullptr);
02193         }
02194 
02195     private:
02196         DynFunc *m_pFunc;   /**< Pointer to wrapped function object, can be a null pointer */
02197 };
02198 
02199 /**
02200 *  @brief
02201 *    Generic functor class (delegate, a form of type-safe function pointer, 'callback')
02202 *
02203 *  @remarks
02204 *    Implementation for 5 parameters and a return value
02205 */
02206 template <typename R, typename T0, typename T1, typename T2, typename T3, typename T4>
02207 class Functor<R, T0, T1, T2, T3, T4> : public Func<R, T0, T1, T2, T3, T4> {
02208     public:
02209         typedef typename Type<R>  ::_Type _R;
02210         typedef typename Type<T0> ::_Type _T0;
02211         typedef typename Type<T1> ::_Type _T1;
02212         typedef typename Type<T2> ::_Type _T2;
02213         typedef typename Type<T3> ::_Type _T3;
02214         typedef typename Type<T4> ::_Type _T4;
02215 
02216         Functor() : m_pFunc(nullptr)
02217         {
02218         }
02219 
02220         Functor(DynFunc *pFunc) : m_pFunc(pFunc)
02221         {
02222         }
02223 
02224         Functor(const typename Signature<R, T0, T1, T2, T3, T4>::FuncType &pFunc) :
02225             m_pFunc(new FuncFunPtr<R, T0, T1, T2, T3, T4>(pFunc))
02226         {
02227         }
02228 
02229         template <class CLASS>
02230         Functor(const typename MethodSignature<CLASS, R, T0, T1, T2, T3, T4>::MemFuncType &pMemFunc, CLASS *pObject) :
02231             m_pFunc(new FuncMemPtr<CLASS, R, T0, T1, T2, T3, T4>(pMemFunc, pObject))
02232         {
02233         }
02234 
02235         Functor(const Functor &cFunctor) : m_pFunc(nullptr)
02236         {
02237             // Check wrapped function object
02238             if (cFunctor.m_pFunc) {
02239                 // Clone and copy wrapped function object
02240                 m_pFunc = cFunctor.m_pFunc->Clone();
02241             }
02242         }
02243 
02244         virtual ~Functor()
02245         {
02246             // Destroy wrapped function object
02247             if (m_pFunc)
02248                 delete m_pFunc;
02249         }
02250 
02251         Functor &operator =(const Functor &cFunctor)
02252         {
02253             // Check if the functor already wraps a function object
02254             if (m_pFunc) {
02255                 // Destroy old implementation
02256                 delete m_pFunc;
02257                 m_pFunc = nullptr;
02258             }
02259 
02260             // Check function object
02261             if (cFunctor.m_pFunc) {
02262                 // Clone and copy wrapped function object
02263                 m_pFunc = cFunctor.m_pFunc->Clone();
02264             }
02265 
02266             // Return this object
02267             return *this;
02268         }
02269 
02270         virtual _R operator ()(_T0 t0, _T1 t1, _T2 t2, _T3 t3, _T4 t4) override
02271         {
02272             if (m_pFunc)
02273                 return (*static_cast<Func<R, T0, T1, T2, T3, T4>* >(m_pFunc))(t0, t1, t2, t3, t4);
02274             else
02275                 return DefaultValue<R>::Default();
02276         }
02277 
02278         virtual DynFunc *Clone() const override
02279         {
02280             return new Functor(m_pFunc ? m_pFunc->Clone() : nullptr);
02281         }
02282 
02283     private:
02284         DynFunc *m_pFunc;   /**< Pointer to wrapped function object, can be a null pointer */
02285 };
02286 
02287 /**
02288 *  @brief
02289 *    Generic functor class (delegate, a form of type-safe function pointer, 'callback')
02290 *
02291 *  @remarks
02292 *    Implementation for 5 parameters without a return value
02293 */
02294 template <typename T0, typename T1, typename T2, typename T3, typename T4>
02295 class Functor<void, T0, T1, T2, T3, T4> : public Func<void, T0, T1, T2, T3, T4> {
02296     public:
02297         typedef typename Type<T0> ::_Type _T0;
02298         typedef typename Type<T1> ::_Type _T1;
02299         typedef typename Type<T2> ::_Type _T2;
02300         typedef typename Type<T3> ::_Type _T3;
02301         typedef typename Type<T4> ::_Type _T4;
02302 
02303         Functor() : m_pFunc(nullptr)
02304         {
02305         }
02306 
02307         Functor(DynFunc *pFunc) : m_pFunc(pFunc)
02308         {
02309         }
02310 
02311         Functor(const typename Signature<void, T0, T1, T2, T3, T4>::FuncType &pFunc) :
02312             m_pFunc(new FuncFunPtr<void, T0, T1, T2, T3, T4>(pFunc))
02313         {
02314         }
02315 
02316         template <class CLASS>
02317         Functor(const typename MethodSignature<CLASS, void, T0, T1, T2, T3, T4>::MemFuncType &pMemFunc, CLASS *pObject) :
02318             m_pFunc(new FuncMemPtr<CLASS, void, T0, T1, T2, T3, T4>(pMemFunc, pObject))
02319         {
02320         }
02321 
02322         Functor(const Functor &cFunctor) : m_pFunc(nullptr)
02323         {
02324             // Check wrapped function object
02325             if (cFunctor.m_pFunc) {
02326                 // Clone and copy wrapped function object
02327                 m_pFunc = cFunctor.m_pFunc->Clone();
02328             }
02329         }
02330 
02331         virtual ~Functor()
02332         {
02333             // Destroy wrapped function object
02334             if (m_pFunc)
02335                 delete m_pFunc;
02336         }
02337 
02338         Functor &operator =(const Functor &cFunctor)
02339         {
02340             // Check if the functor already wraps a function object
02341             if (m_pFunc) {
02342                 // Destroy old implementation
02343                 delete m_pFunc;
02344                 m_pFunc = nullptr;
02345             }
02346 
02347             // Check function object
02348             if (cFunctor.m_pFunc) {
02349                 // Clone and copy wrapped function object
02350                 m_pFunc = cFunctor.m_pFunc->Clone();
02351             }
02352 
02353             // Return this object
02354             return *this;
02355         }
02356 
02357         virtual void operator ()(_T0 t0, _T1 t1, _T2 t2, _T3 t3, _T4 t4) override
02358         {
02359             if (m_pFunc)
02360                 (*static_cast<Func<void, T0, T1, T2, T3, T4>* >(m_pFunc))(t0, t1, t2, t3, t4);
02361         }
02362 
02363         virtual DynFunc *Clone() const override
02364         {
02365             return new Functor(m_pFunc ? m_pFunc->Clone() : nullptr);
02366         }
02367 
02368     private:
02369         DynFunc *m_pFunc;   /**< Pointer to wrapped function object, can be a null pointer */
02370 };
02371 
02372 /**
02373 *  @brief
02374 *    Generic functor class (delegate, a form of type-safe function pointer, 'callback')
02375 *
02376 *  @remarks
02377 *    Implementation for 4 parameters and a return value
02378 */
02379 template <typename R, typename T0, typename T1, typename T2, typename T3>
02380 class Functor<R, T0, T1, T2, T3> : public Func<R, T0, T1, T2, T3> {
02381     public:
02382         typedef typename Type<R>  ::_Type _R;
02383         typedef typename Type<T0> ::_Type _T0;
02384         typedef typename Type<T1> ::_Type _T1;
02385         typedef typename Type<T2> ::_Type _T2;
02386         typedef typename Type<T3> ::_Type _T3;
02387 
02388         Functor() : m_pFunc(nullptr)
02389         {
02390         }
02391 
02392         Functor(DynFunc *pFunc) : m_pFunc(pFunc)
02393         {
02394         }
02395 
02396         Functor(const typename Signature<R, T0, T1, T2, T3>::FuncType &pFunc) :
02397             m_pFunc(new FuncFunPtr<R, T0, T1, T2, T3>(pFunc))
02398         {
02399         }
02400 
02401         template <class CLASS>
02402         Functor(const typename MethodSignature<CLASS, R, T0, T1, T2, T3>::MemFuncType &pMemFunc, CLASS *pObject) :
02403             m_pFunc(new FuncMemPtr<CLASS, R, T0, T1, T2, T3>(pMemFunc, pObject))
02404         {
02405         }
02406 
02407         Functor(const Functor &cFunctor) : m_pFunc(nullptr)
02408         {
02409             // Check wrapped function object
02410             if (cFunctor.m_pFunc) {
02411                 // Clone and copy wrapped function object
02412                 m_pFunc = cFunctor.m_pFunc->Clone();
02413             }
02414         }
02415 
02416         virtual ~Functor()
02417         {
02418             // Destroy wrapped function object
02419             if (m_pFunc)
02420                 delete m_pFunc;
02421         }
02422 
02423         Functor &operator =(const Functor &cFunctor)
02424         {
02425             // Check if the functor already wraps a function object
02426             if (m_pFunc) {
02427                 // Destroy old implementation
02428                 delete m_pFunc;
02429                 m_pFunc = nullptr;
02430             }
02431 
02432             // Check function object
02433             if (cFunctor.m_pFunc) {
02434                 // Clone and copy wrapped function object
02435                 m_pFunc = cFunctor.m_pFunc->Clone();
02436             }
02437 
02438             // Return this object
02439             return *this;
02440         }
02441 
02442         virtual _R operator ()(_T0 t0, _T1 t1, _T2 t2, _T3 t3) override
02443         {
02444             if (m_pFunc)
02445                 return (*static_cast<Func<R, T0, T1, T2, T3>* >(m_pFunc))(t0, t1, t2, t3);
02446             else
02447                 return DefaultValue<R>::Default();
02448         }
02449 
02450         virtual DynFunc *Clone() const override
02451         {
02452             return new Functor(m_pFunc ? m_pFunc->Clone() : nullptr);
02453         }
02454 
02455     private:
02456         DynFunc *m_pFunc;   /**< Pointer to wrapped function object, can be a null pointer */
02457 };
02458 
02459 /**
02460 *  @brief
02461 *    Generic functor class (delegate, a form of type-safe function pointer, 'callback')
02462 *
02463 *  @remarks
02464 *    Implementation for 4 parameters without a return value
02465 */
02466 template <typename T0, typename T1, typename T2, typename T3>
02467 class Functor<void, T0, T1, T2, T3> : public Func<void, T0, T1, T2, T3> {
02468     public:
02469         typedef typename Type<T0> ::_Type _T0;
02470         typedef typename Type<T1> ::_Type _T1;
02471         typedef typename Type<T2> ::_Type _T2;
02472         typedef typename Type<T3> ::_Type _T3;
02473 
02474         Functor() : m_pFunc(nullptr)
02475         {
02476         }
02477 
02478         Functor(DynFunc *pFunc) : m_pFunc(pFunc)
02479         {
02480         }
02481 
02482         Functor(const typename Signature<void, T0, T1, T2, T3>::FuncType &pFunc) :
02483             m_pFunc(new FuncFunPtr<void, T0, T1, T2, T3>(pFunc))
02484         {
02485         }
02486 
02487         template <class CLASS>
02488         Functor(const typename MethodSignature<CLASS, void, T0, T1, T2, T3>::MemFuncType &pMemFunc, CLASS *pObject) :
02489             m_pFunc(new FuncMemPtr<CLASS, void, T0, T1, T2, T3>(pMemFunc, pObject))
02490         {
02491         }
02492 
02493         Functor(const Functor &cFunctor) : m_pFunc(nullptr)
02494         {
02495             // Check wrapped function object
02496             if (cFunctor.m_pFunc) {
02497                 // Clone and copy wrapped function object
02498                 m_pFunc = cFunctor.m_pFunc->Clone();
02499             }
02500         }
02501 
02502         virtual ~Functor()
02503         {
02504             // Destroy wrapped function object
02505             if (m_pFunc)
02506                 delete m_pFunc;
02507         }
02508 
02509         Functor &operator =(const Functor &cFunctor)
02510         {
02511             // Check if the functor already wraps a function object
02512             if (m_pFunc) {
02513                 // Destroy old implementation
02514                 delete m_pFunc;
02515                 m_pFunc = nullptr;
02516             }
02517 
02518             // Check function object
02519             if (cFunctor.m_pFunc) {
02520                 // Clone and copy wrapped function object
02521                 m_pFunc = cFunctor.m_pFunc->Clone();
02522             }
02523 
02524             // Return this object
02525             return *this;
02526         }
02527 
02528         virtual void operator ()(_T0 t0, _T1 t1, _T2 t2, _T3 t3) override
02529         {
02530             if (m_pFunc)
02531                 (*static_cast<Func<void, T0, T1, T2, T3>* >(m_pFunc))(t0, t1, t2, t3);
02532         }
02533 
02534         virtual DynFunc *Clone() const override
02535         {
02536             return new Functor(m_pFunc ? m_pFunc->Clone() : nullptr);
02537         }
02538 
02539     private:
02540         DynFunc *m_pFunc;   /**< Pointer to wrapped function object, can be a null pointer */
02541 };
02542 
02543 /**
02544 *  @brief
02545 *    Generic functor class (delegate, a form of type-safe function pointer, 'callback')
02546 *
02547 *  @remarks
02548 *    Implementation for 3 parameters and a return value
02549 */
02550 template <typename R, typename T0, typename T1, typename T2>
02551 class Functor<R, T0, T1, T2> : public Func<R, T0, T1, T2> {
02552     public:
02553         typedef typename Type<R>  ::_Type _R;
02554         typedef typename Type<T0> ::_Type _T0;
02555         typedef typename Type<T1> ::_Type _T1;
02556         typedef typename Type<T2> ::_Type _T2;
02557 
02558         Functor() : m_pFunc(nullptr)
02559         {
02560         }
02561 
02562         Functor(DynFunc *pFunc) : m_pFunc(pFunc)
02563         {
02564         }
02565 
02566         Functor(const typename Signature<R, T0, T1, T2>::FuncType &pFunc) :
02567             m_pFunc(new FuncFunPtr<R, T0, T1, T2>(pFunc))
02568         {
02569         }
02570 
02571         template <class CLASS>
02572         Functor(const typename MethodSignature<CLASS, R, T0, T1, T2>::MemFuncType &pMemFunc, CLASS *pObject) :
02573             m_pFunc(new FuncMemPtr<CLASS, R, T0, T1, T2>(pMemFunc, pObject))
02574         {
02575         }
02576 
02577         Functor(const Functor &cFunctor) : m_pFunc(nullptr)
02578         {
02579             // Check wrapped function object
02580             if (cFunctor.m_pFunc) {
02581                 // Clone and copy wrapped function object
02582                 m_pFunc = cFunctor.m_pFunc->Clone();
02583             }
02584         }
02585 
02586         virtual ~Functor()
02587         {
02588             // Destroy wrapped function object
02589             if (m_pFunc)
02590                 delete m_pFunc;
02591         }
02592 
02593         Functor &operator =(const Functor &cFunctor)
02594         {
02595             // Check if the functor already wraps a function object
02596             if (m_pFunc) {
02597                 // Destroy old implementation
02598                 delete m_pFunc;
02599                 m_pFunc = nullptr;
02600             }
02601 
02602             // Check function object
02603             if (cFunctor.m_pFunc) {
02604                 // Clone and copy wrapped function object
02605                 m_pFunc = cFunctor.m_pFunc->Clone();
02606             }
02607 
02608             // Return this object
02609             return *this;
02610         }
02611 
02612         virtual _R operator ()(_T0 t0, _T1 t1, _T2 t2) override
02613         {
02614             if (m_pFunc)
02615                 return (*static_cast<Func<R, T0, T1, T2>* >(m_pFunc))(t0, t1, t2);
02616             else
02617                 return DefaultValue<R>::Default();
02618         }
02619 
02620         virtual DynFunc *Clone() const override
02621         {
02622             return new Functor(m_pFunc ? m_pFunc->Clone() : nullptr);
02623         }
02624 
02625     private:
02626         DynFunc *m_pFunc;   /**< Pointer to wrapped function object, can be a null pointer */
02627 };
02628 
02629 /**
02630 *  @brief
02631 *    Generic functor class (delegate, a form of type-safe function pointer, 'callback')
02632 *
02633 *  @remarks
02634 *    Implementation for 3 parameters without a return value
02635 */
02636 template <typename T0, typename T1, typename T2>
02637 class Functor<void, T0, T1, T2> : public Func<void, T0, T1, T2> {
02638     public:
02639         typedef typename Type<T0> ::_Type _T0;
02640         typedef typename Type<T1> ::_Type _T1;
02641         typedef typename Type<T2> ::_Type _T2;
02642 
02643         Functor() : m_pFunc(nullptr)
02644         {
02645         }
02646 
02647         Functor(DynFunc *pFunc) : m_pFunc(pFunc)
02648         {
02649         }
02650 
02651         Functor(const typename Signature<void, T0, T1, T2>::FuncType &pFunc) :
02652             m_pFunc(new FuncFunPtr<void, T0, T1, T2>(pFunc))
02653         {
02654         }
02655 
02656         template <class CLASS>
02657         Functor(const typename MethodSignature<CLASS, void, T0, T1, T2>::MemFuncType &pMemFunc, CLASS *pObject) :
02658             m_pFunc(new FuncMemPtr<CLASS, void, T0, T1, T2>(pMemFunc, pObject))
02659         {
02660         }
02661 
02662         Functor(const Functor &cFunctor) : m_pFunc(nullptr)
02663         {
02664             // Check wrapped function object
02665             if (cFunctor.m_pFunc) {
02666                 // Clone and copy wrapped function object
02667                 m_pFunc = cFunctor.m_pFunc->Clone();
02668             }
02669         }
02670 
02671         virtual ~Functor()
02672         {
02673             // Destroy wrapped function object
02674             if (m_pFunc)
02675                 delete m_pFunc;
02676         }
02677 
02678         Functor &operator =(const Functor &cFunctor)
02679         {
02680             // Check if the functor already wraps a function object
02681             if (m_pFunc) {
02682                 // Destroy old implementation
02683                 delete m_pFunc;
02684                 m_pFunc = nullptr;
02685             }
02686 
02687             // Check function object
02688             if (cFunctor.m_pFunc) {
02689                 // Clone and copy wrapped function object
02690                 m_pFunc = cFunctor.m_pFunc->Clone();
02691             }
02692 
02693             // Return this object
02694             return *this;
02695         }
02696 
02697         virtual void operator ()(_T0 t0, _T1 t1, _T2 t2) override
02698         {
02699             if (m_pFunc)
02700                 (*static_cast<Func<void, T0, T1, T2>* >(m_pFunc))(t0, t1, t2);
02701         }
02702 
02703         virtual DynFunc *Clone() const override
02704         {
02705             return new Functor(m_pFunc ? m_pFunc->Clone() : nullptr);
02706         }
02707 
02708     private:
02709         DynFunc *m_pFunc;   /**< Pointer to wrapped function object, can be a null pointer */
02710 };
02711 
02712 /**
02713 *  @brief
02714 *    Generic functor class (delegate, a form of type-safe function pointer, 'callback')
02715 *
02716 *  @remarks
02717 *    Implementation for 2 parameters and a return value
02718 */
02719 template <typename R, typename T0, typename T1>
02720 class Functor<R, T0, T1> : public Func<R, T0, T1> {
02721     public:
02722         typedef typename Type<R>  ::_Type _R;
02723         typedef typename Type<T0> ::_Type _T0;
02724         typedef typename Type<T1> ::_Type _T1;
02725 
02726         Functor() : m_pFunc(nullptr)
02727         {
02728         }
02729 
02730         Functor(DynFunc *pFunc) : m_pFunc(pFunc)
02731         {
02732         }
02733 
02734         Functor(const typename Signature<R, T0, T1>::FuncType &pFunc) :
02735             m_pFunc(new FuncFunPtr<R, T0, T1>(pFunc))
02736         {
02737         }
02738 
02739         template <class CLASS>
02740         Functor(const typename MethodSignature<CLASS, R, T0, T1>::MemFuncType &pMemFunc, CLASS *pObject) :
02741             m_pFunc(new FuncMemPtr<CLASS, R, T0, T1>(pMemFunc, pObject))
02742         {
02743         }
02744 
02745         Functor(const Functor &cFunctor) : m_pFunc(nullptr)
02746         {
02747             // Check wrapped function object
02748             if (cFunctor.m_pFunc) {
02749                 // Clone and copy wrapped function object
02750                 m_pFunc = cFunctor.m_pFunc->Clone();
02751             }
02752         }
02753 
02754         virtual ~Functor()
02755         {
02756             // Destroy wrapped function object
02757             if (m_pFunc)
02758                 delete m_pFunc;
02759         }
02760 
02761         Functor &operator =(const Functor &cFunctor)
02762         {
02763             // Check if the functor already wraps a function object
02764             if (m_pFunc) {
02765                 // Destroy old implementation
02766                 delete m_pFunc;
02767                 m_pFunc = nullptr;
02768             }
02769 
02770             // Check function object
02771             if (cFunctor.m_pFunc) {
02772                 // Clone and copy wrapped function object
02773                 m_pFunc = cFunctor.m_pFunc->Clone();
02774             }
02775 
02776             // Return this object
02777             return *this;
02778         }
02779 
02780         virtual _R operator ()(_T0 t0, _T1 t1) override
02781         {
02782             if (m_pFunc)
02783                 return (*static_cast<Func<R, T0, T1>* >(m_pFunc))(t0, t1);
02784             else
02785                 return DefaultValue<R>::Default();
02786         }
02787 
02788         virtual DynFunc *Clone() const override
02789         {
02790             return new Functor(m_pFunc ? m_pFunc->Clone() : nullptr);
02791         }
02792 
02793     private:
02794         DynFunc *m_pFunc;   /**< Pointer to wrapped function object, can be a null pointer */
02795 };
02796 
02797 /**
02798 *  @brief
02799 *    Generic functor class (delegate, a form of type-safe function pointer, 'callback')
02800 *
02801 *  @remarks
02802 *    Implementation for 2 parameters without a return value
02803 */
02804 template <typename T0, typename T1>
02805 class Functor<void, T0, T1> : public Func<void, T0, T1> {
02806     public:
02807         typedef typename Type<T0> ::_Type _T0;
02808         typedef typename Type<T1> ::_Type _T1;
02809 
02810         Functor() : m_pFunc(nullptr)
02811         {
02812         }
02813 
02814         Functor(DynFunc *pFunc) : m_pFunc(pFunc)
02815         {
02816         }
02817 
02818         Functor(const typename Signature<void, T0, T1>::FuncType &pFunc) :
02819             m_pFunc(new FuncFunPtr<void, T0, T1>(pFunc))
02820         {
02821         }
02822 
02823         template <class CLASS>
02824         Functor(const typename MethodSignature<CLASS, void, T0, T1>::MemFuncType &pMemFunc, CLASS *pObject) :
02825             m_pFunc(new FuncMemPtr<CLASS, void, T0, T1>(pMemFunc, pObject))
02826         {
02827         }
02828 
02829         Functor(const Functor &cFunctor) : m_pFunc(nullptr)
02830         {
02831             // Check wrapped function object
02832             if (cFunctor.m_pFunc) {
02833                 // Clone and copy wrapped function object
02834                 m_pFunc = cFunctor.m_pFunc->Clone();
02835             }
02836         }
02837 
02838         virtual ~Functor()
02839         {
02840             // Destroy wrapped function object
02841             if (m_pFunc)
02842                 delete m_pFunc;
02843         }
02844 
02845         Functor &operator =(const Functor &cFunctor)
02846         {
02847             // Check if the functor already wraps a function object
02848             if (m_pFunc) {
02849                 // Destroy old implementation
02850                 delete m_pFunc;
02851                 m_pFunc = nullptr;
02852             }
02853 
02854             // Check function object
02855             if (cFunctor.m_pFunc) {
02856                 // Clone and copy wrapped function object
02857                 m_pFunc = cFunctor.m_pFunc->Clone();
02858             }
02859 
02860             // Return this object
02861             return *this;
02862         }
02863 
02864         virtual void operator ()(_T0 t0, _T1 t1) override
02865         {
02866             if (m_pFunc)
02867                 (*static_cast<Func<void, T0, T1>* >(m_pFunc))(t0, t1);
02868         }
02869 
02870         virtual DynFunc *Clone() const override
02871         {
02872             return new Functor(m_pFunc ? m_pFunc->Clone() : nullptr);
02873         }
02874 
02875     private:
02876         DynFunc *m_pFunc;   /**< Pointer to wrapped function object, can be a null pointer */
02877 };
02878 
02879 /**
02880 *  @brief
02881 *    Generic functor class (delegate, a form of type-safe function pointer, 'callback')
02882 *
02883 *  @remarks
02884 *    Implementation for 1 parameters and a return value
02885 */
02886 template <typename R, typename T0>
02887 class Functor<R, T0> : public Func<R, T0> {
02888     public:
02889         typedef typename Type<R>  ::_Type _R;
02890         typedef typename Type<T0> ::_Type _T0;
02891 
02892         Functor() : m_pFunc(nullptr)
02893         {
02894         }
02895 
02896         Functor(DynFunc *pFunc) : m_pFunc(pFunc)
02897         {
02898         }
02899 
02900         Functor(const typename Signature<R, T0>::FuncType &pFunc) :
02901             m_pFunc(new FuncFunPtr<R, T0>(pFunc))
02902         {
02903         }
02904 
02905         template <class CLASS>
02906         Functor(const typename MethodSignature<CLASS, R, T0>::MemFuncType &pMemFunc, CLASS *pObject) :
02907             m_pFunc(new FuncMemPtr<CLASS, R, T0>(pMemFunc, pObject))
02908         {
02909         }
02910 
02911         Functor(const Functor &cFunctor) : m_pFunc(nullptr)
02912         {
02913             // Check wrapped function object
02914             if (cFunctor.m_pFunc) {
02915                 // Clone and copy wrapped function object
02916                 m_pFunc = cFunctor.m_pFunc->Clone();
02917             }
02918         }
02919 
02920         virtual ~Functor()
02921         {
02922             // Destroy wrapped function object
02923             if (m_pFunc)
02924                 delete m_pFunc;
02925         }
02926 
02927         Functor &operator =(const Functor &cFunctor)
02928         {
02929             // Check if the functor already wraps a function object
02930             if (m_pFunc) {
02931                 // Destroy old implementation
02932                 delete m_pFunc;
02933                 m_pFunc = nullptr;
02934             }
02935 
02936             // Check function object
02937             if (cFunctor.m_pFunc) {
02938                 // Clone and copy wrapped function object
02939                 m_pFunc = cFunctor.m_pFunc->Clone();
02940             }
02941 
02942             // Return this object
02943             return *this;
02944         }
02945 
02946         virtual _R operator ()(_T0 t0) override
02947         {
02948             if (m_pFunc)
02949                 return (*static_cast<Func<R, T0>* >(m_pFunc))(t0);
02950             else
02951                 return DefaultValue<R>::Default();
02952         }
02953 
02954         virtual DynFunc *Clone() const override
02955         {
02956             return new Functor(m_pFunc ? m_pFunc->Clone() : nullptr);
02957         }
02958 
02959     private:
02960         DynFunc *m_pFunc;   /**< Pointer to wrapped function object, can be a null pointer */
02961 };
02962 
02963 /**
02964 *  @brief
02965 *    Generic functor class (delegate, a form of type-safe function pointer, 'callback')
02966 *
02967 *  @remarks
02968 *    Implementation for 1 parameters without a return value
02969 */
02970 template <typename T0>
02971 class Functor<void, T0> : public Func<void, T0> {
02972     public:
02973         typedef typename Type<T0>::_Type _T0;
02974 
02975     public:
02976         Functor() : m_pFunc(nullptr)
02977         {
02978         }
02979 
02980         Functor(DynFunc *pFunc) : m_pFunc(pFunc)
02981         {
02982         }
02983 
02984         Functor(const typename Signature<void, T0>::FuncType &pFunc) :
02985             m_pFunc(new FuncFunPtr<void, T0>(pFunc))
02986         {
02987         }
02988 
02989         template <class CLASS>
02990         Functor(const typename MethodSignature<CLASS, void, T0>::MemFuncType &pMemFunc, CLASS *pObject) :
02991             m_pFunc(new FuncMemPtr<CLASS, void, T0>(pMemFunc, pObject))
02992         {
02993         }
02994 
02995         Functor(const Functor &cFunctor) : m_pFunc(nullptr)
02996         {
02997             // Check wrapped function object
02998             if (cFunctor.m_pFunc) {
02999                 // Clone and copy wrapped function object
03000                 m_pFunc = cFunctor.m_pFunc->Clone();
03001             }
03002         }
03003 
03004         virtual ~Functor()
03005         {
03006             // Destroy wrapped function object
03007             if (m_pFunc)
03008                 delete m_pFunc;
03009         }
03010 
03011         Functor &operator =(const Functor &cFunctor)
03012         {
03013             // Check if the functor already wraps a function object
03014             if (m_pFunc) {
03015                 // Destroy old implementation
03016                 delete m_pFunc;
03017                 m_pFunc = nullptr;
03018             }
03019 
03020             // Check function object
03021             if (cFunctor.m_pFunc) {
03022                 // Clone and copy wrapped function object
03023                 m_pFunc = cFunctor.m_pFunc->Clone();
03024             }
03025 
03026             // Return this object
03027             return *this;
03028         }
03029 
03030         virtual void operator ()(_T0 t0) override
03031         {
03032             if (m_pFunc)
03033                 (*static_cast<Func<void, T0>* >(m_pFunc))(t0);
03034         }
03035 
03036         virtual DynFunc *Clone() const override
03037         {
03038             return new Functor(m_pFunc ? m_pFunc->Clone() : nullptr);
03039         }
03040 
03041     private:
03042         DynFunc *m_pFunc;   /**< Pointer to wrapped function object, can be a null pointer */
03043 };
03044 
03045 /**
03046 *  @brief
03047 *    Generic functor class (delegate, a form of type-safe function pointer, 'callback')
03048 *
03049 *  @remarks
03050 *    Implementation for 0 parameters and a return value
03051 */
03052 template <typename R>
03053 class Functor<R> : public Func<R> {
03054     public:
03055         typedef typename Type<R>  ::_Type _R;
03056 
03057         Functor() : m_pFunc(nullptr)
03058         {
03059         }
03060 
03061         Functor(DynFunc *pFunc) : m_pFunc(pFunc)
03062         {
03063         }
03064 
03065         Functor(const typename Signature<R>::FuncType &pFunc) :
03066             m_pFunc(new FuncFunPtr<R>(pFunc))
03067         {
03068         }
03069 
03070         template <class CLASS>
03071         Functor(const typename MethodSignature<CLASS, R>::MemFuncType &pMemFunc, CLASS *pObject) :
03072             m_pFunc(new FuncMemPtr<CLASS, R>(pMemFunc, pObject))
03073         {
03074         }
03075 
03076         Functor(const Functor &cFunctor) : m_pFunc(nullptr)
03077         {
03078             // Check wrapped function object
03079             if (cFunctor.m_pFunc) {
03080                 // Clone and copy wrapped function object
03081                 m_pFunc = cFunctor.m_pFunc->Clone();
03082             }
03083         }
03084 
03085         virtual ~Functor()
03086         {
03087             // Destroy wrapped function object
03088             if (m_pFunc)
03089                 delete m_pFunc;
03090         }
03091 
03092         Functor &operator =(const Functor &cFunctor)
03093         {
03094             // Check if the functor already wraps a function object
03095             if (m_pFunc) {
03096                 // Destroy old implementation
03097                 delete m_pFunc;
03098                 m_pFunc = nullptr;
03099             }
03100 
03101             // Check function object
03102             if (cFunctor.m_pFunc) {
03103                 // Clone and copy wrapped function object
03104                 m_pFunc = cFunctor.m_pFunc->Clone();
03105             }
03106 
03107             // Return this object
03108             return *this;
03109         }
03110 
03111         virtual _R operator ()() override
03112         {
03113             if (m_pFunc)
03114                 return (*static_cast<Func<R>* >(m_pFunc))();
03115             else
03116                 return DefaultValue<R>::Default();
03117         }
03118 
03119         virtual DynFunc *Clone() const override
03120         {
03121             return new Functor(m_pFunc ? m_pFunc->Clone() : nullptr);
03122         }
03123 
03124     private:
03125         DynFunc *m_pFunc;   /**< Pointer to wrapped function object, can be a null pointer */
03126 };
03127 
03128 /**
03129 *  @brief
03130 *    Generic functor class (delegate, a form of type-safe function pointer, 'callback')
03131 *
03132 *  @remarks
03133 *    Implementation for 0 parameters without a return value
03134 */
03135 template <>
03136 class Functor<void> : public Func<void> {
03137     public:
03138         Functor() : m_pFunc(nullptr)
03139         {
03140         }
03141 
03142         Functor(DynFunc *pFunc) : m_pFunc(pFunc)
03143         {
03144         }
03145 
03146         Functor(const Signature<void>::FuncType &pFunc) :
03147             m_pFunc(new FuncFunPtr<void>(pFunc))
03148         {
03149         }
03150 
03151         template <class CLASS>
03152         Functor(const typename MethodSignature<CLASS, void>::MemFuncType &pMemFunc, CLASS *pObject) :
03153             m_pFunc(new FuncMemPtr<CLASS, void>(pMemFunc, pObject))
03154         {
03155         }
03156 
03157         Functor(const Functor &cFunctor) : m_pFunc(nullptr)
03158         {
03159             // Check wrapped function object
03160             if (cFunctor.m_pFunc) {
03161                 // Clone and copy wrapped function object
03162                 m_pFunc = cFunctor.m_pFunc->Clone();
03163             }
03164         }
03165 
03166         virtual ~Functor()
03167         {
03168             // Destroy wrapped function object
03169             if (m_pFunc)
03170                 delete m_pFunc;
03171         }
03172 
03173         Functor &operator =(const Functor &cFunctor)
03174         {
03175             // Check if the functor already wraps a function object
03176             if (m_pFunc) {
03177                 // Destroy old implementation
03178                 delete m_pFunc;
03179                 m_pFunc = nullptr;
03180             }
03181 
03182             // Check function object
03183             if (cFunctor.m_pFunc) {
03184                 // Clone and copy wrapped function object
03185                 m_pFunc = cFunctor.m_pFunc->Clone();
03186             }
03187 
03188             // Return this object
03189             return *this;
03190         }
03191 
03192         virtual void operator ()() override
03193         {
03194             if (m_pFunc)
03195                 (*static_cast<Func<void>* >(m_pFunc))();
03196         }
03197 
03198         virtual DynFunc *Clone() const override
03199         {
03200             return new Functor(m_pFunc ? m_pFunc->Clone() : nullptr);
03201         }
03202 
03203     private:
03204         DynFunc *m_pFunc;   /**< Pointer to wrapped function object, can be a null pointer */
03205 };
03206 
03207 
03208 //[-------------------------------------------------------]
03209 //[ Namespace                                             ]
03210 //[-------------------------------------------------------]
03211 } // PLCore
03212 
03213 
03214 #endif // __PLCORE_FUNCTOR_H__


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:08:56
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported