Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/util/executor/executor_functional.h @ 9406

Last change on this file since 9406 was 9406, checked in by bensch, 18 years ago

orxonox/trunk: merged the proxy back

merged with commandsvn merge -r9346:HEAD https://svn.orxonox.net/orxonox/branches/proxy .

no conflicts

File size: 20.9 KB
RevLine 
[4838]1/*!
[7716]2 * @file executor_functional.h
[7197]3 * Definition of an Executor
[5391]4 */
[1853]5
[7716]6/*
7   orxonox - the future of 3D-vertical-scrollers
[1853]8
[7716]9   Copyright (C) 2004 orx
[1853]10
[7716]11   This program is free software; you can redistribute it and/or modify
12   it under the terms of the GNU General Public License as published by
13   the Free Software Foundation; either version 2, or (at your option)
14   any later version.
[5141]15
[7716]16### File Specific:
17   main-programmer: Benjamin Grauer
18   co-programmer: ...
19*/
[5652]20
[5328]21
[7716]22#ifndef __EXECUTOR_FUNCTIONAL_H_
23#define __EXECUTOR_FUNCTIONAL_H_
[5641]24
[7721]25#include "executor.h"
[5641]26
[7716]27template<typename type> MT_Type ExecutorParamType() { return MT_EXT1; };
[7721]28template<> MT_Type ExecutorParamType<bool>();
29template<> MT_Type ExecutorParamType<int>();
30template<> MT_Type ExecutorParamType<unsigned int>();
31template<> MT_Type ExecutorParamType<float>();
32template<> MT_Type ExecutorParamType<char>();
33template<> MT_Type ExecutorParamType<const std::string&>();
[5161]34
[8035]35template<typename type> type fromString(const std::string& input, type defaultValue) { return defaultValue; };
[7721]36template<> bool fromString<bool>(const std::string& input, bool defaultValue);
37template<> int fromString<int>(const std::string& input, int defaultValue);
38template<> unsigned int fromString<unsigned int>(const std::string& input, unsigned int defaultValue);
39template<> float fromString<float>(const std::string& input, float defaultValue);
40template<> char fromString<char>(const std::string& input, char defaultValue);
41template<> const std::string& fromString<const std::string&>(const std::string& input, const std::string& defaultValue);
[5641]42
[8035]43template<typename type> type fromMulti(const MultiType& multi) { /* return defaultValue; */ };
44template<> bool fromMulti<bool>(const MultiType& multi);
45template<> int fromMulti<int>(const MultiType& multi);
46template<> unsigned int fromMulti<unsigned int>(const MultiType& multi);
47template<> float fromMulti<float>(const MultiType& multi);
48template<> char fromMulti<char>(const MultiType& multi);
49template<> const std::string& fromMulti<const std::string&>(const MultiType& multi);
50
51
[7716]52template<typename type> type getDefault(const MultiType* const defaultValues, unsigned int i) { return (type)0; };
[7721]53template<> bool getDefault<bool>(const MultiType* const defaultValues, unsigned int i);
54template<> int getDefault<int>(const MultiType* const defaultValues, unsigned int i);
55template<> unsigned int getDefault<unsigned int>(const MultiType* const defaultValues, unsigned int i);
56template<> float getDefault<float>(const MultiType* const defaultValues, unsigned int i);
57template<> char getDefault<char>(const MultiType* const defaultValues, unsigned int i);
58template<> const std::string& getDefault<const std::string&>(const MultiType* const defaultValues, unsigned int i);
[5161]59
[7716]60#endif /* __EXECUTOR_FUNCTIONAL_H_ */
[5161]61
[7724]62//! if Functional is constant calling
[7716]63#define __EXECUTOR_FUNCTIONAL_CONST
[7724]64//! The Name to be attached to the functional (for normal, static, and const modes)
[7716]65#define __EXECUTOR_FUNCTIONAL_NAME(ParamCount)   Executor##ParamCount##Params
[7724]66//! The Execution-mode (either static or objective)
[7716]67#define __EXECUTOR_FUNCTIONAL_FUNCTION_EXEC      dynamic_cast<T*>(object)->*(functionPointer)
[7724]68//! The Function-Pointer, and how to save it internally.
[7716]69#define __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER   T::*functionPointer
[5161]70
[7716]71#ifdef EXECUTOR_FUNCTIONAL_USE_CONST
72 #undef __EXECUTOR_FUNCTIONAL_CONST
73 #define __EXECUTOR_FUNCTIONAL_CONST const
74 #undef __EXECUTOR_FUNCTIONAL_NAME
75 #define __EXECUTOR_FUNCTIONAL_NAME(ParamCount) Executor##ParamCount##Params_const
76#endif
[5161]77
[7716]78#ifdef EXECUTOR_FUNCTIONAL_USE_STATIC
79 #ifdef EXECUTOR_FUNCTIONAL_USE_CONST
80  #error you obviously do not know what you are doing !! ask the bensch
81 #endif /* EXECUTOR_FUNCTIONAL_USE_CONST */
[5135]82
[7719]83#undef __EXECUTOR_FUNCTIONAL_FUNCTION_EXEC
[7716]84 #define __EXECUTOR_FUNCTIONAL_FUNCTION_EXEC       functionPointer
85 #undef __EXECUTOR_FUNCTIONAL_NAME
86 #define __EXECUTOR_FUNCTIONAL_NAME(ParamCount)    Executor##ParamCount##Params_static
87 #undef __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER
88 #define __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER    *functionPointer
[5636]89
[7716]90#endif /* EXECUTOR_FUNCTIONAL_USE_STATIC */
[7714]91
[8035]92///////////
93//// 0 ////
94///////////
[7724]95//! @brief ExecutorClass, that can execute Functions without any parameters.
[7716]96template<class T> class __EXECUTOR_FUNCTIONAL_NAME(0) : public Executor
97{
98private:
[7724]99  /** @brief the FunctioPointer. */
[7716]100  void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST;
[5551]101
[7716]102public:
[7724]103  /**
104   * @brief constructs the Executor.
105   * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function.
106   */
[7716]107  __EXECUTOR_FUNCTIONAL_NAME(0) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST )
108      : Executor()
109  {
110    this->functorType = Executor_Objective;
111    this->functionPointer = functionPointer;
[7717]112  };
113
[7724]114  /**
115   * @brief executes the Functional
116   * @param object the Object the action should be executed on.
117   * @param sub the SubString to get the Parameters from.
118   */
[7716]119  virtual void operator()(BaseObject* object, const SubString& sub = SubString()) const
120  {
121    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)();
122  };
[5142]123
[8035]124  /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */
[8271]125  virtual void operator()(BaseObject* object, int& count, void* values) const
[8035]126  {
127    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)();
128  }
129
[7724]130  /**
131   * @brief copies the Executor
132   * @returns a new Executor that's a copy of this one.
133   */
[7719]134  virtual Executor* clone() const
135  {
[7717]136    return new __EXECUTOR_FUNCTIONAL_NAME(0)<T>(this->functionPointer);
137  };
[7716]138};
[5135]139
[8035]140
141
142///////////
143//// 1 ////
144///////////
[7724]145//! @brief ExecutorClass, that can execute Functions with one parameter.
[7716]146template<class T, typename type0> class __EXECUTOR_FUNCTIONAL_NAME(1) : public Executor
147{
148private:
[7724]149  /** @brief the FunctioPointer. */
[7716]150  void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0) __EXECUTOR_FUNCTIONAL_CONST;
[5141]151
[7716]152public:
[7724]153  /**
154   * @brief constructs the Executor.
155   * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function.
156   */
[7716]157  __EXECUTOR_FUNCTIONAL_NAME(1) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0) __EXECUTOR_FUNCTIONAL_CONST)
158      : Executor(ExecutorParamType<type0>())
159  {
160    this->functorType = Executor_Objective;
161    this->functionPointer = functionPointer;
[7717]162  };
163
[8035]164  /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */
[8271]165  virtual void operator()(BaseObject* object, int& count, void* values) const
[8035]166  {
[8048]167    const MultiType* mt = (const MultiType*)values;
[8035]168    return (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
[8048]169             fromMulti<type0>((count > 0)? mt[0] : this->defaultValue[0]) );
[8035]170  }
171
172
[7724]173  /**
174   * @brief executes the Functional
175   * @param object the Object the action should be executed on.
176   * @param sub the SubString to get the Parameters from.
177   */
[7716]178  virtual void operator()(BaseObject* object, const SubString& sub = SubString()) const
179  {
180    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
[9406]181      (sub.size() > 0) ? fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)) : (fromMulti<type0>(this->defaultValue[0])));
[7716]182  };
[5153]183
[7724]184  /**
185   * @brief copies the Executor
186   * @returns a new Executor that's a copy of this one.
187   */
[7719]188  virtual Executor* clone() const
189  {
[7717]190    return  new __EXECUTOR_FUNCTIONAL_NAME(1)<T, type0>(this->functionPointer);
191  };
[7716]192};
[5145]193
[8035]194///////////
195//// 2 ////
196///////////
[7724]197//! @brief ExecutorClass, that can execute Functions with two parameters.
[7716]198template<class T, typename type0, typename type1> class __EXECUTOR_FUNCTIONAL_NAME(2) : public Executor
199{
200private:
[7724]201  /** @brief the FunctioPointer. */
[7716]202  void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1) __EXECUTOR_FUNCTIONAL_CONST;
[5145]203
[7714]204public:
[7724]205  /**
206   * @brief constructs the Executor.
207   * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function.
208   */
[7716]209  __EXECUTOR_FUNCTIONAL_NAME(2) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1) __EXECUTOR_FUNCTIONAL_CONST)
210      : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>())
[7714]211  {
[7716]212    this->functorType = Executor_Objective;
213    this->functionPointer = functionPointer;
[7717]214  };
215
[7724]216  /**
217   * @brief executes the Functional
218   * @param object the Object the action should be executed on.
219   * @param sub the SubString to get the Parameters from.
220   */
[7714]221  virtual void operator()(BaseObject* object, const SubString& sub = SubString()) const
222  {
[7716]223    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
[9406]224      (sub.size() > 0) ? fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)) : (fromMulti<type0>(this->defaultValue[0])),
225      (sub.size() > 1) ? fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)) : (fromMulti<type1>(this->defaultValue[1])));
[7716]226  };
[7714]227
[8035]228  /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */
[8271]229  virtual void operator()(BaseObject* object, int& count, void* values) const
[8035]230  {
[8048]231    const MultiType* mt = (const MultiType*)values;
[8035]232    return (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
[8048]233             fromMulti<type0>((count > 0) ? mt[0] : this->defaultValue[0]),
234             fromMulti<type1>((count > 1) ? mt[1] : this->defaultValue[1]) );
[8035]235  }
236
[7724]237  /**
238   * @brief copies the Executor
239   * @returns a new Executor that's a copy of this one.
240   */
[7719]241  virtual Executor* clone() const
242  {
[7717]243    return new __EXECUTOR_FUNCTIONAL_NAME(2)<T, type0, type1>(this->functionPointer);
244  };
[5129]245};
[5113]246
[5632]247
[8035]248///////////
249//// 3 ////
250///////////
[7724]251//! @brief ExecutorClass, that can execute Functions with three parameters.
[7719]252template<class T, typename type0, typename type1, typename type2> class __EXECUTOR_FUNCTIONAL_NAME(3) : public Executor
253{
254private:
[7724]255  /** @brief the FunctioPointer. */
[7719]256  void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2) __EXECUTOR_FUNCTIONAL_CONST;
[5326]257
[7719]258public:
[7724]259  /**
260   * @brief constructs the Executor.
261   * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function.
262   */
[7719]263  __EXECUTOR_FUNCTIONAL_NAME(3) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2) __EXECUTOR_FUNCTIONAL_CONST)
264      : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>())
265  {
266    this->functorType = Executor_Objective;
267    this->functionPointer = functionPointer;
268  };
[7716]269
[7724]270  /**
271   * @brief executes the Functional
272   * @param object the Object the action should be executed on.
273   * @param sub the SubString to get the Parameters from.
274   */
[7719]275  virtual void operator()(BaseObject* object, const SubString& sub = SubString()) const
276  {
277    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
[9406]278      (sub.size() > 0) ? fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)) : (fromMulti<type0>(this->defaultValue[0])),
279      (sub.size() > 1) ? fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)) : (fromMulti<type1>(this->defaultValue[1])),
280      (sub.size() > 2) ? fromString<type2>(sub[2], getDefault<type2>(this->defaultValue, 2)) : (fromMulti<type2>(this->defaultValue[2])));
[7719]281  };
[7718]282
[8035]283  /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */
[8271]284  virtual void operator()(BaseObject* object, int& count, void* values) const
[8035]285  {
[8048]286    const MultiType* mt = (const MultiType*)values;
[8035]287    return (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
[8048]288             fromMulti<type0>((count > 0) ? mt[0] : this->defaultValue[0]),
289             fromMulti<type1>((count > 1) ? mt[1] : this->defaultValue[1]),
290             fromMulti<type2>((count > 2) ? mt[2] : this->defaultValue[2]) );
[8035]291  }
292
[7724]293  /**
294   * @brief copies the Executor
295   * @returns a new Executor that's a copy of this one.
296   */
[7719]297  virtual Executor* clone() const
298  {
299    return new __EXECUTOR_FUNCTIONAL_NAME(3)<T, type0, type1, type2>(this->functionPointer);
300  };
301};
302
303
304
[8035]305///////////
306//// 4 ////
307///////////
[7724]308//! @brief ExecutorClass, that can execute Functions with four parameters.
[7719]309template<class T, typename type0, typename type1, typename type2, typename type3> class __EXECUTOR_FUNCTIONAL_NAME(4) : public Executor
310{
311private:
[7724]312  /** @brief the FunctioPointer. */
[7719]313  void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3) __EXECUTOR_FUNCTIONAL_CONST;
314
315public:
[7724]316  /**
317   * @brief constructs the Executor.
318   * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function.
319   */
[7719]320  __EXECUTOR_FUNCTIONAL_NAME(4) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3) __EXECUTOR_FUNCTIONAL_CONST)
[7724]321      : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>())
[7719]322  {
323    this->functorType = Executor_Objective;
324    this->functionPointer = functionPointer;
325  };
326
[7724]327  /**
328  * @brief executes the Functional
329  * @param object the Object the action should be executed on.
330  * @param sub the SubString to get the Parameters from.
331   */
[7719]332  virtual void operator()(BaseObject* object, const SubString& sub = SubString()) const
333  {
334    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
[9406]335      (sub.size() > 0) ? fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)) : (fromMulti<type0>(this->defaultValue[0])),
336      (sub.size() > 1) ? fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)) : (fromMulti<type1>(this->defaultValue[1])),
337      (sub.size() > 2) ? fromString<type2>(sub[2], getDefault<type2>(this->defaultValue, 2)) : (fromMulti<type2>(this->defaultValue[2])),
338      (sub.size() > 3) ? fromString<type3>(sub[3], getDefault<type3>(this->defaultValue, 3)) : (fromMulti<type3>(this->defaultValue[3])));
[7719]339  };
340
[8035]341  /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */
[8271]342  virtual void operator()(BaseObject* object, int& count, void* values) const
[8035]343  {
[8048]344    const MultiType* mt = (const MultiType*)values;
[8035]345    return (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
[8048]346             fromMulti<type0>((count > 0) ? mt[0] : this->defaultValue[0]),
347             fromMulti<type1>((count > 1) ? mt[1] : this->defaultValue[1]),
348             fromMulti<type2>((count > 2) ? mt[2] : this->defaultValue[2]),
349             fromMulti<type3>((count > 3) ? mt[3] : this->defaultValue[3]) );
[8035]350  }
351
[7724]352  /**
353   * @brief copies the Executor
354   * @returns a new Executor that's a copy of this one.
355   */
[7719]356  virtual Executor* clone() const
357  {
358    return new __EXECUTOR_FUNCTIONAL_NAME(4)<T, type0, type1, type2, type3>(this->functionPointer);
359  };
360};
361
[8035]362
363
364///////////
365//// 5 ////
366///////////
[7724]367//! @brief ExecutorClass, that can execute Functions with five parameters.
[7719]368template<class T, typename type0, typename type1, typename type2, typename type3, typename type4> class __EXECUTOR_FUNCTIONAL_NAME(5) : public Executor
369{
[7724]370private:
371  /** @brief the FunctioPointer. */
372  void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3, type4) __EXECUTOR_FUNCTIONAL_CONST;
[7719]373
[7724]374public:
375  /**
376   * @brief constructs the Executor.
377   * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function.
378   */
379  __EXECUTOR_FUNCTIONAL_NAME(5) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3, type4) __EXECUTOR_FUNCTIONAL_CONST)
380      : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>(), ExecutorParamType<type4>())
381  {
382    this->functorType = Executor_Objective;
383    this->functionPointer = functionPointer;
384  };
[7719]385
[7724]386  /**
387  * @brief executes the Functional
388  * @param object the Object the action should be executed on.
389  * @param sub the SubString to get the Parameters from.
390   */
391  virtual void operator()(BaseObject* object, const SubString& sub = SubString()) const
392  {
393    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
[9406]394      (sub.size() > 0) ? fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)) : (fromMulti<type0>(this->defaultValue[0])),
395      (sub.size() > 1) ? fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)) : (fromMulti<type1>(this->defaultValue[1])),
396      (sub.size() > 2) ? fromString<type2>(sub[2], getDefault<type2>(this->defaultValue, 2)) : (fromMulti<type2>(this->defaultValue[2])),
397      (sub.size() > 3) ? fromString<type3>(sub[3], getDefault<type3>(this->defaultValue, 3)) : (fromMulti<type3>(this->defaultValue[3])),
398      (sub.size() > 4) ? fromString<type4>(sub[4], getDefault<type4>(this->defaultValue, 4)) : (fromMulti<type4>(this->defaultValue[4])));
[7724]399  };
[7719]400
[8035]401  /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */
[8271]402  virtual void operator()(BaseObject* object, int& count, void* values) const
[8035]403  {
[8048]404    const MultiType* mt = (const MultiType*)values;
[8035]405    return (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
[8048]406             fromMulti<type0>((count > 0) ? mt[0] : this->defaultValue[0]),
407             fromMulti<type1>((count > 1) ? mt[1] : this->defaultValue[1]),
408             fromMulti<type2>((count > 2) ? mt[2] : this->defaultValue[2]),
409             fromMulti<type3>((count > 3) ? mt[3] : this->defaultValue[3]),
410             fromMulti<type4>((count > 4) ? mt[4] : this->defaultValue[4]) );
[8035]411  }
412
[7724]413  /**
414   * @brief copies the Executor
415   * @returns a new Executor that's a copy of this one.
416   */
417  virtual Executor* clone() const
418  {
419    return new __EXECUTOR_FUNCTIONAL_NAME(5)<T, type0, type1, type2, type3, type4>(this->functionPointer);
420  };
[7719]421};
422
423
424
[7724]425/**
426 * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
427 */
[8048]428#define EXECUTOR_FUNCTIONAL_CREATOR0() \
429template<class T> Executor* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST) \
[7718]430{ \
431  return new __EXECUTOR_FUNCTIONAL_NAME(0)<T>(functionPointer); \
[7716]432}
[7718]433
[7724]434/**
435 * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
436 * @param type0 for internal usage: the first Argument
437 */
[8048]438#define EXECUTOR_FUNCTIONAL_CREATOR1(type0) \
439template<class T> Executor* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \
[7718]440{ \
441  return new __EXECUTOR_FUNCTIONAL_NAME(1)<T, type0##_TYPE>(functionPointer); \
[7716]442}
[7718]443
[7724]444/**
445 * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
446 * @param type0 for internal usage: the first Argument
447 * @param type1 for internal usage: the second Argument
448 */
[8048]449#define EXECUTOR_FUNCTIONAL_CREATOR2(type0, type1) \
450template<class T> Executor* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE, type1##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \
[7718]451{ \
452  return new __EXECUTOR_FUNCTIONAL_NAME(2)<T, type0##_TYPE, type1##_TYPE>(functionPointer); \
[7716]453}
[5641]454
[7724]455/**
456 * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
457 * @param type0 for internal usage: the first Argument
458 * @param type1 for internal usage: the second Argument
459 * @param type2 for internal usage: the third Argument
460 */
[8048]461#define EXECUTOR_FUNCTIONAL_CREATOR3(type0, type1, type2) \
462template<class T> Executor* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE, type1##_TYPE, type2##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \
[7719]463{ \
464  return new __EXECUTOR_FUNCTIONAL_NAME(3)<T, type0##_TYPE, type1##_TYPE, type2##_TYPE>(functionPointer); \
465}
[5326]466
[7724]467/**
468 * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
469 * @param type0 for internal usage: the first Argument
470 * @param type1 for internal usage: the second Argument
471 * @param type2 for internal usage: the third Argument
472 * @param type3 for internal usage: the fourth Argument
473 */
[8048]474#define EXECUTOR_FUNCTIONAL_CREATOR4(type0, type1, type2, type3) \
475template<class T> Executor* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE, type1##_TYPE, type2##_TYPE, type3##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \
[7719]476{ \
477  return new __EXECUTOR_FUNCTIONAL_NAME(4)<T, type0##_TYPE, type1##_TYPE, type2##_TYPE, type3##_TYPE>(functionPointer); \
478}
[7718]479
[7724]480/**
481 * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
482 * @param type0 for internal usage: the first Argument
483 * @param type1 for internal usage: the second Argument
484 * @param type2 for internal usage: the third Argument
485 * @param type3 for internal usage: the fourth Argument
486 * @param type4 for internal usage: the fifth Argument
487 */
[8048]488#define EXECUTOR_FUNCTIONAL_CREATOR5(type0, type1, type2, type3, type4) \
489template<class T> Executor* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE, type1##_TYPE, type2##_TYPE, type3##_TYPE, type4##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \
[7719]490{ \
491    return new __EXECUTOR_FUNCTIONAL_NAME(5)<T, type0##_TYPE, type1##_TYPE, type2##_TYPE, type3##_TYPE, type4##_TYPE>(functionPointer); \
492}
[7718]493
[7719]494
[7724]495/**
496 * Creates the FunctionCallers
497 */
[7718]498#define FUNCTOR_LIST(x) EXECUTOR_FUNCTIONAL_CREATOR ## x
499#include "functor_list.h"
500#undef FUNCTOR_LIST
501
502
503
[7716]504#undef __EXECUTOR_FUNCTIONAL_CONST
505#undef __EXECUTOR_FUNCTIONAL_NAME
506#undef __EXECUTOR_FUNCTIONAL_FUNCTION_EXEC
507#undef __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER
[7725]508
509#ifdef EXECUTOR_FUNCTIONAL_USE_CONST
510 #undef EXECUTOR_FUNCTIONAL_USE_CONST
511#endif
512#ifdef EXECUTOR_FUNCTIONAL_USE_STATIC
513 #undef EXECUTOR_FUNCTIONAL_USE_STATIC
514#endif
Note: See TracBrowser for help on using the repository browser.