Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 24, 2013, 6:08:42 PM (11 years ago)
Author:
landauf
Message:

moved static functions from Identifier.cc/h to IdentifierManager.cc/h (still static though)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core6/src/libraries/core/class/Identifier.h

    r9563 r9564  
    9393#include "core/object/ObjectList.h"
    9494#include "core/object/ObjectListBase.h"
     95#include "IdentifierManager.h"
    9596#include "Super.h"
    9697
     
    113114    class _CoreExport Identifier
    114115    {
     116        friend class IdentifierManager;
     117
    115118        public:
    116119            /// Returns the name of the class the Identifier belongs to.
     
    151154            ////// Class Hierarchy //////
    152155            /////////////////////////////
    153             static void createClassHierarchy();
    154 
    155             /// Returns true, if a branch of the class-hierarchy is being created, causing all new objects to store their parents.
    156             inline static bool isCreatingHierarchy() { return (hierarchyCreatingCounter_s > 0); }
    157 
    158156            /// Returns the parents of the class the Identifier belongs to.
    159157            inline const std::set<const Identifier*>& getParents() const { return this->parents_; }
     
    183181            /// Returns the end-iterator of the direct-children-list.
    184182            inline std::set<const Identifier*>::const_iterator getDirectChildrenEnd() const { return this->directChildren_.end(); }
    185 
    186 
    187             //////////////////////////
    188             ///// Identifier Map /////
    189             //////////////////////////
    190             static void destroyAllIdentifiers();
    191 
    192             static Identifier* getIdentifierByString(const std::string& name);
    193             static Identifier* getIdentifierByLowercaseString(const std::string& name);
    194             static Identifier* getIdentifierByID(uint32_t id);
    195 
    196             static void clearNetworkIDs();
    197 
    198             /// Returns the map that stores all Identifiers with their names.
    199             static inline const std::map<std::string, Identifier*>& getStringIdentifierMap() { return Identifier::getStringIdentifierMapIntern(); }
    200             /// Returns a const_iterator to the beginning of the map that stores all Identifiers with their names.
    201             static inline std::map<std::string, Identifier*>::const_iterator getStringIdentifierMapBegin() { return Identifier::getStringIdentifierMap().begin(); }
    202             /// Returns a const_iterator to the end of the map that stores all Identifiers with their names.
    203             static inline std::map<std::string, Identifier*>::const_iterator getStringIdentifierMapEnd() { return Identifier::getStringIdentifierMap().end(); }
    204 
    205             /// Returns the map that stores all Identifiers with their names in lowercase.
    206             static inline const std::map<std::string, Identifier*>& getLowercaseStringIdentifierMap() { return Identifier::getLowercaseStringIdentifierMapIntern(); }
    207             /// Returns a const_iterator to the beginning of the map that stores all Identifiers with their names in lowercase.
    208             static inline std::map<std::string, Identifier*>::const_iterator getLowercaseStringIdentifierMapBegin() { return Identifier::getLowercaseStringIdentifierMap().begin(); }
    209             /// Returns a const_iterator to the end of the map that stores all Identifiers with their names in lowercase.
    210             static inline std::map<std::string, Identifier*>::const_iterator getLowercaseStringIdentifierMapEnd() { return Identifier::getLowercaseStringIdentifierMap().end(); }
    211 
    212             /// Returns the map that stores all Identifiers with their IDs.
    213             static inline const std::map<uint32_t, Identifier*>& getIDIdentifierMap() { return Identifier::getIDIdentifierMapIntern(); }
    214             /// Returns a const_iterator to the beginning of the map that stores all Identifiers with their IDs.
    215             static inline std::map<uint32_t, Identifier*>::const_iterator getIDIdentifierMapBegin() { return Identifier::getIDIdentifierMap().begin(); }
    216             /// Returns a const_iterator to the end of the map that stores all Identifiers with their IDs.
    217             static inline std::map<uint32_t, Identifier*>::const_iterator getIDIdentifierMapEnd() { return Identifier::getIDIdentifierMap().end(); }
    218183
    219184
     
    259224            virtual ~Identifier();
    260225
    261             static Identifier* getIdentifierSingleton(const std::string& name, Identifier* proposal);
    262226            virtual void createSuperFunctionCaller() const = 0;
    263227
    264228            void initializeClassHierarchy(std::set<const Identifier*>* parents, bool bRootClass);
    265 
    266             /// Returns the map that stores all Identifiers with their names.
    267             static std::map<std::string, Identifier*>& getStringIdentifierMapIntern();
    268             /// Returns the map that stores all Identifiers with their names in lowercase.
    269             static std::map<std::string, Identifier*>& getLowercaseStringIdentifierMapIntern();
    270             /// Returns the map that stores all Identifiers with their network IDs.
    271             static std::map<uint32_t, Identifier*>& getIDIdentifierMapIntern();
    272229
    273230            /// Returns the children of the class the Identifier belongs to.
     
    279236
    280237        private:
    281             /// Increases the hierarchyCreatingCounter_s variable, causing all new objects to store their parents.
    282             inline static void startCreatingHierarchy() { hierarchyCreatingCounter_s++; }
    283             /// Decreases the hierarchyCreatingCounter_s variable, causing the objects to stop storing their parents.
    284             inline static void stopCreatingHierarchy()  { hierarchyCreatingCounter_s--; }
    285 
    286             static std::map<std::string, Identifier*>& getTypeIDIdentifierMap();
    287 
    288238            void initialize(std::set<const Identifier*>* parents);
    289239
     
    299249            std::string name_;                                             //!< The name of the class the Identifier belongs to
    300250            Factory* factory_;                                             //!< The Factory, able to create new objects of the given class (if available)
    301             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)
    302251            uint32_t networkID_;                                           //!< The network ID to identify a class through the network
    303252            const unsigned int classID_;                                   //!< Uniquely identifies a class (might not be the same as the networkID_)
    304             static unsigned int classIDCounter_s;                          //!< Static counter for the unique classIDs
    305253
    306254            bool bHasConfigValues_;                                        //!< True if this class has at least one assigned config value
     
    401349
    402350        // Get the entry from the map
    403         ClassIdentifier<T>::classIdentifier_s = (ClassIdentifier<T>*)Identifier::getIdentifierSingleton(name, proposal);
     351        ClassIdentifier<T>::classIdentifier_s = (ClassIdentifier<T>*)IdentifierManager::getIdentifierSingleton(name, proposal);
    404352
    405353        if (ClassIdentifier<T>::classIdentifier_s == proposal)
     
    428376
    429377        object->identifier_ = this;
    430         if (Identifier::isCreatingHierarchy())
     378        if (IdentifierManager::isCreatingHierarchy())
    431379        {
    432380            if (bRootClass && !object->parents_)
Note: See TracChangeset for help on using the changeset viewer.