libalcommon  1.14
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
alfunctor.h
Go to the documentation of this file.
1 
10 #pragma once
11 #ifndef _LIBALCOMMON_ALCOMMON_ALFUNCTOR_H_
12 #define _LIBALCOMMON_ALCOMMON_ALFUNCTOR_H_
13 
14 # include <alvalue/alvalue.h>
15 # include <boost/shared_ptr.hpp>
16 # include <sstream>
17 
19 namespace AL
20 {
26  typedef void ALVoid;
27 
34  {
35  public:
41  virtual void call(const ALValue& pParams, ALValue& pResult) = 0;
42 
44  virtual ~ALFunctorBase() {}
45  };
46 }
47 
48 #include <alcommon/detail/alfunctorwithreturn.h>
49 #include <alcommon/detail/alfunctorwithoutreturn.h>
50 
51 namespace AL {
52 
53 
54  template <typename C, typename R>
55  boost::shared_ptr<ALFunctorBase> createFunctor(C *obj, R (C::*f) ()) {
56  return boost::shared_ptr<ALFunctorBase> (new detail::ALFunctor_0<C, R>(obj, f));
57  }
58 
59  template <typename C, typename P1, typename R>
60  boost::shared_ptr<ALFunctorBase> createFunctor(C *obj, R (C::*f) (const P1 &)) {
61  return boost::shared_ptr<ALFunctorBase>(new detail::ALFunctor_1<C, P1, R>(obj, f));
62  }
63 
64  template <typename C, typename P1, typename P2, typename R>
65  boost::shared_ptr<ALFunctorBase> createFunctor(C *obj, R (C::*f) (const P1 &, const P2 &)) {
66  return boost::shared_ptr<ALFunctorBase>(new detail::ALFunctor_2<C, P1, P2, R>(obj, f));
67  }
68 
69  template <typename C, typename P1, typename P2, typename P3, typename R>
70  boost::shared_ptr<ALFunctorBase> createFunctor(C *obj, R (C::*f) (const P1 &, const P2 &, const P3 &)) {
71  return boost::shared_ptr<ALFunctorBase>(new detail::ALFunctor_3<C, P1, P2, P3, R>(obj, f));
72  }
73 
74  template <typename C, typename P1, typename P2, typename P3, typename P4, typename R>
75  boost::shared_ptr<ALFunctorBase> createFunctor(C *obj, R (C::*f) (const P1 &, const P2 &, const P3 &, const P4 &)) {
76  return boost::shared_ptr<ALFunctorBase>(new detail::ALFunctor_4<C, P1, P2, P3, P4, R>(obj, f));
77  }
78 
79  template <typename C, typename P1, typename P2, typename P3, typename P4, typename P5, typename R>
80  boost::shared_ptr<ALFunctorBase> createFunctor(C *obj, R (C::*f) (const P1 &, const P2 &, const P3 &, const P4 &, const P5 &)) {
81  return boost::shared_ptr<ALFunctorBase>(new detail::ALFunctor_5<C, P1, P2, P3, P4, P5, R>(obj, f));
82  }
83 
84  template <typename C, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename R>
85  boost::shared_ptr<ALFunctorBase> createFunctor(C *obj, R (C::*f) (const P1 &, const P2 &, const P3 &, const P4 &, const P5 &, const P6 &)) {
86  return boost::shared_ptr<ALFunctorBase>(new detail::ALFunctor_6<C, P1, P2, P3, P4, P5, P6, R>(obj, f));
87  }
88 
89 }
90 
91 #endif // _LIBALCOMMON_ALCOMMON_ALFUNCTOR_H_