Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7374 in orxonox.OLD for trunk/src/lib/shell/shell_command.h


Ignore:
Timestamp:
Apr 26, 2006, 3:28:55 AM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: added new Files shell_completion_plugin for the new Plugin Structure.
Also created the first namespace: OrxShell

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/shell/shell_command.h

    r7368 r7374  
    1616
    1717
    18 // FORWARD DECLARATION
    19 class ShellCommandClass;
    20 class ShellCommandAlias;
     18namespace OrxShell
     19{
     20  // FORWARD DECLARATION
     21  class ShellCommandClass;
     22  class ShellCommandAlias;
    2123
    22 /**
    23  * an easy to use Macro to create a Command
    24  * @param command the name of the command (without "" around the string)
    25  * @param class the name of the class to apply this command to (without the "" around the string)
    26  * @param function the function to call
    27  *
    28  * MEANING:
    29  *  ShellCommand* someUniqueVarName =
    30  *       ShellCommand<ClassName>::registerCommand("commandNameInShell", "ClassName", &ClassName::FunctionToCall);
    31  *
    32  * In the Shell you would call this Command using:
    33  * $ ClassName [ObjectName] commandNameInShell [parameters]
    34  */
    35 //#define SHELL_COMMAND(command, class, function) \
    36 //        ShellCommand* shell_command_##class##_##command = ShellCommand<class>::registerCommand(#command, #class, &class::function)
     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
     29   *
     30   * MEANING:
     31   *  ShellCommand* someUniqueVarName =
     32   *       ShellCommand<ClassName>::registerCommand("commandNameInShell", "ClassName", &ClassName::FunctionToCall);
     33   *
     34   * In the Shell you would call this Command using:
     35   * $ ClassName [ObjectName] commandNameInShell [parameters]
     36   */
     37  //#define SHELL_COMMAND(command, class, function) \
     38  //        ShellCommand* shell_command_##class##_##command = ShellCommand<class>::registerCommand(#command, #class, &class::function)
    3739#define SHELL_COMMAND(command, class, function) \
    38            ShellCommand* shell_command_##class##_##command = ShellCommand::registerCommand(#command, #class, ExecutorObjective<class>(&class::function))
     40           OrxShell::ShellCommand* shell_command_##class##_##command = OrxShell::ShellCommand::registerCommand(#command, #class, ExecutorObjective<class>(&class::function))
    3941
    40 /**
    41  * an easy to use Macro to create a Command
    42  * @param command the name of the command (without "" around the string)
    43  * @param class the name of the class to apply this command to (without the "" around the string)
    44  * @param function the function to call
    45  *
    46  * MEANING:
    47  *  ShellCommand* someUniqueVarName =
    48  *       ShellCommand<ClassName>::registerCommand("commandNameInShell", "ClassName", &ClassName::FunctionToCall);
    49  *
    50  * In the Shell you would call this Command using:
    51  * $ ClassName [ObjectName] commandNameInShell [parameters]
    52  */
     42  /**
     43   * an easy to use Macro to create a Command
     44   * @param command the name of the command (without "" around the string)
     45   * @param class the name of the class to apply this command to (without the "" around the string)
     46   * @param function the function to call
     47   *
     48   * MEANING:
     49   *  ShellCommand* someUniqueVarName =
     50   *       ShellCommand<ClassName>::registerCommand("commandNameInShell", "ClassName", &ClassName::FunctionToCall);
     51   *
     52   * In the Shell you would call this Command using:
     53   * $ ClassName [ObjectName] commandNameInShell [parameters]
     54   */
    5355#define SHELL_COMMAND_STATIC(command, class, function) \
    54            ShellCommand* shell_command_##class##_##command = ShellCommand::registerCommand(#command, #class, ExecutorStatic<class>(function))
     56           OrxShell::ShellCommand* shell_command_##class##_##command = OrxShell::ShellCommand::registerCommand(#command, #class, ExecutorStatic<class>(function))
    5557
    5658
    5759
    58 //! a baseClass for all possible ShellCommands
    59 class ShellCommand : public BaseObject
    60 {
    61   friend class ShellCommandClass;
     60  //! a baseClass for all possible ShellCommands
     61  class ShellCommand : public BaseObject
     62  {
     63    friend class ShellCommandClass;
    6264  public:
    6365    static bool execute (const std::string& executionString);
     
    8991    Executor*                        executor;                             //!< The Executor, that really executes the Function.
    9092
    91 };
     93  };
    9294
    93 //! A Class, that handles aliases.
    94 class ShellCommandAlias
    95 {
    96   friend class ShellCommand;
     95  //! A Class, that handles aliases.
     96  class ShellCommandAlias
     97  {
     98    friend class ShellCommand;
    9799  public:
    98100    /** @returns the Name of the Alias. */
     
    108110    std::string     aliasName;       //!< the name of the Alias
    109111    ShellCommand*   command;         //!< a pointer to the command, this alias executes.
    110 };
     112  };
     113
     114}
    111115
    112116#endif /* _SHELL_COMMAND_H */
Note: See TracChangeset for help on using the changeset viewer.