Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9681 in orxonox.OLD


Ignore:
Timestamp:
Aug 22, 2006, 12:19:30 AM (18 years ago)
Author:
bensch
Message:

cleanup

Location:
trunk/src/lib/lang
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/lang/new_class_id.cc

    r9680 r9681  
    3535NewClassID::~NewClassID ()
    3636{
    37   //  assert(_objectList != NULL);
    3837  ClassList::iterator it;
    3938  for (it = this->_classes.begin(); it != this->_classes.end(); ++it)
     
    4241    delete (*it)._iterator;
    4342  }
    44   //_objectList->unregisterObject(this->_iterators);
    4543}
    4644
  • trunk/src/lib/lang/new_class_id.h

    r9678 r9681  
    1414
    1515
    16 
    17 
    1816//! A class to dynamically allocate ClassID's and support a isA operator
    1917class NewClassID
     
    2220  NewClassID();
    2321  ~NewClassID();
    24 
    2522
    2623  int leafClassID() const { return _classes.front()._objectList->id(); }
  • trunk/src/lib/lang/new_object_list.cc

    r9677 r9681  
    2020
    2121
     22/**
     23 * @brief Constructor, that creates an ObjectList while checking (development mode) for uniqueness of all Keys (names and ID's)
     24 * @param className The Name of the Class to create an ObjectList for.
     25 * @param id The ID if you like, or -1 otherwise.
     26 * @return a new NewObejctList
     27 */
    2228NewObjectListBase::NewObjectListBase(const std::string& className, int id)
    2329    : _name(className)
    2430{
    25 
    26 
    2731  if (NewObjectListBase::_classesByID == NULL)
    2832  {
     
    4650
    4751  /// Some Output, that will fall out later
    48   std::cout << "register new ObjectList " << className << " ID: " << this->_id << std::endl;
     52  //std::cout << "register new ObjectList " << className << " ID: " << this->_id << std::endl;
    4953
    5054  (*NewObjectListBase::_classesByID)[this->_id] = this;
     
    6165{
    6266  assert (NewObjectListBase::_classesByName != NULL && NewObjectListBase::_classesByID != NULL);
    63 
     67  /*
    6468  std::cout << "Erasing: " << this->_name << " "<< this->_id  << std::endl;
    65 
    6669  std::cout << "SIZE OF _classByID: " << NewObjectListBase::_classesByID->size() << std::endl;
    6770  std::cout << "SIZE OF _classByName: " << NewObjectListBase::_classesByName->size() << std::endl;
    68 
     71  */
    6972  NewObjectListBase::_classesByName->erase(this->_name);
    7073  NewObjectListBase::_classesByID->erase(this->_id);
  • trunk/src/lib/lang/new_object_list.h

    r9677 r9681  
    1212#include <list>
    1313#include <string>
     14#include <iostream>
    1415
    1516
     
    129130//// IMPLEMENTATION /////
    130131/////////////////////////
     132/**
     133 * @brief creates a new NewObjectList
     134 * @param name The name of the Class.
     135 * @param id The ID of the class if desired, or -1 if an id should be assigned automatically.
     136 */
    131137template <class T>
    132138NewObjectList<T>::NewObjectList(const std::string& name, int id)
     
    134140{}
    135141
     142/**
     143 * @brief deletes the NewObjectList.
     144 */
    136145template <class T>
    137146NewObjectList<T>::~NewObjectList()
    138147{
    139   // assert(_objects.empty());
     148  if (!_objects.empty())
     149  {
     150    std::cout << "There are still Object in the ObjectList of " << this->name() << "(id:" << this->id() << ")\n";
     151    this->debug();
     152  }
    140153}
    141154
     
    151164
    152165template <class T>
    153     NewObjectListBase::IteratorBase* NewObjectList<T>::registerObject(T* object)
     166NewObjectListBase::IteratorBase* NewObjectList<T>::registerObject(T* object)
    154167{
    155168  this->_objects.push_front(object);
     
    164177}
    165178
    166 #include <iostream>
    167179
    168180template <class T>
  • trunk/src/lib/lang/test_object_list.cc

    r9680 r9681  
    6464  {
    6565    this->registerObject(this, Bone::objectList);
    66     this->_id.listInheritance();
     66    //this->_id.listInheritance();
    6767    std::cout << "LeafID:" << this->_id.leafClassID() << std::endl;
    6868
     
    7979int main()
    8080{
    81   for (unsigned int i = 0; i < 20; ++i)
     81#define ITERATIONS 20
     82#define COUNT 100
     83  for (unsigned int i = 0; i < ITERATIONS; ++i)
    8284  {
    8385    std::cout<< i <<  std::endl ;
    84     Bone* test = new Bone[10000];
    85     // delete[]test;
     86    Bone* test = new Bone[COUNT];
     87    delete[]test;
    8688  }
    8789  //   char tmp[100];
Note: See TracChangeset for help on using the changeset viewer.