Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9660 in orxonox.OLD for trunk/src/lib/lang/new_class_list.cc


Ignore:
Timestamp:
Aug 20, 2006, 11:50:41 AM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: dynamic class ID is on its way

File:
1 copied

Legend:

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

    r9659 r9660  
    1616//#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_
    1717
    18 #include "new_class_id.h"
     18#include "new_class_list.h"
    1919#include <cassert>
    2020
    21 ClassIDDeclaration::ClassIDDeclaration(const std::string& name)
    22   : _id(-1), _name(name)
     21
     22NewClassListBase::NewClassListBase(const std::string& className)
     23  : _id(-1), _name(className)
    2324{
    24   NewClassID::registerClass(this);
     25
    2526}
    26 
    27 ClassIDDeclaration::~ClassIDDeclaration()
    28 {
    29   NewClassID::unregisterClass(this);
    30 }
    31 
    32 
    33 
    34 ///////////////////////////////////////////////////////////
    35 //// CLASS ID definiton. //////////////////////////////////
    36 ///////////////////////////////////////////////////////////
    37 /**
    38  * @brief standard constructor
    39  */
    40 NewClassID::NewClassID ()
    41   : _className("")
    42 {
    43 }
    44 
    45 
    46 /**
    47  * @brief standard deconstructor
    48  */
    49 NewClassID::~NewClassID ()
    50 {
    51   // delete what has to be deleted here
    52 }
    53 
    54 
    55 int NewClassID::_idCounter = 0;
    56 
    57 //! TODO make access to the idCounter ThreadSafe!
    58 void NewClassID::registerClass(ClassIDDeclaration* namer)
    59 {
    60   assert (namer->id() != -1 && "Do not register any ClassID's for yourself.");
    61 
    62   namer->_id = NewClassID::_idCounter++;
    63 }
    64 
    65 void NewClassID::unregisterClass(ClassIDDeclaration* namer)
    66 {
    67   // here nothing is done, because Classes cannot be realigned fast.
    68 }
Note: See TracChangeset for help on using the changeset viewer.