Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5137 in orxonox.OLD


Ignore:
Timestamp:
Aug 26, 2005, 1:41:54 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: better macro-definition

Location:
trunk/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/defs/class_id.h

    r5117 r5137  
    110110  CL_RENDER_2D                  =    0x00000f21,
    111111  CL_NULL_ELEMENT_2D            =    0x00000f22,
     112  CL_SHELL                      =    0x00000f31,
    112113
    113114
     
    193194  CL_NUMBER                     =    0x00000b0c,
    194195  CL_FAST_FACTORY               =    0x00000c01,
    195   CL_SHELL                      =    0x00000c11,
    196196
    197197
  • trunk/src/defs/functor_list.h

    r5135 r5137  
    101101
    102102#ifdef FUNCTOR_LIST
     103  FUNCTOR_LIST(0)()
    103104  //! makes functions with one string
    104105  FUNCTOR_LIST(1)(l_STRING);
  • trunk/src/util/loading/load_param.h

    r5135 r5137  
    6262**** MACROS DEFINITIONS OF LOADABLES *****
    6363*****************************************/
     64// 0. TYPES
     65/**
     66 *  a Macro to easily implement many different Constructors for the LoadParam-Class with no argument
     67 */
     68#define LoadParam0() \
     69LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(), bool multi = false) \
     70  : BaseLoadParam(root, pt2Object, paramName, 0, multi, NULL, "") \
     71{ \
     72  if (loadString != NULL && root != NULL) \
     73    (*pt2Object.*function)(); \
     74  else \
     75    PRINTF(4)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName());\
     76}
     77
    6478// 1. TYPE
    6579/**
     
    287301template<class T> class LoadParam : public BaseLoadParam
    288302{
    289  public:
    290   LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(), bool multi = false)
    291     : BaseLoadParam(root, pt2Object, paramName, 0, multi, NULL, "")
    292     {
    293       if (loadString != NULL && root != NULL)
    294         (*pt2Object.*function)();
    295       else
    296         PRINTF(4)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName());
    297     }
    298 
     303  public:
    299304
    300305#define FUNCTOR_LIST(x)    LoadParam ## x
  • trunk/src/util/shell.cc

    r5136 r5137  
    7878  //void ShellCommand<T>::registerCommand(const char* commandName, ClassID classID, T* object, void* functionPointer, unsigned int paramCount, ...)
    7979
    80   ShellCommand<Shell>::registerCommand("clear", CL_NULL, &Shell::clear, true);
     80  ShellCommand<Shell>::registerCommand("clear", CL_SHELL, &Shell::clear);
    8181}
    8282
  • trunk/src/util/shell_command.cc

    r5135 r5137  
    8585}
    8686
    87 
    8887bool ShellCommandBase::execute(const char* executionString)
    8988{
  • trunk/src/util/shell_command.h

    r5136 r5137  
    6262    static bool isRegistered(const char* commandName, ClassID classID, unsigned int paramCount, ...);
    6363
    64 
    6564  protected:
    6665    void*                            functionPointer;     //!< The pointeer to the function of the Class (or static pointer if ClassID == CL_NULL )
     
    103102    static void unregisterCommand(const char* commandNaame, ClassID classID);
    104103
    105     static void registerCommand(const char* commandName, ClassID classID, void (T::*functionPointer)(), bool isSingleton = false)
     104    static void registerCommand(const char* commandName, ClassID classID, void (T::*functionPointer)())
    106105    {
    107106      if (isRegistered(commandName, classID, 0)== true)
     
    109108      else
    110109      {
    111         if (isSingleton == false)
     110        if (classID & CL_MASK_SINGLETON == CL_MASK_SINGLETON)
     111          new ShellCommandSingleton<T>(commandName, classID, functionPointer);
     112        else
    112113          new ShellCommand<T>(commandName, classID, functionPointer);
    113         else
    114           new ShellCommandSingleton<T>(commandName, classID, functionPointer);
    115114      }
    116115    }
Note: See TracChangeset for help on using the changeset viewer.