[Orxonox-commit 5744] r10404 - in code/branches/core7/src/libraries/core: . command commandline module
landauf at orxonox.net
landauf at orxonox.net
Sun Apr 26 20:47:52 CEST 2015
Author: landauf
Date: 2015-04-26 20:47:52 +0200 (Sun, 26 Apr 2015)
New Revision: 10404
Modified:
code/branches/core7/src/libraries/core/CoreIncludes.h
code/branches/core7/src/libraries/core/command/ConsoleCommandIncludes.cc
code/branches/core7/src/libraries/core/command/ConsoleCommandIncludes.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/module/ModuleInstance.cc
code/branches/core7/src/libraries/core/module/ModuleInstance.h
code/branches/core7/src/libraries/core/module/StaticallyInitializedInstance.h
Log:
added unload() function to StaticallyInitializedInstance
Modified: code/branches/core7/src/libraries/core/CoreIncludes.h
===================================================================
--- code/branches/core7/src/libraries/core/CoreIncludes.h 2015-04-26 14:16:49 UTC (rev 10403)
+++ code/branches/core7/src/libraries/core/CoreIncludes.h 2015-04-26 18:47:52 UTC (rev 10404)
@@ -245,6 +245,10 @@
this->identifier_->inheritsFrom(this->parents_[i]->getParent());
}
+ virtual void unload()
+ {
+ }
+
inline Identifier& getIdentifier()
{ return *this->identifier_; }
Modified: code/branches/core7/src/libraries/core/command/ConsoleCommandIncludes.cc
===================================================================
--- code/branches/core7/src/libraries/core/command/ConsoleCommandIncludes.cc 2015-04-26 14:16:49 UTC (rev 10403)
+++ code/branches/core7/src/libraries/core/command/ConsoleCommandIncludes.cc 2015-04-26 18:47:52 UTC (rev 10404)
@@ -36,4 +36,9 @@
{
ConsoleCommandManager::registerCommand(this->command_);
}
+
+ void StaticallyInitializedConsoleCommand::unload()
+ {
+ ConsoleCommandManager::unregisterCommand(this->command_);
+ }
}
Modified: code/branches/core7/src/libraries/core/command/ConsoleCommandIncludes.h
===================================================================
--- code/branches/core7/src/libraries/core/command/ConsoleCommandIncludes.h 2015-04-26 14:16:49 UTC (rev 10403)
+++ code/branches/core7/src/libraries/core/command/ConsoleCommandIncludes.h 2015-04-26 18:47:52 UTC (rev 10404)
@@ -312,6 +312,7 @@
StaticallyInitializedConsoleCommand(ConsoleCommand* command) : command_(command) {}
virtual void load();
+ virtual void unload();
inline ConsoleCommand& getCommand()
{ return *this->command_; }
Modified: code/branches/core7/src/libraries/core/commandline/CommandLineIncludes.h
===================================================================
--- code/branches/core7/src/libraries/core/commandline/CommandLineIncludes.h 2015-04-26 14:16:49 UTC (rev 10403)
+++ code/branches/core7/src/libraries/core/commandline/CommandLineIncludes.h 2015-04-26 18:47:52 UTC (rev 10404)
@@ -62,6 +62,9 @@
virtual void load()
{ CommandLineParser::addArgument(this->argument_); }
+ virtual void unload()
+ { CommandLineParser::removeArgument(this->argument_); }
+
inline CommandLineArgument& getArgument()
{ return *this->argument_; }
Modified: code/branches/core7/src/libraries/core/commandline/CommandLineParser.cc
===================================================================
--- code/branches/core7/src/libraries/core/commandline/CommandLineParser.cc 2015-04-26 14:16:49 UTC (rev 10403)
+++ code/branches/core7/src/libraries/core/commandline/CommandLineParser.cc 2015-04-26 18:47:52 UTC (rev 10404)
@@ -353,4 +353,12 @@
_getInstance().cmdLineArgs_[argument->getName()] = argument;
}
+
+ /**
+ * @brief Removes a CommandLineArgument from the internal map.
+ */
+ void CommandLineParser::removeArgument(CommandLineArgument* argument)
+ {
+ _getInstance().cmdLineArgs_.erase(argument->getName());
+ }
}
Modified: code/branches/core7/src/libraries/core/commandline/CommandLineParser.h
===================================================================
--- code/branches/core7/src/libraries/core/commandline/CommandLineParser.h 2015-04-26 14:16:49 UTC (rev 10403)
+++ code/branches/core7/src/libraries/core/commandline/CommandLineParser.h 2015-04-26 18:47:52 UTC (rev 10404)
@@ -150,7 +150,9 @@
{ *value = (T)(getArgument(name)->getValue()); }
static const MultiType& getValue(const std::string& name)
{ return getArgument(name)->getValue(); }
+
static void addArgument(CommandLineArgument* argument);
+ static void removeArgument(CommandLineArgument* argument);
static bool existsArgument(const std::string& name)
{
Modified: code/branches/core7/src/libraries/core/module/ModuleInstance.cc
===================================================================
--- code/branches/core7/src/libraries/core/module/ModuleInstance.cc 2015-04-26 14:16:49 UTC (rev 10403)
+++ code/branches/core7/src/libraries/core/module/ModuleInstance.cc 2015-04-26 18:47:52 UTC (rev 10404)
@@ -52,6 +52,12 @@
(*it)->load();
}
+ void ModuleInstance::unloadAllStaticallyInitializedInstances()
+ {
+ for (std::list<StaticallyInitializedInstance*>::iterator it = this->staticallyInitializedInstances_.begin(); it != this->staticallyInitializedInstances_.end(); ++it)
+ (*it)->unload();
+ }
+
void ModuleInstance::removeStaticallyInitializedInstance(StaticallyInitializedInstance* instance)
{
this->staticallyInitializedInstances_.remove(instance);
Modified: code/branches/core7/src/libraries/core/module/ModuleInstance.h
===================================================================
--- code/branches/core7/src/libraries/core/module/ModuleInstance.h 2015-04-26 14:16:49 UTC (rev 10403)
+++ code/branches/core7/src/libraries/core/module/ModuleInstance.h 2015-04-26 18:47:52 UTC (rev 10404)
@@ -42,6 +42,7 @@
void addStaticallyInitializedInstance(StaticallyInitializedInstance* instance);
void loadAllStaticallyInitializedInstances();
+ void unloadAllStaticallyInitializedInstances();
void removeStaticallyInitializedInstance(StaticallyInitializedInstance* instance);
static void setCurrentModuleInstance(ModuleInstance* instance);
Modified: code/branches/core7/src/libraries/core/module/StaticallyInitializedInstance.h
===================================================================
--- code/branches/core7/src/libraries/core/module/StaticallyInitializedInstance.h 2015-04-26 14:16:49 UTC (rev 10403)
+++ code/branches/core7/src/libraries/core/module/StaticallyInitializedInstance.h 2015-04-26 18:47:52 UTC (rev 10404)
@@ -40,6 +40,7 @@
virtual ~StaticallyInitializedInstance();
virtual void load() = 0;
+ virtual void unload() = 0;
};
}
More information about the Orxonox-commit
mailing list