[Orxonox-commit 5860] r10520 - in code/branches/core7/src: libraries/core libraries/core/class libraries/core/command libraries/core/commandline libraries/core/singleton libraries/network orxonox/gamestates
landauf at orxonox.net
landauf at orxonox.net
Sun May 31 11:54:06 CEST 2015
Author: landauf
Date: 2015-05-31 11:54:06 +0200 (Sun, 31 May 2015)
New Revision: 10520
Modified:
code/branches/core7/src/libraries/core/Core.cc
code/branches/core7/src/libraries/core/CoreIncludes.h
code/branches/core7/src/libraries/core/class/IdentifierManager.cc
code/branches/core7/src/libraries/core/class/IdentifierManager.h
code/branches/core7/src/libraries/core/command/ConsoleCommand.cc
code/branches/core7/src/libraries/core/command/ConsoleCommandIncludes.h
code/branches/core7/src/libraries/core/command/ConsoleCommandManager.cc
code/branches/core7/src/libraries/core/command/ConsoleCommandManager.h
code/branches/core7/src/libraries/core/commandline/CommandLineIncludes.h
code/branches/core7/src/libraries/core/commandline/CommandLineParser.cc
code/branches/core7/src/libraries/core/commandline/CommandLineParser.h
code/branches/core7/src/libraries/core/singleton/ScopedSingletonIncludes.h
code/branches/core7/src/libraries/network/NetworkFunctionIncludes.h
code/branches/core7/src/libraries/network/NetworkFunctionManager.cc
code/branches/core7/src/libraries/network/NetworkFunctionManager.h
code/branches/core7/src/orxonox/gamestates/GSRoot.cc
Log:
StaticallyInitializedInstances are now responsible to delete the wrapped object.
Modified: code/branches/core7/src/libraries/core/Core.cc
===================================================================
--- code/branches/core7/src/libraries/core/Core.cc 2015-05-31 09:26:33 UTC (rev 10519)
+++ code/branches/core7/src/libraries/core/Core.cc 2015-05-31 09:54:06 UTC (rev 10520)
@@ -240,9 +240,7 @@
safeObjectDelete(&config_);
safeObjectDelete(&languageInstance_);
safeObjectDelete(&configFileManager_);
- ConsoleCommandManager::getInstance().destroyAll();
Context::setRootContext(NULL);
- IdentifierManager::getInstance().destroyAllIdentifiers();
safeObjectDelete(&signalHandler_);
// if (this->rootModule_)
// this->rootModule_->unloadAllStaticallyInitializedInstances();
Modified: code/branches/core7/src/libraries/core/CoreIncludes.h
===================================================================
--- code/branches/core7/src/libraries/core/CoreIncludes.h 2015-05-31 09:26:33 UTC (rev 10519)
+++ code/branches/core7/src/libraries/core/CoreIncludes.h 2015-05-31 09:54:06 UTC (rev 10520)
@@ -225,6 +225,7 @@
public:
StaticallyInitializedIdentifier(Identifier* identifier) : identifier_(identifier) {}
+ ~StaticallyInitializedIdentifier() { delete identifier_; }
virtual void load()
{
Modified: code/branches/core7/src/libraries/core/class/IdentifierManager.cc
===================================================================
--- code/branches/core7/src/libraries/core/class/IdentifierManager.cc 2015-05-31 09:26:33 UTC (rev 10519)
+++ code/branches/core7/src/libraries/core/class/IdentifierManager.cc 2015-05-31 09:54:06 UTC (rev 10520)
@@ -276,18 +276,4 @@
{
this->identifierByNetworkId_.clear();
}
-
- /**
- @brief Destroys all Identifiers. Called when exiting the program.
- */
- void IdentifierManager::destroyAllIdentifiers()
- {
- for (std::set<Identifier*>::iterator it = this->identifiers_.begin(); it != this->identifiers_.end(); ++it)
- delete (*it);
-
- this->identifiers_.clear();
- this->identifierByString_.clear();
- this->identifierByLowercaseString_.clear();
- this->identifierByNetworkId_.clear();
- }
}
Modified: code/branches/core7/src/libraries/core/class/IdentifierManager.h
===================================================================
--- code/branches/core7/src/libraries/core/class/IdentifierManager.h 2015-05-31 09:26:33 UTC (rev 10519)
+++ code/branches/core7/src/libraries/core/class/IdentifierManager.h 2015-05-31 09:54:06 UTC (rev 10520)
@@ -86,8 +86,6 @@
inline const std::map<uint32_t, Identifier*>& getIdentifierByNetworkIdMap()
{ return this->identifierByNetworkId_; }
- void destroyAllIdentifiers();
-
private:
IdentifierManager();
IdentifierManager(const IdentifierManager&);
Modified: code/branches/core7/src/libraries/core/command/ConsoleCommand.cc
===================================================================
--- code/branches/core7/src/libraries/core/command/ConsoleCommand.cc 2015-05-31 09:26:33 UTC (rev 10519)
+++ code/branches/core7/src/libraries/core/command/ConsoleCommand.cc 2015-05-31 09:54:06 UTC (rev 10520)
@@ -91,7 +91,6 @@
*/
ConsoleCommand::~ConsoleCommand()
{
- ConsoleCommandManager::getInstance().unregisterCommand(this);
}
/**
Modified: code/branches/core7/src/libraries/core/command/ConsoleCommandIncludes.h
===================================================================
--- code/branches/core7/src/libraries/core/command/ConsoleCommandIncludes.h 2015-05-31 09:26:33 UTC (rev 10519)
+++ code/branches/core7/src/libraries/core/command/ConsoleCommandIncludes.h 2015-05-31 09:54:06 UTC (rev 10520)
@@ -310,6 +310,7 @@
{
public:
StaticallyInitializedConsoleCommand(ConsoleCommand* command) : command_(command) {}
+ ~StaticallyInitializedConsoleCommand() { delete command_; }
virtual void load();
virtual void unload();
Modified: code/branches/core7/src/libraries/core/command/ConsoleCommandManager.cc
===================================================================
--- code/branches/core7/src/libraries/core/command/ConsoleCommandManager.cc 2015-05-31 09:26:33 UTC (rev 10519)
+++ code/branches/core7/src/libraries/core/command/ConsoleCommandManager.cc 2015-05-31 09:54:06 UTC (rev 10520)
@@ -190,14 +190,4 @@
++it_group;
}
}
-
- /**
- @brief Deletes all commands
- */
- void ConsoleCommandManager::destroyAll()
- {
- // delete entries until the map is empty
- while (!this->commandMap_.empty() && !this->commandMap_.begin()->second.empty())
- delete this->commandMap_.begin()->second.begin()->second;
- }
}
Modified: code/branches/core7/src/libraries/core/command/ConsoleCommandManager.h
===================================================================
--- code/branches/core7/src/libraries/core/command/ConsoleCommandManager.h 2015-05-31 09:26:33 UTC (rev 10519)
+++ code/branches/core7/src/libraries/core/command/ConsoleCommandManager.h 2015-05-31 09:54:06 UTC (rev 10520)
@@ -67,8 +67,6 @@
ConsoleCommand* getCommand(const std::string& group, const std::string& name, bool bPrintError = false);
ConsoleCommand* getCommandLC(const std::string& group, const std::string& name, bool bPrintError = false);
- void destroyAll();
-
private:
std::map<std::string, std::map<std::string, ConsoleCommand*> > commandMap_;
std::map<std::string, std::map<std::string, ConsoleCommand*> > commandMapLC_;
Modified: code/branches/core7/src/libraries/core/commandline/CommandLineIncludes.h
===================================================================
--- code/branches/core7/src/libraries/core/commandline/CommandLineIncludes.h 2015-05-31 09:26:33 UTC (rev 10519)
+++ code/branches/core7/src/libraries/core/commandline/CommandLineIncludes.h 2015-05-31 09:54:06 UTC (rev 10520)
@@ -58,6 +58,7 @@
{
public:
StaticallyInitializedCommandLineArgument(CommandLineArgument* argument) : argument_(argument) {}
+ ~StaticallyInitializedCommandLineArgument() { delete argument_; }
virtual void load()
{ CommandLineParser::addArgument(this->argument_); }
Modified: code/branches/core7/src/libraries/core/commandline/CommandLineParser.cc
===================================================================
--- code/branches/core7/src/libraries/core/commandline/CommandLineParser.cc 2015-05-31 09:26:33 UTC (rev 10519)
+++ code/branches/core7/src/libraries/core/commandline/CommandLineParser.cc 2015-05-31 09:54:06 UTC (rev 10520)
@@ -84,7 +84,6 @@
*/
CommandLineParser::~CommandLineParser()
{
- CommandLineParser::destroyAllArguments();
}
/**
@@ -97,19 +96,6 @@
return instance;
}
- /**
- @brief
- Destroys all command line arguments. This should be called at the end
- of main. Do not use before that.
- */
- void CommandLineParser::destroyAllArguments()
- {
- for (std::map<std::string, CommandLineArgument*>::const_iterator it = _getInstance().cmdLineArgs_.begin();
- it != _getInstance().cmdLineArgs_.end(); ++it)
- delete it->second;
- _getInstance().cmdLineArgs_.clear();
- }
-
/** Parses the command line string for arguments and stores these.
@note
The reason that you have to provide the string to be parsed as
Modified: code/branches/core7/src/libraries/core/commandline/CommandLineParser.h
===================================================================
--- code/branches/core7/src/libraries/core/commandline/CommandLineParser.h 2015-05-31 09:26:33 UTC (rev 10519)
+++ code/branches/core7/src/libraries/core/commandline/CommandLineParser.h 2015-05-31 09:54:06 UTC (rev 10520)
@@ -160,8 +160,6 @@
return !(it == _getInstance().cmdLineArgs_.end());
}
- static void destroyAllArguments();
-
static void generateDoc(std::ofstream& file);
private:
Modified: code/branches/core7/src/libraries/core/singleton/ScopedSingletonIncludes.h
===================================================================
--- code/branches/core7/src/libraries/core/singleton/ScopedSingletonIncludes.h 2015-05-31 09:26:33 UTC (rev 10519)
+++ code/branches/core7/src/libraries/core/singleton/ScopedSingletonIncludes.h 2015-05-31 09:54:06 UTC (rev 10520)
@@ -83,6 +83,7 @@
: wrapper_(wrapper)
, scope_(scope)
{}
+ ~StaticallyInitializedScopedSingletonWrapper() { delete wrapper_; }
virtual void load();
virtual void unload();
Modified: code/branches/core7/src/libraries/network/NetworkFunctionIncludes.h
===================================================================
--- code/branches/core7/src/libraries/network/NetworkFunctionIncludes.h 2015-05-31 09:26:33 UTC (rev 10519)
+++ code/branches/core7/src/libraries/network/NetworkFunctionIncludes.h 2015-05-31 09:54:06 UTC (rev 10520)
@@ -51,6 +51,7 @@
{
public:
StaticallyInitializedNetworkFunction(NetworkFunctionBase* function) : function_(function) {}
+ ~StaticallyInitializedNetworkFunction() { delete function_; }
virtual void load();
virtual void unload();
Modified: code/branches/core7/src/libraries/network/NetworkFunctionManager.cc
===================================================================
--- code/branches/core7/src/libraries/network/NetworkFunctionManager.cc 2015-05-31 09:26:33 UTC (rev 10519)
+++ code/branches/core7/src/libraries/network/NetworkFunctionManager.cc 2015-05-31 09:54:06 UTC (rev 10520)
@@ -53,13 +53,6 @@
this->functorMap_.erase(function->getPointer());
}
- void NetworkFunctionManager::destroyAllNetworkFunctions()
- {
- std::set<NetworkFunctionBase*>::iterator it;
- for (it = this->functions_.begin(); it != this->functions_.end(); ++it)
- delete (*it);
- }
-
NetworkFunctionBase* NetworkFunctionManager::getFunctionByName(const std::string& name)
{
std::map<std::string, NetworkFunctionBase*>::iterator it = nameMap_.find(name);
Modified: code/branches/core7/src/libraries/network/NetworkFunctionManager.h
===================================================================
--- code/branches/core7/src/libraries/network/NetworkFunctionManager.h 2015-05-31 09:26:33 UTC (rev 10519)
+++ code/branches/core7/src/libraries/network/NetworkFunctionManager.h 2015-05-31 09:54:06 UTC (rev 10520)
@@ -45,8 +45,6 @@
void registerFunction(NetworkFunctionBase* function);
void unregisterFunction(NetworkFunctionBase* function);
- void destroyAllNetworkFunctions();
-
inline const std::set<NetworkFunctionBase*>& getAllFunctions()
{ return functions_; }
Modified: code/branches/core7/src/orxonox/gamestates/GSRoot.cc
===================================================================
--- code/branches/core7/src/orxonox/gamestates/GSRoot.cc 2015-05-31 09:26:33 UTC (rev 10519)
+++ code/branches/core7/src/orxonox/gamestates/GSRoot.cc 2015-05-31 09:54:06 UTC (rev 10520)
@@ -34,7 +34,6 @@
#include "core/GameMode.h"
#include "core/command/ConsoleCommandIncludes.h"
#include "network/NetworkFunctionIncludes.h"
-#include "network/NetworkFunctionManager.h"
#include "tools/Timer.h"
#include "tools/interfaces/Tickable.h"
@@ -68,7 +67,6 @@
GSRoot::~GSRoot()
{
- NetworkFunctionManager::getInstance().destroyAllNetworkFunctions();
}
void GSRoot::printObjects()
More information about the Orxonox-commit
mailing list