Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-10-18 17:58:45 +0000
committerStijn Buys <ingar@osirion.org>2008-10-18 17:58:45 +0000
commit35613f0860a2d8cb643ca8de006de08503e48e53 (patch)
tree8a5436de643e818e68a82df2e5cb2df2145f5062 /src/core/module.cc
parentdb287e4a5133125bb6f25ba21ea97c47b19ac67f (diff)
example module
Diffstat (limited to 'src/core/module.cc')
-rw-r--r--src/core/module.cc24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/core/module.cc b/src/core/module.cc
index 319d651..eec250e 100644
--- a/src/core/module.cc
+++ b/src/core/module.cc
@@ -14,6 +14,8 @@ namespace core
/*-- static functions ----------------------------------------------*/
Module *Module::module_preload = 0;
+Module *Module::module_active = 0;
+
Module::Registry Module::module_registry;
Module *Module::find(const std::string &label)
@@ -60,7 +62,7 @@ Module *Module::load(const char *label)
return 0;
}
- con_print << " module" << module->label() << " " << module->name() << std::endl;
+ con_print << " module " << module->label() << " " << module->name() << std::endl;
module_preload = module;
return module;
}
@@ -88,11 +90,11 @@ void Module::list()
/*-- instance functions --------------------------------------------*/
-Module::Module(const char *label, const char *name) :
+Module::Module(const char *label, const char *name, bool interactive) :
module_label(label), module_name(name)
{
module_running = false;
- module_interactive = true;
+ module_interactive = interactive;
}
Module::~Module()
@@ -101,9 +103,25 @@ Module::~Module()
module_name.clear();
}
+void Module::run()
+{
+ module_active = this;
+ module_running = true;
+
+ init();
+}
+
+void Module::terminate()
+{
+ shutdown();
+ module_running = false;
+ module_active = 0;
+}
+
void Module::abort()
{
module_running = false;
+ module_active = 0;
}
}