Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5328 in orxonox.OLD for trunk/src


Ignore:
Timestamp:
Oct 8, 2005, 10:13:32 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: almost working

Location:
trunk/src/lib/shell
Files:
2 edited

Legend:

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

    r5327 r5328  
    211211  {
    212212    ShellCommandClass::commandClassList = new tList<ShellCommandClass>;
    213 //    ShellCommandStatic<ShellCommandBase>::registerCommand("debug", "ShellCommand", &ShellCommandBase::debug);
     213    ShellCommandStatic<ShellCommandBase>::registerCommand("debug", "ShellCommand", ShellCommandBase::debug);
    214214  }
    215215}
  • trunk/src/lib/shell/shell_command.h

    r5327 r5328  
    4141
    4242
     43//! an enumerator for the definition of the Type.
     44typedef enum {
     45  ShellCommand_Objective = 1,
     46  ShellCommand_Static    = 2,
     47} ShellCommand_Type;
     48
    4349////////////////
    4450// BASE CLASS //
     
    99105    ~ShellCommandBase();
    100106
     107    /** @returns the Type of this Function (either static or objective) */
     108    inline ShellCommand_Type getType() { return this->functorType; };
     109
    101110    static bool isRegistered(const char* commandName, const char* className, unsigned int paramCount, ...);
    102111    static const char* paramToString(long parameter);
     
    109118
    110119  protected:
     120    ShellCommand_Type                functorType;                          //!< The type of Function we've got (either static or objective).
    111121    void*                            functionPointer;                      //!< The pointeer to the function of the Class (or static pointer if ClassID == CL_NULL )
    112122    unsigned int                     paramCount;                           //!< the count of parameters.
     
    116126    float                            defaultFloats[FUNCTOR_MAX_ARGUMENTS]; //!< A list of default Floats stored.
    117127    bool                             defaultBools[FUNCTOR_MAX_ARGUMENTS];  //!< A list of default Bools stored.
     128
    118129
    119130  private:
     
    149160// SHELLCOMMANDEXECUTER can be redefined too.
    150161// SHELLCOMMANDINCLASS
     162// SHELLCOMMANDTYPE
    151163//! registers a command without any parameters
    152164#define ShellCommandRegister0() \
     
    212224  : ShellCommandBase(commandName, className, 0) \
    213225  { \
     226    this->functorType = SHELLCOMMANDTYPE; \
    214227    this->functionPointer_0 = function; \
    215228  }
     
    221234  : ShellCommandBase(commandName, className, 1, t1##_PARAM, d1) \
    222235  { \
     236    this->functorType = SHELLCOMMANDTYPE; \
    223237    this->functionPointer_1_##t1 = function; \
    224238  }
     
    230244  : ShellCommandBase(commandName, className, 2, t1##_PARAM, d1, t2##_PARAM, d2) \
    231245  { \
     246    this->functorType = SHELLCOMMANDTYPE; \
    232247    this->functionPointer_2_##t1##_##t2 = function; \
    233248  }
     
    239254  : ShellCommandBase(commandName, className, 3, t1##_PARAM, d1, t2##_PARAM, d2, t3##_PARAM, d3) \
    240255  { \
     256    this->functorType = SHELLCOMMANDTYPE; \
    241257    this->functionPointer_3_##t1##_##t2##_##t3 = function; \
    242258  }
     
    248264  : ShellCommandBase(commandName, className, 4, t1##_PARAM, d1, t2##_PARAM, d2, t3##_PARAM, d3, t4##_PARAM, d4) \
    249265  { \
     266    this->functorType = SHELLCOMMANDTYPE; \
    250267    this->functionPointer_4_##t1##_##t2##_##t3##_##t4 = function; \
    251268  }
     
    257274  : ShellCommandBase(commandName, className, 5, t1##_PARAM, d1, t2##_PARAM, d2, t3##_PARAM, d3, t4##_PARAM, d4, t5##_PARAM, d5) \
    258275  { \
     276    this->functorType = SHELLCOMMANDTYPE; \
    259277    this->functionPointer_5_##t1##_##t2##_##t3##_##t4##_##t5 = function; \
    260278  }
     
    313331#endif
    314332#define SHELLCOMMANDINCLASS(FUNCTION)      (T::FUNCTION)
    315 
     333#ifdef SHELLCOMMANDTYPE
     334#undef SHELLCOMMANDTYPE
     335#endif
     336#define SHELLCOMMANDTYPE                   ShellCommand_Objective
    316337//! FUNCTOR_LIST is the List of command-registerers
    317338#define FUNCTOR_LIST(x) ShellCommandRegister ## x
     
    350371#undef SHELLCOMMANDEXECUTER
    351372#endif
    352 #define SHELLCOMMANDEXECUTER(nameExt)     T::functionPointer##nameExt
     373#define SHELLCOMMANDEXECUTER(nameExt)     functionPointer##nameExt
    353374#ifdef SHELLCOMMANDINCLASS
    354375#undef SHELLCOMMANDINCLASS
    355376#endif
    356377#define SHELLCOMMANDINCLASS(FUNCTION)     (FUNCTION)
     378#ifdef SHELLCOMMANDTYPE
     379#undef SHELLCOMMANDTYPE
     380#endif
     381#define SHELLCOMMANDTYPE                   ShellCommand_Static
    357382
    358383//! FUNCTOR_LIST is the List of command-registerers
Note: See TracChangeset for help on using the changeset viewer.