Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 22, 2006, 1:34:31 AM (18 years ago)
Author:
bensch
Message:

orxonox/branches/new_class_id: slowly but surely reimplementing to the new groove… way to go

File:
1 edited

Legend:

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

    r8148 r9684  
    3838
    3939//! The Factory is a loadable object handler
    40 class Factory : public BaseObject {
    41 
    42  public:
     40class Factory : public BaseObject
     41{
     42  NewObjectListDeclaration(Factory);
     43public:
    4344  virtual ~Factory ();
    4445
     
    4647
    4748  static  BaseObject* fabricate(const std::string& className);
    48   static  BaseObject* fabricate(ClassID classID);
     49  static  BaseObject* fabricate(int classID);
    4950  static  BaseObject* fabricate(const TiXmlElement* root = NULL);
    5051
    5152
    52   bool operator==(ClassID classID) const;
     53  bool operator==(int classID) const;
    5354  bool operator==(const char* className) const;
    5455  bool operator==(const std::string& className) const;
    5556
    56   protected:
    57     Factory (const std::string& factoryName, ClassID classID);
    58     virtual BaseObject* fabricateObject(const TiXmlElement* root = NULL) const = 0;
     57protected:
     58  Factory (const std::string& factoryName, int classID);
     59  virtual BaseObject* fabricateObject(const TiXmlElement* root = NULL) const = 0;
    5960
    60   protected:
    61     const ClassID                 classID;              //!< The Class-Identifyer of the Factory.
    62     const std::string             className;            //!< The name of the Class.
    63     static std::list<Factory*>*   factoryList;          //!< List of Registered Factories
     61protected:
     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
    6465};
    6566
     
    7071template<class T> class tFactory : public Factory
    7172{
    72  public:
    73  /**
    74   * @brief creates a new type Factory to enable the loading of T
    75   * @param factoryName the Name of the Factory to load.
    76   * @param classID the ID of the Class to be created.
    77   */
    78   tFactory (const char* factoryName, ClassID classID)
    79    : Factory(factoryName, classID)
     73public:
     74  /**
     75   * @brief creates a new type Factory to enable the loading of T
     76   * @param factoryName the Name of the Factory to load.
     77   * @param classID the ID of the Class to be created.
     78   */
     79  tFactory (const char* factoryName, int classID)
     80      : Factory(factoryName, classID)
    8081  {  }
    8182
    82   private:
    83    /**
    84     * @brief fabricates an Object of type T, with the constructor T::T(const TiXmlElemnt*)
    85     * @param root the TiXmlElement T should load parameters from.
    86     * @return the newly fabricated T.
    87     */
    88     virtual BaseObject* fabricateObject(const TiXmlElement* root = NULL) const
    89     {
    90       return new T(root);
    91     }
     83private:
     84  /**
     85   * @brief fabricates an Object of type T, with the constructor T::T(const TiXmlElemnt*)
     86   * @param root the TiXmlElement T should load parameters from.
     87   * @return the newly fabricated T.
     88   */
     89  virtual BaseObject* fabricateObject(const TiXmlElement* root = NULL) const
     90  {
     91    return new T(root);
     92  }
    9293};
    9394
Note: See TracChangeset for help on using the changeset viewer.