[Orxonox-commit 4972] r9641 - code/branches/core6/src/libraries/core/class
landauf at orxonox.net
landauf at orxonox.net
Sun Aug 11 21:33:11 CEST 2013
Author: landauf
Date: 2013-08-11 21:33:11 +0200 (Sun, 11 Aug 2013)
New Revision: 9641
Modified:
code/branches/core6/src/libraries/core/class/Identifier.cc
code/branches/core6/src/libraries/core/class/Identifier.h
code/branches/core6/src/libraries/core/class/IdentifierManager.cc
code/branches/core6/src/libraries/core/class/IdentifierManager.h
Log:
removed mutual friend declarations between Identifier and IdentifierManager
Modified: code/branches/core6/src/libraries/core/class/Identifier.cc
===================================================================
--- code/branches/core6/src/libraries/core/class/Identifier.cc 2013-08-11 19:07:38 UTC (rev 9640)
+++ code/branches/core6/src/libraries/core/class/Identifier.cc 2013-08-11 19:33:11 UTC (rev 9641)
@@ -49,7 +49,7 @@
@brief Constructor: No factory, no object created, new ObjectList and a unique networkID.
*/
Identifier::Identifier()
- : classID_(IdentifierManager::getInstance().classIDCounter_s++)
+ : classID_(IdentifierManager::getInstance().getUniqueClassId())
{
this->bCreatedOneObject_ = false;
this->bSetName_ = false;
@@ -154,9 +154,7 @@
{
this->name_ = name;
this->bSetName_ = true;
- IdentifierManager::getInstance().identifierByString_[name] = this;
- IdentifierManager::getInstance().identifierByLowercaseString_[getLowercase(name)] = this;
- IdentifierManager::getInstance().identifierByNetworkId_[this->networkID_] = this;
+ IdentifierManager::getInstance().registerIdentifier(this);
}
}
@@ -194,9 +192,8 @@
*/
void Identifier::setNetworkID(uint32_t id)
{
-// Identifier::getIDIdentifierMapIntern().erase(this->networkID_);
- IdentifierManager::getInstance().identifierByNetworkId_[id] = this;
this->networkID_ = id;
+ IdentifierManager::getInstance().registerIdentifier(this);
}
/**
Modified: code/branches/core6/src/libraries/core/class/Identifier.h
===================================================================
--- code/branches/core6/src/libraries/core/class/Identifier.h 2013-08-11 19:07:38 UTC (rev 9640)
+++ code/branches/core6/src/libraries/core/class/Identifier.h 2013-08-11 19:33:11 UTC (rev 9641)
@@ -105,9 +105,11 @@
*/
class _CoreExport Identifier
{
- friend class IdentifierManager;
-
public:
+ Identifier();
+ Identifier(const Identifier& identifier); // don't copy
+ virtual ~Identifier();
+
/// Returns the name of the class the Identifier belongs to.
inline const std::string& getName() const { return this->name_; }
void setName(const std::string& name);
@@ -208,10 +210,6 @@
protected:
- Identifier();
- Identifier(const Identifier& identifier); // don't copy
- virtual ~Identifier();
-
virtual void createSuperFunctionCaller() const = 0;
void initializeClassHierarchy(std::set<const Identifier*>* parents, bool bRootClass);
Modified: code/branches/core6/src/libraries/core/class/IdentifierManager.cc
===================================================================
--- code/branches/core6/src/libraries/core/class/IdentifierManager.cc 2013-08-11 19:07:38 UTC (rev 9640)
+++ code/branches/core6/src/libraries/core/class/IdentifierManager.cc 2013-08-11 19:33:11 UTC (rev 9641)
@@ -79,6 +79,16 @@
}
/**
+ * Registers the identifier in all maps of the IdentifierManager.
+ */
+ void IdentifierManager::registerIdentifier(Identifier* identifier)
+ {
+ IdentifierManager::getInstance().identifierByString_[identifier->getName()] = identifier;
+ IdentifierManager::getInstance().identifierByLowercaseString_[getLowercase(identifier->getName())] = identifier;
+ IdentifierManager::getInstance().identifierByNetworkId_[identifier->getNetworkID()] = identifier;
+ }
+
+ /**
@brief Creates the class-hierarchy by creating and destroying one object of each type.
*/
void IdentifierManager::createClassHierarchy()
Modified: code/branches/core6/src/libraries/core/class/IdentifierManager.h
===================================================================
--- code/branches/core6/src/libraries/core/class/IdentifierManager.h 2013-08-11 19:07:38 UTC (rev 9640)
+++ code/branches/core6/src/libraries/core/class/IdentifierManager.h 2013-08-11 19:33:11 UTC (rev 9641)
@@ -43,15 +43,19 @@
{
class _CoreExport IdentifierManager
{
- friend class Identifier;
- template <class T> friend class ClassIdentifier;
-
public:
static IdentifierManager& getInstance();
/////////////////////////////
////// Class Hierarchy //////
/////////////////////////////
+ Identifier* getIdentifierSingleton(const std::string& name, Identifier* proposal);
+
+ unsigned int getUniqueClassId()
+ { return this->classIDCounter_s++; }
+
+ void registerIdentifier(Identifier* identifier);
+
void createClassHierarchy();
/// Returns true, if a branch of the class-hierarchy is being created, causing all new objects to store their parents.
@@ -100,9 +104,6 @@
inline std::map<uint32_t, Identifier*>::const_iterator getIDIdentifierMapEnd()
{ return this->identifierByNetworkId_.end(); }
- protected:
- Identifier* getIdentifierSingleton(const std::string& name, Identifier* proposal);
-
private:
IdentifierManager();
IdentifierManager(const IdentifierManager&);
More information about the Orxonox-commit
mailing list