Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 24, 2009, 2:55:34 AM (15 years ago)
Author:
landauf
Message:

Renamed BaseFactory as Factory
Added function ClassByLowercaseString

Location:
code/branches/core5/src/libraries/core
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core5/src/libraries/core/ClassFactory.h

    r5778 r5779  
    4646namespace orxonox
    4747{
    48     // ###############################
    49     // ###       BaseFactory       ###
    50     // ###############################
     48    // ###########################
     49    // ###       Factory       ###
     50    // ###########################
    5151    //! Base-class of ClassFactory.
    52     class _CoreExport BaseFactory
     52    class _CoreExport Factory
    5353    {
    5454        public:
    55             virtual ~BaseFactory() {};
     55            virtual ~Factory() {};
    5656            virtual BaseObject* fabricate(BaseObject* creator) = 0;
    5757    };
     
    6262    //! The ClassFactory is able to create new objects of a specific class.
    6363    template <class T>
    64     class ClassFactory : public BaseFactory
     64    class ClassFactory : public Factory
    6565    {
    6666        public:
  • code/branches/core5/src/libraries/core/CoreIncludes.h

    r5778 r5779  
    8080*/
    8181#define CreateFactory(ClassName) \
    82     BaseFactory* ClassName##Factory = new orxonox::ClassFactory<ClassName>(#ClassName, true)
     82    Factory* _##ClassName##Factory = new orxonox::ClassFactory<ClassName>(#ClassName, true)
    8383
    8484/**
     
    8787*/
    8888#define CreateUnloadableFactory(ClassName) \
    89     BaseFactory* ClassName##Factory = new orxonox::ClassFactory<ClassName>(#ClassName, false)
     89    Factory* _##ClassName##Factory = new orxonox::ClassFactory<ClassName>(#ClassName, false)
    9090
    9191/**
     
    100100{
    101101    /**
    102         @brief Returns the Identifier with a given name through the factory.
     102        @brief Returns the Identifier with a given name.
    103103        @param String The name of the class
    104104    */
     
    109109
    110110    /**
    111         @brief Returns the Identifier with a given network ID through the factory.
     111        @brief Returns the Identifier with a given lowercase name.
     112        @param String The lowercase name of the class
     113    */
     114    inline Identifier* ClassByLowercaseString(const std::string& name)
     115    {
     116        return Identifier::getIdentifierByLowercaseString(name);
     117    }
     118
     119    /**
     120        @brief Returns the Identifier with a given network ID.
    112121        @param networkID The network ID of the class
    113122    */
  • code/branches/core5/src/libraries/core/CorePrereqs.h

    r5738 r5779  
    8787    class ArgumentCompleter;
    8888    class ArgumentCompletionListElement;
    89     class BaseFactory;
    9089    class BaseMetaObjectListElement;
    9190    class BaseObject;
  • code/branches/core5/src/libraries/core/Identifier.cc

    r5778 r5779  
    372372
    373373    /**
     374        @brief Returns the Identifier with a given name in lowercase.
     375        @param name The name of the wanted Identifier
     376        @return The Identifier
     377    */
     378    Identifier* Identifier::getIdentifierByLowercaseString(const std::string& name)
     379    {
     380        std::map<std::string, Identifier*>::const_iterator it = Identifier::getLowercaseStringIdentifierMapIntern().find(name);
     381        if (it != Identifier::getLowercaseStringIdentifierMapIntern().end())
     382            return it->second;
     383        else
     384            return 0;
     385    }
     386
     387    /**
    374388        @brief Returns the Identifier with a given network ID.
    375389        @param id The network ID of the wanted Identifier
  • code/branches/core5/src/libraries/core/Identifier.h

    r5778 r5779  
    103103
    104104            /** @brief Sets the Factory. @param factory The factory to assign */
    105             inline void addFactory(BaseFactory* factory) { this->factory_ = factory; }
     105            inline void addFactory(Factory* factory) { this->factory_ = factory; }
    106106            /** @brief Returns true if the Identifier has a Factory. */
    107107            inline bool hasFactory() const { return (this->factory_ != 0); }
     
    165165
    166166            static Identifier* getIdentifierByString(const std::string& name);
     167            static Identifier* getIdentifierByLowercaseString(const std::string& name);
    167168            static Identifier* getIdentifierByID(uint32_t id);
    168169
     
    334335            bool bLoadable_;                                               //!< False = it's not permitted to load the object through XML
    335336            std::string name_;                                             //!< The name of the class the Identifier belongs to
    336             BaseFactory* factory_;                                         //!< The Factory, able to create new objects of the given class (if available)
     337            Factory* factory_;                                             //!< The Factory, able to create new objects of the given class (if available)
    337338            static int hierarchyCreatingCounter_s;                         //!< Bigger than zero if at least one Identifier stores its parents (its an int instead of a bool to avoid conflicts with multithreading)
    338339            uint32_t networkID_;                                           //!< The network ID to identify a class through the network
Note: See TracChangeset for help on using the changeset viewer.