Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6091 in orxonox.OLD


Ignore:
Timestamp:
Dec 13, 2005, 4:56:23 PM (18 years ago)
Author:
bensch
Message:

objectManager: super-debug

Location:
branches/objectmanager/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/objectmanager/src/defs/debug.h

    r5996 r6091  
    110110#endif
    111111#ifndef NO_SHELL
    112 #define PRINT_EXEC       printf //ShellBuffer::addBufferLineStatic
     112#define PRINT_EXEC       ShellBuffer::addBufferLineStatic
    113113#else /* NO_SHELL */
    114114#define PRINT_EXEC       printf
  • branches/objectmanager/src/util/object_manager.cc

    r6089 r6091  
    1010
    1111   ### File Specific:
    12    main-programmer: ...
     12   main-programmer: Benjamin Grauer
    1313   co-programmer: ...
    1414*/
     
    2121#include "world_entity.h"
    2222
     23#include "shell_command.h"
    2324using namespace std;
    24 
     25SHELL_COMMAND(debug, ObjectManager, debug)
     26    ->defaultValues(2, NULL, 0);
    2527
    2628/**
     
    6365  if (likely(omList != OM_INIT))
    6466  {
    65     this->objectList[omList].push_back(entity);
     67    this->objectLists[omList].push_back(entity);
     68    entity->getEntityIterator() = --this->objectLists[omList].end();
    6669    entity->getOMListNumber() = omList;
    6770  }
     
    7881void ObjectManager::toList (WorldEntity* entity, const char* omList)
    7982{
    80   this->toList(entity, ObjectManager::StringToOMList( omList));
     83  this->toList(entity, ObjectManager::StringToOMList(omList));
    8184}
    8285
     
    103106
    104107
     108/**
     109 * @brief print out nice debug information about Elements in the list OM_LIST
     110 * @param omList the List to debug.
     111 */
     112void ObjectManager::debug(OM_LIST omList) const
     113{
     114  if (omList != OM_INIT)
     115  {
     116    PRINT(0)(" +ObjectManager-LIST: '%s'------\n", ObjectManager::OMListToString((OM_LIST) omList));
     117    std::list<WorldEntity*>::const_iterator entity;
     118    for (entity = this->objectLists[omList].begin(); entity != this->objectLists[omList].end(); entity++)
     119    {
     120      PRINT(0)(" | %s::%s\n",(*entity)->getClassName(), (*entity)->getName());
     121    }
     122  }
     123  else
     124    PRINTF(2)("Invalid query. for OM_INIT-LIST\n");
     125}
     126
     127
     128/**
     129 * @brief prints out very nice debug information
     130 * @param listName the Name of the list to get Debug information from
     131 */
     132void ObjectManager::debug(const char* listName)
     133{
     134  PRINT(0)("=ObjectManager-DEBUG=============\n");
     135  if (listName == NULL || listName[0] == '\0')
     136    for (unsigned int i = 0; i < OM_SIZE; ++i)
     137      debug((OM_LIST) i);
     138  else
     139    debug(ObjectManager::StringToOMList(listName));
     140  PRINT(0)("=========================== OM ==\n");
     141}
    105142
    106143
     
    111148 * @returns the String transformed from omList.
    112149 */
    113 const char* ObjectManager::StringToOMList(OM_LIST omList)
     150const char* ObjectManager::OMListToString(OM_LIST omList)
    114151{
    115152  switch (omList)
  • branches/objectmanager/src/util/object_manager.h

    r6089 r6091  
    8383  static std::list<WorldEntity*>* distanceFromObject(const PNode& center, float radius, ClassID classID);
    8484
     85  void debug(OM_LIST omList) const;
     86  void debug(const char* listName = NULL);
    8587
    8688  static OM_LIST StringToOMList(const char* listName);
    87   static const char* StringToOMList(OM_LIST omList);
     89  static const char* OMListToString(OM_LIST omList);
    8890
    8991 private:
Note: See TracChangeset for help on using the changeset viewer.