Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/new_class_id/src/lib/util/executor/functor_generic.h @ 9769

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

orxonox/branches/new_class_id: even more templates (mostly to safe space)

File size: 4.7 KB
RevLine 
[4838]1/*!
[9740]2 * @file functor_generic.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
[9731]21// // // // // // // // // // // // //
22//// EXTENSION TO HIDE CONSTRUCT /////
23// // // // // // // // // // // // //
[7724]24/**
25 * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
[9740]26 * @param CallType the Type of Executor to generate
[7724]27 */
[9740]28#define EXECUTOR_FUNCTIONAL_CREATOR0(CallType) \
[9769]29template<class T, class BaseClass> Executor<CallType, BaseClass>* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST) \
[7718]30{ \
[9769]31  return new __EXECUTOR_FUNCTIONAL_NAME(0,)<T, CallType, BaseClass>(functionPointer); \
[7716]32}
[7718]33
[7724]34/**
35 * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
[9740]36 * @param CallType the Type of Executor to generate
[7724]37 * @param type0 for internal usage: the first Argument
38 */
[9740]39#define EXECUTOR_FUNCTIONAL_CREATOR1(CallType, type0) \
[9769]40template<class T, class BaseClass> Executor<CallType, BaseClass>* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0) __EXECUTOR_FUNCTIONAL_CONST) \
[7718]41{ \
[9769]42  return new __EXECUTOR_FUNCTIONAL_NAME(1,)<T, CallType, type0, BaseClass>(functionPointer); \
[7716]43}
[7718]44
[7724]45/**
46 * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
[9740]47 * @param CallType the Type of Executor to generate
[7724]48 * @param type0 for internal usage: the first Argument
49 * @param type1 for internal usage: the second Argument
50 */
[9740]51#define EXECUTOR_FUNCTIONAL_CREATOR2(CallType, type0, type1) \
[9769]52template<class T, class BaseClass> Executor<CallType, BaseClass>* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1) __EXECUTOR_FUNCTIONAL_CONST) \
[7718]53{ \
[9769]54  return new __EXECUTOR_FUNCTIONAL_NAME(2,)<T, CallType, type0, type1, BaseClass>(functionPointer); \
[7716]55}
[5641]56
[7724]57/**
58 * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
[9740]59 * @param CallType the Type of Executor to generate
[7724]60 * @param type0 for internal usage: the first Argument
61 * @param type1 for internal usage: the second Argument
62 * @param type2 for internal usage: the third Argument
63 */
[9740]64#define EXECUTOR_FUNCTIONAL_CREATOR3(CallType, type0, type1, type2) \
[9769]65template<class T, class BaseClass> Executor<CallType, BaseClass>* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2) __EXECUTOR_FUNCTIONAL_CONST) \
[7719]66{ \
[9769]67  return new __EXECUTOR_FUNCTIONAL_NAME(3,)<T, CallType, type0, type1, type2, BaseClass>(functionPointer); \
[7719]68}
[5326]69
[7724]70/**
71 * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
[9740]72 * @param CallType the Type of Executor to generate
[7724]73 * @param type0 for internal usage: the first Argument
74 * @param type1 for internal usage: the second Argument
75 * @param type2 for internal usage: the third Argument
76 * @param type3 for internal usage: the fourth Argument
77 */
[9740]78#define EXECUTOR_FUNCTIONAL_CREATOR4(CallType, type0, type1, type2, type3) \
[9769]79template<class T, class BaseClass> Executor<CallType, BaseClass>* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3) __EXECUTOR_FUNCTIONAL_CONST) \
[7719]80{ \
[9769]81  return new __EXECUTOR_FUNCTIONAL_NAME(4,)<T, CallType, type0, type1, type2, type3, BaseClass>(functionPointer); \
[7719]82}
[7718]83
[7724]84/**
85 * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
[9740]86 * @param CallType the Type of Executor to generate
[7724]87 * @param type0 for internal usage: the first Argument
88 * @param type1 for internal usage: the second Argument
89 * @param type2 for internal usage: the third Argument
90 * @param type3 for internal usage: the fourth Argument
91 * @param type4 for internal usage: the fifth Argument
92 */
[9740]93#define EXECUTOR_FUNCTIONAL_CREATOR5(CallType, type0, type1, type2, type3, type4) \
[9769]94template<class T, class BaseClass> Executor<CallType, BaseClass>* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3, type4) __EXECUTOR_FUNCTIONAL_CONST) \
[7719]95{ \
[9769]96    return new __EXECUTOR_FUNCTIONAL_NAME(5,)<T, CallType, type0, type1, type2, type3, type4, BaseClass>(functionPointer); \
[7719]97}
[7718]98
[7724]99/**
[9739]100 * Creates the FunctionCallers imediately
[7724]101 */
[7718]102#define FUNCTOR_LIST(x) EXECUTOR_FUNCTIONAL_CREATOR ## x
103#include "functor_list.h"
104#undef FUNCTOR_LIST
105
Note: See TracBrowser for help on using the repository browser.