Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4592 in orxonox.OLD for orxonox/trunk/src/util/loading


Ignore:
Timestamp:
Jun 10, 2005, 7:17:22 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: derivations work.
now the only thing to do is specify all the classes, and DO it CLEAN.

@patrick: is it ok, how i treated your ObjectManager??

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/util/loading/load_param.h

    r4501 r4592  
    1 /* 
     1/*
    22   orxonox - the future of 3D-vertical-scrollers
    33
     
    1414*/
    1515
    16 /*! 
     16/*!
    1717    \file load_param.h
    1818    \brief A Class and macro-functions, that makes our lives easy to load-in parameters
     
    7474#define LoadParam1(type1) \
    7575 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE), bool multi = false) \
    76    : BaseLoadParam(root, pt2Object, paramName, 1, multi, type1##_NAME)          \
    77     { \
    78       if (loadString != NULL && root != NULL) \
    79         (*pt2Object.*function)(type1##_FUNC(loadString)); \
    80       else \
    81         PRINTF(4)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); \
     76   : BaseLoadParam(root, pt2Object, paramName, 1, multi, type1##_NAME)          \
     77    { \
     78      if (loadString != NULL && root != NULL) \
     79        (*pt2Object.*function)(type1##_FUNC(loadString)); \
     80      else \
     81        PRINTF(4)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); \
    8282    }
    8383
     
    9494    { \
    9595      if (loadString != NULL && root != NULL) \
    96         { \
    97           SubString subLoads(loadString); \
    98           if (subLoads.getCount() == 2) \
    99             (*pt2Object.*function)(type1##_FUNC(subLoads.getString(0)), type2##_FUNC(subLoads.getString(1))); \
    100           else \
    101             PRINTF(2)("Not loaded Parameter %s of %s, because wrong count of arguments.\n -> Should have %d but have %d\n", \
    102                       paramName, pt2Object->getClassName(), 2, subLoads.getCount()); \
    103         } \
    104       else \
    105         PRINTF(4)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); \
     96        { \
     97          SubString subLoads(loadString); \
     98          if (subLoads.getCount() == 2) \
     99            (*pt2Object.*function)(type1##_FUNC(subLoads.getString(0)), type2##_FUNC(subLoads.getString(1))); \
     100          else \
     101            PRINTF(2)("Not loaded Parameter %s of %s, because wrong count of arguments.\n -> Should have %d but have %d\n", \
     102                      paramName, pt2Object->getClassName(), 2, subLoads.getCount()); \
     103        } \
     104      else \
     105        PRINTF(4)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); \
    106106    }
    107107
     
    119119    { \
    120120      if (loadString != NULL && root != NULL) \
    121         { \
    122           SubString subLoads(loadString); \
    123           if (subLoads.getCount() == 3) \
    124             (*pt2Object.*function)(type1##_FUNC(subLoads.getString(0)), type2##_FUNC(subLoads.getString(1)), type3##_FUNC(subLoads.getString(2))); \
    125           else \
    126             PRINTF(2)("Not loaded Parameter %s of %s, because wrong count of arguments.\n -> Should have %d but have %d\n", \
    127                       paramName, pt2Object->getClassName(), 3, subLoads.getCount()); \
    128         } \
    129       else \
    130         PRINTF(4)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); \
     121        { \
     122          SubString subLoads(loadString); \
     123          if (subLoads.getCount() == 3) \
     124            (*pt2Object.*function)(type1##_FUNC(subLoads.getString(0)), type2##_FUNC(subLoads.getString(1)), type3##_FUNC(subLoads.getString(2))); \
     125          else \
     126            PRINTF(2)("Not loaded Parameter %s of %s, because wrong count of arguments.\n -> Should have %d but have %d\n", \
     127                      paramName, pt2Object->getClassName(), 3, subLoads.getCount()); \
     128        } \
     129      else \
     130        PRINTF(4)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); \
    131131    }
    132132
     
    145145    { \
    146146      if (loadString != NULL && root != NULL) \
    147         { \
    148           SubString subLoads(loadString); \
    149           if (subLoads.getCount() == 4) \
    150             (*pt2Object.*function)(type1##_FUNC(subLoads.getString(0)), type2##_FUNC(subLoads.getString(1)), type3##_FUNC(subLoads.getString(2)), type4##_FUNC(subLoads.getString(3))); \
    151           else \
    152             PRINTF(2)("Not loaded Parameter %s of %s, because wrong count of arguments.\n -> Should have %d but have %d\n", \
    153                       paramName, pt2Object->getClassName(), 4, subLoads.getCount()); \
    154         } \
    155       else \
    156         PRINTF(4)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); \
     147        { \
     148          SubString subLoads(loadString); \
     149          if (subLoads.getCount() == 4) \
     150            (*pt2Object.*function)(type1##_FUNC(subLoads.getString(0)), type2##_FUNC(subLoads.getString(1)), type3##_FUNC(subLoads.getString(2)), type4##_FUNC(subLoads.getString(3))); \
     151          else \
     152            PRINTF(2)("Not loaded Parameter %s of %s, because wrong count of arguments.\n -> Should have %d but have %d\n", \
     153                      paramName, pt2Object->getClassName(), 4, subLoads.getCount()); \
     154        } \
     155      else \
     156        PRINTF(4)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); \
    157157    }
    158158
     
    172172    { \
    173173      if (loadString != NULL && root != NULL) \
    174         { \
    175           SubString subLoads(loadString); \
    176           if (subLoads.getCount() == 5) \
    177             (*pt2Object.*function)(type1##_FUNC(subLoads.getString(0)), type2##_FUNC(subLoads.getString(1)), type3##_FUNC(subLoads.getString(2)), type4##_FUNC(subLoads.getString(3)), type5##_FUNC(subLoads.getString(4))); \
    178           else \
    179             PRINTF(2)("Not loaded Parameter %s of %s, because wrong count of arguments.\n -> Should have %d but have %d\n", \
    180                       paramName, pt2Object->getClassName(), 5, subLoads.getCount()); \
    181         } \
    182       else \
    183         PRINTF(4)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); \
     174        { \
     175          SubString subLoads(loadString); \
     176          if (subLoads.getCount() == 5) \
     177            (*pt2Object.*function)(type1##_FUNC(subLoads.getString(0)), type2##_FUNC(subLoads.getString(1)), type3##_FUNC(subLoads.getString(2)), type4##_FUNC(subLoads.getString(3)), type5##_FUNC(subLoads.getString(4))); \
     178          else \
     179            PRINTF(2)("Not loaded Parameter %s of %s, because wrong count of arguments.\n -> Should have %d but have %d\n", \
     180                      paramName, pt2Object->getClassName(), 5, subLoads.getCount()); \
     181        } \
     182      else \
     183        PRINTF(4)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); \
    184184    }
    185185
     
    216216  static LoadClassDescription* addClass(const char* className);
    217217  LoadParamDescription* addParam(const char* paramName);
    218  
     218
    219219
    220220  static void printAll(const char* fileName = NULL);
     
    249249  LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(), bool multi = false)
    250250    : BaseLoadParam(root, pt2Object, paramName, 0, multi, "")
    251     { 
     251    {
    252252      if (loadString != NULL && root != NULL)
    253         (*pt2Object.*function)();
    254       else 
    255         PRINTF(4)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName());
     253        (*pt2Object.*function)();
     254      else
     255        PRINTF(4)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName());
    256256    }
    257257
Note: See TracChangeset for help on using the changeset viewer.