Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


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

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

Legend:

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

    r9406 r9684  
    2424
    2525
    26 
     26NewObjectListDefinition(DynamicLoader);
    2727
    2828/**
     
    3131*/
    3232DynamicLoader::DynamicLoader (const std::string& libName)
    33     : Factory(NULL, CL_NULL)
     33    : Factory(NULL, 0)
    3434{
    35   this->setClassID(CL_DYNAMIC_LOADER, "DynamicLoader");
     35  this->registerObject(this, DynamicLoader::_objectList);
    3636
    3737  this->handle = NULL;
  • branches/new_class_id/src/lib/util/loading/dynamic_loader.h

    r7193 r9684  
    1919class DynamicLoader : public Factory
    2020{
     21  NewObjectListDeclaration(DynamicLoader);
    2122
    2223public:
  • branches/new_class_id/src/lib/util/loading/factory.cc

    r9675 r9684  
    1919//#include "shell_command.h"
    2020
    21 
     21NewObjectListDefinition(Factory);
    2222
    2323//SHELL_COMMAND(create, Factory, fabricate);
     
    2828 * set everything to zero and define factoryName
    2929 */
    30 Factory::Factory (const std::string& factoryName, ClassID classID)
     30Factory::Factory (const std::string& factoryName, int classID)
    3131    : classID(classID), className(factoryName)
    3232{
    33   this->setClassID(CL_FACTORY, "Factory");
     33  this->registerObject(this, Factory::_objectList);
    3434  this->setName(factoryName);
    3535
     
    7474 * @returns true on match, false otherwise
    7575 */
    76 bool Factory::operator==(ClassID classID) const
     76bool Factory::operator==(int classID) const
    7777{
    7878  return (this->classID == classID);
     
    149149 * @returns a new Object of Type classID on match, NULL otherwise
    150150 */
    151 BaseObject* Factory::fabricate(ClassID classID)
     151BaseObject* Factory::fabricate(int classID)
    152152{
    153153  if (Factory::factoryList == NULL)
  • 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
  • branches/new_class_id/src/lib/util/loading/game_loader.cc

    r9110 r9684  
    2828#include "key_mapper.h"
    2929
     30NewObjectListDefinition(GameLoader);
    3031
    3132
     
    4344GameLoader::GameLoader ()
    4445{
    45   this->setClassID(CL_GAME_LOADER, "GameLoader");
     46  this->registerObject(this, GameLoader::_objectList);
    4647  this->setName("GameLoader");
    4748  this->bRun = true;
     
    5758    delete this->currentCampaign;
    5859  this->currentCampaign = NULL;
    59  
     60
    6061  GameLoader::singletonRef = NULL;
    6162}
  • branches/new_class_id/src/lib/util/loading/game_loader.h

    r7868 r9684  
    3838class GameLoader : public EventListener
    3939{
    40  public:
     40  NewObjectListDeclaration(GameLoader);
     41  public:
    4142  virtual ~GameLoader ();
    4243  /**  this class is a singleton class @returns an instance of itself  */
  • branches/new_class_id/src/lib/util/loading/resource_manager.cc

    r9406 r9684  
    5050#include <unistd.h>
    5151
    52 
     52NewObjectListDefinition(ResourceManager);
    5353
    5454/**
     
    5757ResourceManager::ResourceManager ()
    5858{
    59   this->setClassID(CL_RESOURCE_MANAGER, "ResourceManager");
     59  this->registerObject(this, ResourceManager::_objectList);
    6060  this->setName("ResourceManager");
    6161
  • branches/new_class_id/src/lib/util/loading/resource_manager.h

    r8724 r9684  
    9494class ResourceManager : public BaseObject
    9595{
    96  public:
     96  NewObjectListDeclaration(ResourceManager);
     97public:
    9798  virtual ~ResourceManager();
    9899  /** @returns a Pointer to the only object of this Class */
     
    101102  bool setDataDir(const std::string& dataDir);
    102103  /** @returns the Name of the data directory */
    103   inline const std::string& getDataDir() const { return this->dataDir; };
     104inline const std::string& getDataDir() const { return this->dataDir; };
    104105
    105106
     
    139140  static ResourceType stringToResourceType(const std::string& resourceType);
    140141
    141  private:
     142private:
    142143  ResourceManager();
    143144  Resource* loadResource(const std::string& fileName, ResourceType type, ResourcePriority prio,
    144145                         const MultiType& param0, const MultiType& param1, const MultiType& param2);
    145146
    146  private:
     147private:
    147148  static ResourceManager*    singletonRef;       //!< singleton Reference
    148149
Note: See TracChangeset for help on using the changeset viewer.