Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7209 in orxonox.OLD for branches/std/src/lib/util/loading/factory.cc


Ignore:
Timestamp:
Mar 10, 2006, 2:20:08 AM (18 years ago)
Author:
bensch
Message:

orxonox/std: even less evil

File:
1 edited

Legend:

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

    r7193 r7209  
    2323//SHELL_COMMAND(create, Factory, fabricate);
    2424
    25 
    26 /*  --------------------------------------------------
    27  *               Factory
    28  *   --------------------------------------------------
     25/**
     26 * @brief constructor
     27 *
     28 * set everything to zero and define factoryName
    2929 */
    30 
    31 /**
    32  *  constructor
    33 
    34    set everything to zero and define factoryName
    35 */
    36 Factory::Factory (const char* factoryName, ClassID classID)
     30Factory::Factory (const std::string& factoryName, ClassID classID)
     31  : className(factoryName), classID(classID)
    3732{
    3833  this->setClassID(CL_FACTORY, "Factory");
    3934  this->setName(factoryName);
    40 
    41   this->classID = classID;
    42   this->className = factoryName;
    4335
    4436  if( Factory::factoryList == NULL)
     
    4840}
    4941
    50 /** a reference to the First Factory */
     42/** @brief a reference to the First Factory */
    5143std::list<Factory*>* Factory::factoryList = NULL;
    5244
    5345/**
    54  *  destructor
    55  *
    56  * clear the Q
     46 * @brief destructor
    5747 */
    5848Factory::~Factory ()
     
    6454
    6555/**
    66  * deletes all the Factories. (cleanup)
     56 * @brief deletes all the Factories. (cleanup)
    6757 */
    6858void Factory::deleteFactories()
     
    9080
    9181/**
    92  * Compares the Factories Name against a given ClassName
     82 * @brief Compares the Factories Name against a given ClassName
    9383 * @param className the Name of the Class to Query
    9484 * @returns true on match, false otherwise.
     
    9686bool Factory::operator==(const char* className) const
    9787{
    98   return(className != NULL && !strcmp(className, this->className));
     88  return(className != NULL && this->className == className);
     89}
     90
     91/**
     92 * @brief Compares the Factories Name against a given ClassName
     93 * @param className the Name of the Class to Query
     94 * @returns true on match, false otherwise.
     95 */
     96bool Factory::operator==(const std::string& className) const
     97{
     98  return(this->className == className);
    9999}
    100100
    101101
    102102/**
    103  * Creates a new Object of type root->Value() (name)
     103 * @brief Creates a new Object of type root->Value() (name)
    104104 * @param root the XML-Root to match for the newly created Object
    105105 * @returns a new Object of Type root->Value() on match, NULL otherwise
     
    133133 * @returns a new Object of Type className on match, NULL otherwise
    134134 */
    135  BaseObject* Factory::fabricate(const char* className)
     135 BaseObject* Factory::fabricate(const std::string& className)
    136136{
    137   if (className == NULL || Factory::factoryList == NULL)
     137  if (Factory::factoryList == NULL)
    138138    return NULL;
    139139
Note: See TracChangeset for help on using the changeset viewer.