Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4748 in orxonox.OLD


Ignore:
Timestamp:
Jul 1, 2005, 4:37:15 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: some nicer debug information, and doxygen tags

Location:
orxonox/trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/lang/class_list.cc

    r4747 r4748  
    2121#include "compiler.h"
    2222#include "debug.h"
     23#include <string.h>
     24#include <math.h>
    2325
    2426using namespace std;
     
    2628
    2729/**
    28    \brief standard constructor
    29    \todo this constructor is not jet implemented - do it
     30   \brief Creates a new ClassList
    3031*/
    3132ClassList::ClassList(const long& classID, const char* className)
     
    3536  this->className = className;
    3637  this->classID = classID;
     38
     39  ++ClassList::classCount;
    3740}
    3841
     
    4447ClassList::~ClassList ()
    4548{
    46   // delete what has to be deleted here
     49  --ClassList::classCount;
    4750}
    4851
     52//! the first class that is registered
    4953ClassList*  ClassList::first = NULL;
     54
     55//! the Count of classes
    5056unsigned int ClassList::classCount = 0;
    5157
    52 
    53 
     58/**
     59 * Adds a new Object to the ClassList (and if necessary a new Class)
     60 * @param objectPointer Pointer to the Object at hand
     61 * @param classID ID of the Given ObjectType \see ClassID
     62 * @param className name of the Class to add
     63 */
    5464void ClassList::addToClassList(BaseObject* objectPointer, const long& classID, const char* className)
    5565{
     
    7888}
    7989
     90/**
     91 * removes an Object from a the ClassList
     92 * @param objectPointer the Object to delete from the List
     93 */
    8094void ClassList::removeFromClassList(BaseObject* objectPointer)
    8195{
     
    92106}
    93107
    94 
     108/**
     109 * Print out some very nice debug information
     110 */
    95111void ClassList::debug()
    96112{
     
    98114  PRINT(0)("=  CLASS_LIST   =\n");
    99115  PRINT(0)("=================\n");
     116  PRINT(0)("has %d Elements\n\n", ClassList::classCount);
    100117  ClassList* tmp = ClassList::first;
     118  char niceString[100];
     119  unsigned int lenCount = 0;
     120
    101121  while (likely(tmp != NULL))
    102122  {
    103     PRINT(0)("CLASS %s has %d instances\n", tmp->className, tmp->objectCount);
     123    lenCount = 1;
     124    while (pow(10,lenCount) <= tmp->objectCount)
     125      ++lenCount;
     126    for (int i=0; i < 30-strlen(tmp->className) - lenCount; i++)
     127      (niceString[i]) = ' ';
     128    niceString[30-strlen(tmp->className) - lenCount] = '\0';
     129
     130    PRINT(0)("CLASS %s:%s %d instances\n", tmp->className, niceString, tmp->objectCount);
    104131
    105132    tmp = tmp->next;
    106133  }
    107134  PRINT(0)("==============CL=\n");
    108 
    109135}
  • orxonox/trunk/src/lib/lang/class_list.h

    r4747 r4748  
    3636    struct ObjectList
    3737    {
    38       BaseObject*            pointerToObject;
    39       ObjectList*            next;
     38      BaseObject*            pointerToObject;        //! Pointer to the Object
     39      ObjectList*            next;                   //!< pointer to the next Object in the List
    4040    };
    4141
    42     long                     classID;
    43     const char*              className;
     42    long                     classID;                //!< ClassID stored in this ClassList \see ClassID
     43    const char*              className;              //!< Name of the Class Stored here
    4444
    45     ClassList*               next;
     45    ClassList*               next;                   //!< Pointer to the next class in the List
    4646
    47     unsigned int             objectCount;
     47    unsigned int             objectCount;            //!< how many Objects of this particular Object have been loaded??
    4848
    4949
    50     static ClassList*        first;
    51     static unsigned int      classCount;
     50    static ClassList*        first;                  //!< The first Class in the List (should be BaseObject)
     51    static unsigned int      classCount;             //!< The Count of classes that have been registered (should match the lower description)
    5252
    5353};
  • orxonox/trunk/src/orxonox.cc

    r4746 r4748  
    4343#include "cd_engine.h"
    4444
     45#include "class_list.h"
     46
    4547#include <string.h>
    4648
     
    8183  delete TextEngine::getInstance();
    8284  delete EventHandler::getInstance();
     85
     86  ClassList::debug();
    8387}
    8488
Note: See TracChangeset for help on using the changeset viewer.