Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 4, 2015, 9:12:21 PM (9 years ago)
Author:
landauf
Message:

merged branch core7 back to trunk

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/libraries/core/class/IdentifierManager.h

    r9667 r10624  
    3939#include <map>
    4040#include <set>
     41#include <list>
    4142#include <string>
     43
     44#include "util/Singleton.h"
    4245
    4346namespace orxonox
    4447{
    45     class _CoreExport IdentifierManager
     48    class _CoreExport IdentifierManager : public Singleton<IdentifierManager>
    4649    {
     50        friend class Singleton<IdentifierManager>;
     51
    4752        public:
    48             static IdentifierManager& getInstance();
     53            IdentifierManager();
     54            ~IdentifierManager() {}
    4955
    50             Identifier* getGloballyUniqueIdentifier(Identifier* proposal);
    51             void addIdentifierToLookupMaps(Identifier* identifier);
    52 
    53             unsigned int getUniqueClassId()
    54                 { return this->classIDCounter_s++; }
     56            void addIdentifier(Identifier* identifier);
     57            void removeIdentifier(Identifier* identifier);
    5558
    5659
     
    5962            /////////////////////////////
    6063            void createClassHierarchy();
    61             void destroyAllIdentifiers();
     64            void verifyClassHierarchy(const std::set<Identifier*>& initializedIdentifiers);
     65            void destroyClassHierarchy();
    6266
    6367            void createdObject(Identifiable* identifiable);
     
    7478            Identifier* getIdentifierByLowercaseString(const std::string& name);
    7579            Identifier* getIdentifierByID(uint32_t id);
     80            Identifier* getIdentifierByTypeInfo(const std::type_info& typeInfo);
    7681
    7782            void clearNetworkIDs();
     
    8893
    8994        private:
    90             IdentifierManager();
    91             IdentifierManager(const IdentifierManager&);
    92             ~IdentifierManager() {}
     95            IdentifierManager(const IdentifierManager&); // not implemented
    9396
    9497            /// Increases the hierarchyCreatingCounter_s variable, causing all new objects to store their parents.
     
    99102                { hierarchyCreatingCounter_s--; }
    100103
    101             std::map<std::string, Identifier*> identifierByTypeidName_;      //!< Map with the names as received by typeid(). This is only used internally.
    102 
     104            std::set<Identifier*> identifiers_;                              //!< All identifiers. This is only used internally.
    103105            std::map<std::string, Identifier*> identifierByString_;          //!< Map that stores all Identifiers with their names.
    104106            std::map<std::string, Identifier*> identifierByLowercaseString_; //!< Map that stores all Identifiers with their names in lowercase.
     
    106108
    107109            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)
    108             std::set<const Identifier*> identifiersOfNewObject_;    //!< Used while creating the object hierarchy to keep track of the identifiers of a newly created object
    109             unsigned int classIDCounter_s;                          //!< counter for the unique classIDs
     110
     111            /// Used while creating the object hierarchy to keep track of the identifiers of a newly created object (and all other objects that get created as
     112            /// a consequence of this, e.g. nested member objects).
     113            std::map<Identifiable*, std::list<const Identifier*> > identifierTraceOfNewObject_;
     114            Identifier* recordTraceForIdentifier_; //!< The identifier for which we want to record the trace of identifiers during object creation. If null, no trace is recorded.
     115
     116            static IdentifierManager* singletonPtr_s;
    110117    };
    111118}
Note: See TracChangeset for help on using the changeset viewer.