Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/event/command_chain.h @ 5562

Last change on this file since 5562 was 5461, checked in by bensch, 19 years ago

orxonox/trunk: command-chain (copy and renaming of shell_command) added to project … think some more

File size: 18.9 KB
RevLine 
[4838]1/*!
[5461]2 * @file command_chain.h
[5068]3 * Definition of a on-screen-shell
[5391]4 */
[1853]5
[5461]6#ifndef _COMMAND_CHAIN_H
7#define _COMMAND_CHAIN_H
[1853]8
[5129]9#include "base_object.h"
[1853]10
[5141]11#include "helper_functions.h"
[5155]12#include "substring.h"
[5143]13#include "functor_list.h"
[5141]14
[5068]15#include <stdarg.h>
16
[5461]17#define     COMMAND_CHAIN_MAX_SIZE      //!< The maximum size of a Shell Command
[5130]18
[5127]19
[5130]20
[4838]21// FORWARD DECLARATION
[5068]22template<class T> class tList;
[3543]23
[5166]24/**
25 * an easy to use Macro to create a Command
26 * @param command the name of the command (without "" around the string)
27 * @param class the name of the class to apply this command to (without the "" around the string)
28 * @param function the function to call
[5179]29 *
30 * MEANING:
[5461]31 *  CommandChainBase* someUniqueVarName =
32 *       CommandChain<ClassName>::registerCommand("commandNameInShell", "ClassName", &ClassName::FunctionToCall);
[5179]33 *
34 * In the Shell you would call this Command using:
35 * $ ClassName [ObjectName] commandNameInShell [parameters]
[5166]36 */
[5461]37#define COMMAND_CHAIN(command, class, function) \
38        CommandChainBase* command_chain_##class##_##command = CommandChain<class>::registerCommand(#command, #class, &class::function)
[5329]39/**
40 * an easy to use Macro to create a Command
41 * @param command the name of the command (without "" around the string)
42 * @param class the name of the class to apply this command to (without the "" around the string)
43 * @param function the function to call
44 *
45 * MEANING:
[5461]46 *  CommandChainBase* someUniqueVarName =
47 *       CommandChain<ClassName>::registerCommand("commandNameInShell", "ClassName", &ClassName::FunctionToCall);
[5329]48 *
49 * In the Shell you would call this Command using:
50 * $ ClassName [ObjectName] commandNameInShell [parameters]
51 */
[5461]52#define COMMAND_CHAIN_STATIC(command, class, function) \
53                         CommandChainBase* command_chain_##class##_##command = CommandChainStatic<class>::registerCommand(#command, #class, function)
[5135]54
[5162]55
[5328]56//! an enumerator for the definition of the Type.
57typedef enum {
[5461]58  CommandChain_Objective = 1,
59  CommandChain_Static    = 2,
60} CommandChain_Type;
[5328]61
[5161]62////////////////
63// BASE CLASS //
64////////////////
[5461]65class CommandChainBase;
66class CommandChainAlias;
[5170]67
68//! A class to hold all Classes that have (once) registered Commands.
[5461]69class CommandChainClass : public BaseObject
[5170]70{
[5461]71  friend class CommandChainBase;
[5170]72
73  public:
[5197]74    /** @returns the CommandClassList */
[5461]75    static const tList<CommandChainClass>* getCommandClassList() { return CommandChainClass::commandClassList; };
[5195]76    static bool getCommandListOfClass(const char* className, tList<const char>* stringList);
77    static bool getCommandListOfAlias(tList<const char>* aliasList);
[5190]78
[5461]79    static CommandChainClass* getCommandClass(const char* className);
[5171]80    static void unregisterAllCommands();
[5170]81
[5204]82    static void help (const char* className);
83
[5170]84  private:
[5461]85    CommandChainClass(const char* className);
86    ~CommandChainClass();
[5170]87
[5461]88    static const CommandChainClass* isRegistered(const char* className);
[5170]89    static void initCommandClassList();
90
91  private:
[5171]92    const char*                      className;                 //!< The Name of the Class. This should match the ClassName of the Commands Class.
93    long                             classID;                   //!< The classID of this Class
[5461]94    tList<CommandChainBase>*         commandList;               //!< A list of Commands from this Class
95    static tList<CommandChainClass>* commandClassList;          //!< A list of Classes
96    static tList<CommandChainAlias>* aliasList;                 //!< An Alias to A Command. (only for classes with one Instance)
[5170]97};
98
99
[5461]100//! a baseClass for all possible CommandChains
101class CommandChainBase : public BaseObject
[5161]102{
[5461]103  friend class CommandChainClass;
[5161]104  public:
105    static bool execute (const char* executionString);
106
[5461]107    CommandChainBase* describe(const char* description);
108    CommandChainBase* setAlias(const char* alias);
109    CommandChainBase* defaultValues(unsigned int count, ...);
[5164]110
[5166]111    /** @returns the CommandList of the Shell */
112    static void unregisterCommand(const char* commandName, const char* className);
[5161]113
114    static void debug();
115
116  protected:
[5461]117    CommandChainBase(const char* commandName, const char* className, unsigned int paramCount, ...);
118    ~CommandChainBase();
[5161]119
[5328]120    /** @returns the Type of this Function (either static or objective) */
[5461]121    inline CommandChain_Type getType() { return this->functorType; };
[5328]122
[5161]123    static bool isRegistered(const char* commandName, const char* className, unsigned int paramCount, ...);
124    static const char* paramToString(long parameter);
125
126  private:
[5166]127    /** executes a Command @param object the object to apply this to @param parameters the parameters the command takes */
[5279]128    virtual void executeCommand (BaseObject* object, const char* parameters) = 0;
[5161]129
130  protected:
[5461]131    CommandChain_Type                functorType;                          //!< The type of Function we've got (either static or objective).
[5163]132    void*                            functionPointer;                      //!< The pointeer to the function of the Class (or static pointer if ClassID == CL_NULL )
[5166]133    unsigned int                     paramCount;                           //!< the count of parameters.
134    unsigned int*                    parameters;                           //!< Parameters the function of this Command takes.
135    char*                            defaultStrings[FUNCTOR_MAX_ARGUMENTS];//!< A list of default Strings stored.
136    int                              defaultInts[FUNCTOR_MAX_ARGUMENTS];   //!< A list of default Ints stored.
137    float                            defaultFloats[FUNCTOR_MAX_ARGUMENTS]; //!< A list of default Floats stored.
138    bool                             defaultBools[FUNCTOR_MAX_ARGUMENTS];  //!< A list of default Bools stored.
[5161]139
[5328]140
[5161]141  private:
[5461]142    CommandChainClass*               shellClass;                           //!< A Pointer to the Shell-Class this Command belongs to.
143    CommandChainAlias*               alias;                                //!< An Alias for the Class.
[5161]144
[5166]145    const char*                      description;                          //!< A description for this commnand. (initially NULL). Assigned with (create)->describe("blablabla");
[5161]146};
147
148///////////////////////////////////////////////////
149///////////////////////////////////////////////////
150
[5326]151/////////////////////////////////
152// MACRO DEFINITION EXTENSIONS //
153/////////////////////////////////
[5166]154//! where to chek for default BOOL values
[5151]155#define   l_BOOL_DEFGRAB(i)         this->defaultBools[i]
[5166]156//! where to chek for default INT values
[5151]157#define   l_INT_DEFGRAB(i)          this->defaultInts[i]
[5166]158//! where to chek for default UINT values
[5151]159#define   l_UINT_DEFGRAB(i)         (unsigned int)this->defaultInts[i]
[5166]160//! where to chek for default LONG values
[5151]161#define   l_LONG_DEFGRAB(i)         (long)this->defaultInts[i]
[5166]162//! where to chek for default FLOAT values
[5151]163#define   l_FLOAT_DEFGRAB(i)        this->defaultFloats[i]
[5166]164//! where to chek for default STRING values
[5151]165#define   l_STRING_DEFGRAB(i)       this->defaultStrings[i]
[5135]166
[5153]167//////////////////////////
168// COMMAND REGISTRATION //
169//////////////////////////
[5461]170// SHELLCOMMAND can be redefined as CommandChain or CommandChainStatic
[5326]171// SHELLCOMMANDEXECUTER can be redefined too.
[5327]172// SHELLCOMMANDINCLASS
[5328]173// SHELLCOMMANDTYPE
[5166]174//! registers a command without any parameters
[5461]175#define CommandChainRegister0() \
[5327]176  static SHELLCOMMAND<T>* registerCommand(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)()) \
[5142]177  { \
[5161]178    if (isRegistered(commandName, className, 0)== true) \
179      return NULL; \
[5327]180    return new SHELLCOMMAND<T>(commandName, className, function); \
[5142]181  }
[5135]182
[5166]183//! registers a command with 1 parameter
[5461]184#define CommandChainRegister1(t1) \
[5327]185  static SHELLCOMMAND<T>* registerCommand(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE), t1##_TYPE d1 = t1##_DEFAULT) \
[5135]186  { \
[5161]187    if (isRegistered(commandName, className, 1, t1##_PARAM)== true) \
188      return NULL; \
[5327]189    return new SHELLCOMMAND<T>(commandName, className, function, d1); \
[5142]190  }
191
[5166]192//! registers a command with 2 parameters
[5461]193#define CommandChainRegister2(t1,t2) \
[5327]194  static SHELLCOMMAND<T>* registerCommand(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE, t2##_TYPE), t1##_TYPE d1 = t1##_DEFAULT, t2##_TYPE d2 = t2##_DEFAULT) \
[5153]195  { \
[5161]196    if (isRegistered(commandName, className, 2, t1##_PARAM, t2##_PARAM)== true) \
197      return NULL; \
[5327]198    return new SHELLCOMMAND<T>(commandName, className, function, d1, d2); \
[5153]199  }
200
[5166]201//! registers a command with 3 parameters
[5461]202#define CommandChainRegister3(t1,t2,t3) \
[5327]203  static SHELLCOMMAND<T>* registerCommand(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE, t2##_TYPE, t3##_TYPE), t1##_TYPE d1 = t1##_DEFAULT, t2##_TYPE d2 = t2##_DEFAULT, t3##_TYPE d3 = t3##_DEFAULT) \
[5153]204  { \
[5161]205    if (isRegistered(commandName, className, 3, t1##_PARAM, t2##_PARAM, t3##_PARAM)== true) \
206      return NULL; \
[5327]207    return new SHELLCOMMAND<T>(commandName, className, function, d1, d2, d3); \
[5153]208  }
209
[5166]210//! registers a command with 4 parameters
[5461]211#define CommandChainRegister4(t1,t2,t3,t4) \
[5327]212  static SHELLCOMMAND<T>* registerCommand(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE, t2##_TYPE, t3##_TYPE, t4##_TYPE), t1##_TYPE d1 = t1##_DEFAULT, t2##_TYPE d2 = t2##_DEFAULT, t3##_TYPE d3 = t3##_DEFAULT, t4##_TYPE d4 = t4##_DEFAULT) \
[5153]213  { \
[5161]214    if (isRegistered(commandName, className, 4, t1##_PARAM, t2##_PARAM, t3##_PARAM, t4##_PARAM)== true) \
215      return NULL; \
[5327]216    return new SHELLCOMMAND<T>(commandName, className, function, d1, d2, d3, d4); \
[5153]217  }
[5161]218
[5166]219//! registers a command with 5 parameters
[5461]220#define CommandChainRegister5(t1,t2,t3,t4,t5) \
[5327]221  static SHELLCOMMAND<T>* registerCommand(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE, t2##_TYPE, t3##_TYPE, t4##_TYPE, t5##_TYPE), t1##_TYPE d1 = t1##_DEFAULT, t2##_TYPE d2 = t2##_DEFAULT, t3##_TYPE d3 = t3##_DEFAULT, t4##_TYPE d4 = t4##_DEFAULT, t5##_TYPE d5 = t5##_DEFAULT) \
[5153]222  { \
[5161]223    if (isRegistered(commandName, className, 5, t1##_PARAM, t2##_PARAM, t3##_PARAM, t4##_PARAM, t5##_PARAM)== true) \
224      return NULL; \
[5461]225    return new CommandChain<T>(commandName, className, function, d1, d2, d3, d4, d5); \
[5153]226  }
227
228//////////////////
229// CONSTRUCTORS //
230/////////////////
[5166]231//! creates a command that takes no parameters
[5461]232#define CommandChainConstructor0() \
[5327]233  void SHELLCOMMANDINCLASS(*functionPointer_0)(); \
234  SHELLCOMMAND(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)()) \
[5461]235  : CommandChainBase(commandName, className, 0) \
[5142]236  { \
[5328]237    this->functorType = SHELLCOMMANDTYPE; \
[5145]238    this->functionPointer_0 = function; \
[5142]239  }
240
[5166]241//! creates a command that takes one parameter
[5461]242#define CommandChainConstructor1(t1) \
[5327]243  void SHELLCOMMANDINCLASS(*functionPointer_1_##t1)(t1##_TYPE); \
244  SHELLCOMMAND(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE), t1##_TYPE d1) \
[5461]245  : CommandChainBase(commandName, className, 1, t1##_PARAM, d1) \
[5135]246  { \
[5328]247    this->functorType = SHELLCOMMANDTYPE; \
[5145]248    this->functionPointer_1_##t1 = function; \
[5135]249  }
250
[5166]251//! creates a command that takes two parameters
[5461]252#define CommandChainConstructor2(t1,t2) \
[5327]253  void SHELLCOMMANDINCLASS(*functionPointer_2_##t1##_##t2)(t1##_TYPE, t2##_TYPE); \
254  SHELLCOMMAND(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE, t2##_TYPE), t1##_TYPE d1, t2##_TYPE d2) \
[5461]255  : CommandChainBase(commandName, className, 2, t1##_PARAM, d1, t2##_PARAM, d2) \
[5153]256  { \
[5328]257    this->functorType = SHELLCOMMANDTYPE; \
[5153]258    this->functionPointer_2_##t1##_##t2 = function; \
259  }
[5135]260
[5166]261//! creates a command that takes three parameter
[5461]262#define CommandChainConstructor3(t1,t2,t3) \
[5327]263  void SHELLCOMMANDINCLASS(*functionPointer_3_##t1##_##t2##_##t3)(t1##_TYPE, t2##_TYPE, t3##_TYPE); \
264  SHELLCOMMAND(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE, t2##_TYPE, t3##_TYPE), t1##_TYPE d1, t2##_TYPE d2, t3##_TYPE d3) \
[5461]265  : CommandChainBase(commandName, className, 3, t1##_PARAM, d1, t2##_PARAM, d2, t3##_PARAM, d3) \
[5153]266  { \
[5328]267    this->functorType = SHELLCOMMANDTYPE; \
[5153]268    this->functionPointer_3_##t1##_##t2##_##t3 = function; \
269  }
[5141]270
[5166]271//! creates a command that takes four parameter
[5461]272#define CommandChainConstructor4(t1,t2,t3,t4) \
[5327]273  void SHELLCOMMANDINCLASS(*functionPointer_4_##t1##_##t2##_##t3##_##t4)(t1##_TYPE, t2##_TYPE, t3##_TYPE, t4##_TYPE); \
274  SHELLCOMMAND(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE, t2##_TYPE, t3##_TYPE, t4##_TYPE), t1##_TYPE d1, t2##_TYPE d2, t3##_TYPE d3, t4##_TYPE d4) \
[5461]275  : CommandChainBase(commandName, className, 4, t1##_PARAM, d1, t2##_PARAM, d2, t3##_PARAM, d3, t4##_PARAM, d4) \
[5153]276  { \
[5328]277    this->functorType = SHELLCOMMANDTYPE; \
[5153]278    this->functionPointer_4_##t1##_##t2##_##t3##_##t4 = function; \
279  }
280
[5166]281//! creates a command that takes five parameter
[5461]282#define CommandChainConstructor5(t1,t2,t3,t4,t5) \
[5327]283  void SHELLCOMMANDINCLASS(*functionPointer_5_##t1##_##t2##_##t3##_##t4##_##t5)(t1##_TYPE, t2##_TYPE, t3##_TYPE, t4##_TYPE, t5##_TYPE); \
284  SHELLCOMMAND(const char* commandName, const char* className, void SHELLCOMMANDINCLASS(*function)(t1##_TYPE, t2##_TYPE, t3##_TYPE, t4##_TYPE, t5##_TYPE), t1##_TYPE d1, t2##_TYPE d2, t3##_TYPE d3, t4##_TYPE d4, t5##_TYPE d5) \
[5461]285  : CommandChainBase(commandName, className, 5, t1##_PARAM, d1, t2##_PARAM, d2, t3##_PARAM, d3, t4##_PARAM, d4, t5##_PARAM, d5) \
[5153]286  { \
[5328]287    this->functorType = SHELLCOMMANDTYPE; \
[5153]288    this->functionPointer_5_##t1##_##t2##_##t3##_##t4##_##t5 = function; \
289  }
290
291///////////////
292// EXECUTION //
293///////////////
[5166]294//! execute-macro for functions with no parameters
[5461]295#define CommandChainExecute0() \
[5145]296  if (this->paramCount == 0) \
[5326]297    SHELLCOMMANDEXECUTER(_0)()
[5145]298
[5166]299//! execute-macro for functions with one parameter
[5461]300#define CommandChainExecute1(t1) \
[5146]301   else if (this->paramCount == 1 && this->parameters[0] == t1##_PARAM) \
[5326]302    SHELLCOMMANDEXECUTER(_1_##t1)(t1##_FUNC(parameters, t1##_DEFGRAB(0)))
[5145]303
[5166]304//! execute-macro for functions with two parameters
[5461]305#define CommandChainExecute2(t1,t2) \
[5153]306   else if (this->paramCount == 2 && this->parameters[0] == t1##_PARAM && this->parameters[1] == t2##_PARAM) \
[5326]307    SHELLCOMMANDEXECUTER(_2_##t1##_##t2)(t1##_FUNC(sub.getString(0), t1##_DEFGRAB(0)), t2##_FUNC(sub.getString(1), t2##_DEFGRAB(1)))
[5145]308
[5166]309//! execute-macro for functions with three parameters
[5461]310#define CommandChainExecute3(t1,t2,t3) \
[5153]311   else if (this->paramCount == 3 && this->parameters[0] == t1##_PARAM && this->parameters[1] == t2##_PARAM && this->parameters[2] == t3##_PARAM) \
[5326]312    SHELLCOMMANDEXECUTER(_3_##t1##_##t2##_##t3)(t1##_FUNC(sub.getString(0), t1##_DEFGRAB(0)), t2##_FUNC(sub.getString(1), t2##_DEFGRAB(1)), t3##_FUNC(sub.getString(2), t3##_DEFGRAB(2)))
[5153]313
[5166]314//! execute-macro for functions with four parameters
[5461]315#define CommandChainExecute4(t1,t2,t3,t4) \
[5153]316   else if (this->paramCount == 4 && this->parameters[0] == t1##_PARAM && this->parameters[1] == t2##_PARAM && this->parameters[2] == t3##_PARAM && this->parameters[3] == t4##_PARAM) \
[5326]317    SHELLCOMMANDEXECUTER(_4_##t1##_##t2##_##t3##_##t4)(t1##_FUNC(sub.getString(0), t1##_DEFGRAB(0)), t2##_FUNC(sub.getString(1), t2##_DEFGRAB(1)), t3##_FUNC(sub.getString(2), t3##_DEFGRAB(2)), t4##_FUNC(sub.getString(3), t4##_DEFGRAB(3)))
[5153]318
[5166]319//! execute-macro for functions with five parameters
[5461]320#define CommandChainExecute5(t1,t2,t3,t4,t5) \
[5153]321   else if (this->paramCount == 5 && this->parameters[0] == t1##_PARAM && this->parameters[1] == t2##_PARAM && this->parameters[2] == t3##_PARAM && this->parameters[3] == t4##_PARAM && this->parameters[4] == t5##_PARAM) \
[5326]322    SHELLCOMMANDEXECUTER(_5_##t1##_##t2##_##t3##_##t4##_##t5)(t1##_FUNC(sub.getString(0), t1##_DEFGRAB(0)), t2##_FUNC(sub.getString(1), t2##_DEFGRAB(1)), t3##_FUNC(sub.getString(2), t3##_DEFGRAB(2)), t4##_FUNC(sub.getString(3), t4##_DEFGRAB(3)), t5##_FUNC(sub.getString(4), t5##_DEFGRAB(4)))
[5153]323
324
[5461]325//! keeps information about a CommandChain
326template<class T> class CommandChain : public CommandChainBase
[5129]327{
328  public:
[5153]329#ifdef FUNCTOR_LIST
330#undef FUNCTOR_LIST
331#endif
[5326]332#ifdef SHELLCOMMAND
333#undef SHELLCOMMAND
334#endif
[5461]335#define SHELLCOMMAND                       CommandChain
[5326]336#ifdef SHELLCOMMANDEXECUTER
337#undef SHELLCOMMANDEXECUTER
338#endif
[5327]339#define SHELLCOMMANDEXECUTER(nameExt)      (dynamic_cast<T*>(object)->*functionPointer##nameExt)
340#ifdef SHELLCOMMANDINCLASS
341#undef SHELLCOMMANDINCLASS
342#endif
343#define SHELLCOMMANDINCLASS(FUNCTION)      (T::FUNCTION)
[5328]344#ifdef SHELLCOMMANDTYPE
345#undef SHELLCOMMANDTYPE
346#endif
[5461]347#define SHELLCOMMANDTYPE                   CommandChain_Objective
[5166]348//! FUNCTOR_LIST is the List of command-registerers
[5461]349#define FUNCTOR_LIST(x) CommandChainRegister ## x
[5153]350#include "functor_list.h"
[5142]351#undef FUNCTOR_LIST
[5136]352
[5142]353
[5068]354  private:
[5166]355//! FUNCTOR_LIST is the List of CommandConstructors
[5461]356#define FUNCTOR_LIST(x) CommandChainConstructor ## x
[5153]357#include "functor_list.h"
[5142]358#undef FUNCTOR_LIST
359
360    virtual void executeCommand (BaseObject* object, const char* parameters)
[5135]361    {
[5204]362      SubString sub(parameters, true);
[5166]363//! FUNCTOR_LIST is the List of Executive Functions
[5461]364#define FUNCTOR_LIST(x) CommandChainExecute ## x
[5153]365#include "functor_list.h"
[5135]366#undef FUNCTOR_LIST
[5145]367    }
[5129]368};
[5113]369
[5461]370//! keeps information about a CommandChain, that points to a Static Function
371template<class T> class CommandChainStatic : public CommandChainBase
[5326]372{
373  public:
374#ifdef FUNCTOR_LIST
375#undef FUNCTOR_LIST
376#endif
377#ifdef SHELLCOMMAND
378#undef SHELLCOMMAND
379#endif
[5461]380#define SHELLCOMMAND                      CommandChainStatic
[5326]381#ifdef SHELLCOMMANDEXECUTER
382#undef SHELLCOMMANDEXECUTER
383#endif
[5328]384#define SHELLCOMMANDEXECUTER(nameExt)     functionPointer##nameExt
[5327]385#ifdef SHELLCOMMANDINCLASS
386#undef SHELLCOMMANDINCLASS
387#endif
388#define SHELLCOMMANDINCLASS(FUNCTION)     (FUNCTION)
[5328]389#ifdef SHELLCOMMANDTYPE
390#undef SHELLCOMMANDTYPE
391#endif
[5461]392#define SHELLCOMMANDTYPE                   CommandChain_Static
[5326]393
394//! FUNCTOR_LIST is the List of command-registerers
[5461]395#define FUNCTOR_LIST(x) CommandChainRegister ## x
[5326]396#include "functor_list.h"
397#undef FUNCTOR_LIST
398
399  private:
400//! FUNCTOR_LIST is the List of CommandConstructors
[5461]401#define FUNCTOR_LIST(x) CommandChainConstructor ## x
[5326]402#include "functor_list.h"
403#undef FUNCTOR_LIST
404
405    virtual void executeCommand (BaseObject* object, const char* parameters)
406    {
407  SubString sub(parameters, true);
408//! FUNCTOR_LIST is the List of Executive Functions
[5461]409#define FUNCTOR_LIST(x) CommandChainExecute ## x
[5326]410#include "functor_list.h"
411#undef FUNCTOR_LIST
412    }
413};
414
[5197]415//! A Class, that handles aliases.
[5461]416class CommandChainAlias
[5190]417{
[5461]418  friend class CommandChainBase;
[5190]419  public:
[5197]420    /** @returns the Name of the Alias. */
[5195]421    const char* getName() const { return this->aliasName; };
[5197]422    /** @returns the Command, this Alias is asociated with */
[5461]423    CommandChainBase* getCommand() const { return this->command; };
[5196]424
[5190]425  private:
[5197]426    /** @param aliasName the name of the Alias @param command the Command, to associate this alias with */
[5461]427    CommandChainAlias(const char* aliasName, CommandChainBase* command) { this->aliasName = aliasName; this->command = command; };
[5196]428
429  private:
[5197]430    const char*         aliasName;       //!< the name of the Alias
[5461]431    CommandChainBase*   command;         //!< a pointer to the command, this alias executes.
[5190]432};
433
[5461]434#endif /* _COMMAND_CHAIN_H */
Note: See TracBrowser for help on using the repository browser.