modules.md 782 B

Modules {#modules}

[TOC]

A @ref bs::Module "Module" is a specialized form of singleton used for many of Banshee's systems. Unlike standard singletons it requires manual startup and shutdown. To use it for your own objects, simply inherit from it and provide your own class as its template parameter.

class MyModule : public Module<MyModule>
{ };

Use @ref bs::Module::startUp "Module::startUp()" to start it up. Once started use @ref bs::Module::instance "Module::instance()" to access its instance. Once done with it call @ref bs::Module::shutDown "Module::shutDown()" to release it.

MyModule::startUp();
MyModule::instance().doSomething();
MyModule::shutDown();