libalcommon  1.14.5
alcommon/alfunctor.h
Go to the documentation of this file.
00001 
00010 #pragma once
00011 #ifndef _LIBALCOMMON_ALCOMMON_ALFUNCTOR_H_
00012 #define _LIBALCOMMON_ALCOMMON_ALFUNCTOR_H_
00013 
00014 # include <alvalue/alvalue.h>
00015 # include <boost/shared_ptr.hpp>
00016 # include <sstream>
00017 
00019 namespace AL
00020 {
00026   typedef void ALVoid;
00027 
00033   class ALFunctorBase
00034   {
00035   public:
00041     virtual void call(const ALValue& pParams, ALValue& pResult) = 0;
00042 
00044     virtual ~ALFunctorBase() {}
00045   };
00046 }
00047 
00048 #include <alcommon/detail/alfunctorwithreturn.h>
00049 #include <alcommon/detail/alfunctorwithoutreturn.h>
00050 
00051 namespace AL {
00052 
00053 
00054   template <typename C, typename R>
00055   boost::shared_ptr<ALFunctorBase> createFunctor(C *obj, R (C::*f) ()) {
00056     return boost::shared_ptr<ALFunctorBase> (new detail::ALFunctor_0<C, R>(obj, f));
00057   }
00058 
00059   template <typename C, typename P1, typename R>
00060   boost::shared_ptr<ALFunctorBase> createFunctor(C *obj, R (C::*f) (const P1 &)) {
00061     return boost::shared_ptr<ALFunctorBase>(new detail::ALFunctor_1<C, P1, R>(obj, f));
00062   }
00063 
00064   template <typename C, typename P1, typename P2, typename R>
00065   boost::shared_ptr<ALFunctorBase> createFunctor(C *obj, R (C::*f) (const P1 &, const P2 &)) {
00066     return boost::shared_ptr<ALFunctorBase>(new detail::ALFunctor_2<C, P1, P2, R>(obj, f));
00067   }
00068 
00069   template <typename C, typename P1, typename P2, typename P3, typename R>
00070   boost::shared_ptr<ALFunctorBase> createFunctor(C *obj, R (C::*f) (const P1 &, const P2 &, const  P3 &)) {
00071     return boost::shared_ptr<ALFunctorBase>(new detail::ALFunctor_3<C, P1, P2, P3, R>(obj, f));
00072   }
00073 
00074   template <typename C, typename P1, typename P2, typename P3, typename P4, typename R>
00075   boost::shared_ptr<ALFunctorBase> createFunctor(C *obj, R (C::*f) (const P1 &, const P2 &, const P3 &, const P4 &)) {
00076     return boost::shared_ptr<ALFunctorBase>(new detail::ALFunctor_4<C, P1, P2, P3, P4, R>(obj, f));
00077   }
00078 
00079   template <typename C, typename P1, typename P2, typename P3, typename P4, typename P5, typename R>
00080   boost::shared_ptr<ALFunctorBase> createFunctor(C *obj, R (C::*f) (const P1 &, const P2 &, const P3 &, const P4 &, const P5 &)) {
00081     return boost::shared_ptr<ALFunctorBase>(new detail::ALFunctor_5<C, P1, P2, P3, P4, P5, R>(obj, f));
00082   }
00083 
00084   template <typename C, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename R>
00085   boost::shared_ptr<ALFunctorBase> createFunctor(C *obj, R (C::*f) (const P1 &, const P2 &, const P3  &, const P4 &, const P5 &, const P6 &)) {
00086     return boost::shared_ptr<ALFunctorBase>(new detail::ALFunctor_6<C, P1, P2, P3, P4, P5, P6, R>(obj, f));
00087   }
00088 
00089 }
00090 
00091 #endif  // _LIBALCOMMON_ALCOMMON_ALFUNCTOR_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines