Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Jun 10, 2005, 7:17:22 PM (20 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??

Location:
orxonox/trunk/src/util
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/util/garbage_collector.cc

    r4519 r4592  
    1 /* 
     1/*
    22   orxonox - the future of 3D-vertical-scrollers
    33
     
    3333   \brief standard constructor
    3434*/
    35 GarbageCollector::GarbageCollector () 
     35GarbageCollector::GarbageCollector ()
    3636{
    3737   this->setClassID(CL_GARBAGE_COLLECTOR, "GarbageCollector");
     
    4444   \brief standard deconstructor
    4545*/
    46 GarbageCollector::~GarbageCollector () 
     46GarbageCollector::~GarbageCollector ()
    4747{
    4848  // delete what has to be deleted here
     
    5252   \brief this sets the collection delay
    5353   \param delay: the delay
    54    
     54
    5555   after this delay, the garbage collector starts its work and begins to collect unused object
    5656   to delete them afterwards. only objects in the worldentity list from the world object are lookded
    57    at. 
     57   at.
    5858*/
    5959void GarbageCollector::setCollectionDelay(float delay)
     
    107107  tIterator<WorldEntity>* iterator = list->getIterator();
    108108  WorldEntity* entity = iterator->nextElement();
    109   while( entity != NULL) 
    110     { 
     109  while( entity != NULL)
     110    {
    111111      if( entity->isFinalized())
    112         {
    113           PRINTF(4)("= finalizing object\n");
    114           ++counter;
    115          
    116           /* first remove out of entity list */
    117           list->remove(entity);
    118           /* second remove out of pnode tree */
    119           entity->remove();
    120           /* then finaly delete reference */
    121           //delete entity;
    122           ObjectManager::getInstance()->addToDeadList(entity->getClassID(), entity);
    123         }
     112        {
     113          PRINTF(4)("= finalizing object\n");
     114          ++counter;
     115
     116          /* first remove out of entity list */
     117          list->remove(entity);
     118          /* second remove out of pnode tree */
     119          entity->remove();
     120          /* then finaly delete reference */
     121          //delete entity;
     122          ObjectManager::getInstance()->addToDeadList(entity->getClassID() & CL_MASK_LOWLEVEL_CLASS, entity);
     123        }
    124124      entity = iterator->nextElement();
    125125    }
  • 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
  • orxonox/trunk/src/util/object_manager.cc

    r4519 r4592  
    1 /* 
     1/*
    22   orxonox - the future of 3D-vertical-scrollers
    33
     
    2626   \brief standard constructor
    2727*/
    28 ObjectManager::ObjectManager () 
     28ObjectManager::ObjectManager ()
    2929{
    3030  this->setClassID(CL_OBJECT_MANAGER, "ObjectManager");
    31  
     31
    3232  this->managedObjectList = new tList<BaseObject>*[CL_NUMBER];
    3333  for(int i = 0; i < CL_NUMBER; ++i)
     
    4848   \brief standard deconstructor
    4949*/
    50 ObjectManager::~ObjectManager () 
     50ObjectManager::~ObjectManager ()
    5151{
    5252  ObjectManager::singletonRef = NULL;
     
    8080      this->managedObjectList[index]->remove(obj);
    8181      if( unlikely(obj == NULL))
    82         {
    83           PRINTF(0)("Critical: there was no object anymore in the dead list! This could result in Segfaults\n");
    84         }
     82        {
     83          PRINTF(0)("Critical: there was no object anymore in the dead list! This could result in Segfaults\n");
     84        }
    8585      return obj;
    8686    }
     
    9696{
    9797  PRINT(0)("\n==========================| ObjectManager::debug() |===\n");
    98   PRINT(0)("=  Number of registerable classes: %i\n", CL_NUMBER ); 
     98  PRINT(0)("=  Number of registerable classes: %i\n", CL_NUMBER );
    9999  PRINT(0)("=  Currently cached objects: \n");
    100100  for(int i = 0; i < CL_NUMBER; ++i)
    101101    {
    102102      if( this->managedObjectList[i] != NULL)
    103         PRINT(0)("=   o Class Nr. %i has cached %i object(s)\n", i, this->managedObjectList[i]->getSize());
     103        PRINT(0)("=   o Class Nr. %i has cached %i object(s)\n", i, this->managedObjectList[i]->getSize());
    104104      else
    105         PRINT(0)("=   o Class Nr. %i has cached 0 object(s)\n", i);
     105        PRINT(0)("=   o Class Nr. %i has cached 0 object(s)\n", i);
    106106    }
    107107  PRINT(0)("=======================================================\n");
Note: See TracChangeset for help on using the changeset viewer.