Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9686 in orxonox.OLD for branches/new_class_id/src/lib/util


Ignore:
Timestamp:
Aug 22, 2006, 2:36:54 PM (18 years ago)
Author:
bensch
Message:

new_class_id: many more classes done

Location:
branches/new_class_id/src/lib/util/loading
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/new_class_id/src/lib/util/loading/factory.cc

    r9684 r9686  
    2929 */
    3030Factory::Factory (const std::string& factoryName, int classID)
    31     : classID(classID), className(factoryName)
     31    : _classID(classID), _className(factoryName)
    3232{
    3333  this->registerObject(this, Factory::_objectList);
    3434  this->setName(factoryName);
    3535
    36   if( Factory::factoryList == NULL)
    37     Factory::factoryList = new std::list<Factory*>;
     36  if( Factory::_factoryList == NULL)
     37    Factory::_factoryList = new std::list<Factory*>;
    3838
    39   Factory::factoryList->push_back(this);
     39  Factory::_factoryList->push_back(this);
    4040}
    4141
    4242/** @brief a reference to the First Factory */
    43 std::list<Factory*>* Factory::factoryList = NULL;
     43std::list<Factory*>* Factory::_factoryList = NULL;
    4444
    4545/**
     
    5858void Factory::deleteFactories()
    5959{
    60   if (Factory::factoryList != NULL)
     60  if (Factory::_factoryList != NULL)
    6161  {
    62     while(!Factory::factoryList->empty())
     62    while(!Factory::_factoryList->empty())
    6363    {
    64       delete Factory::factoryList->front();
    65       Factory::factoryList->pop_front();
     64      delete Factory::_factoryList->front();
     65      Factory::_factoryList->pop_front();
    6666    }
    67     delete Factory::factoryList;
    68     Factory::factoryList = NULL;
     67    delete Factory::_factoryList;
     68    Factory::_factoryList = NULL;
    6969  }
    7070}
     
    7676bool Factory::operator==(int classID) const
    7777{
    78   return (this->classID == classID);
     78  return (this->_classID == classID);
    7979}
    8080
     
    8686bool Factory::operator==(const char* className) const
    8787{
    88   return (className != NULL && this->className == className);
     88  return (className != NULL && this->_className == className);
    8989}
    9090
     
    9696bool Factory::operator==(const std::string& className) const
    9797{
    98   return (this->className == className);
     98  return (this->_className == className);
    9999}
    100100
     
    107107BaseObject* Factory::fabricate(const TiXmlElement* root)
    108108{
    109   assert (root != NULL && Factory::factoryList != NULL);
     109  assert (root != NULL && Factory::_factoryList != NULL);
    110110
    111111  std::list<Factory*>::const_iterator factory;
    112   for (factory = Factory::factoryList->begin(); factory != Factory::factoryList->end(); factory++)
     112  for (factory = Factory::_factoryList->begin(); factory != Factory::_factoryList->end(); factory++)
    113113    if (*(*factory) == root->Value())
    114114    {
     
    129129BaseObject* Factory::fabricate(const std::string& className)
    130130{
    131   if (Factory::factoryList == NULL)
     131  if (Factory::_factoryList == NULL)
    132132    return NULL;
    133133
    134134  std::list<Factory*>::const_iterator factory;
    135   for (factory = Factory::factoryList->begin(); factory != Factory::factoryList->end(); factory++)
     135  for (factory = Factory::_factoryList->begin(); factory != Factory::_factoryList->end(); factory++)
    136136    if (*(*factory) == className)
    137137    {
     
    151151BaseObject* Factory::fabricate(int classID)
    152152{
    153   if (Factory::factoryList == NULL)
     153  if (Factory::_factoryList == NULL)
    154154    return NULL;
    155155
    156156  std::list<Factory*>::const_iterator factory;
    157   for (factory = Factory::factoryList->begin(); factory != Factory::factoryList->end(); factory++)
     157  for (factory = Factory::_factoryList->begin(); factory != Factory::_factoryList->end(); factory++)
    158158    if (*(*factory) == classID)
    159159    {
  • branches/new_class_id/src/lib/util/loading/factory.h

    r9684 r9686  
    6060
    6161protected:
    62   const int                     classID;              //!< The Class-Identifyer of the Factory.
    63   const std::string             className;            //!< The name of the Class.
    64   static std::list<Factory*>*   factoryList;          //!< List of Registered Factories
     62  const int                     _classID;              //!< The Class-Identifyer of the Factory.
     63  const std::string             _className;            //!< The name of the Class.
     64  static std::list<Factory*>*   _factoryList;          //!< List of Registered Factories
    6565};
    6666
Note: See TracChangeset for help on using the changeset viewer.