Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#5231: Change StaticModule implementation such that it doesn't immedi…
…ately register the statically enlisted modules. As long as we have the StaticModules, the ModuleRegistry will pick them up during loadAndInitialiseModules(), but ideally we wouldn't have any of these statically registered ones.
- Loading branch information
1 parent
1ce60d2
commit 40c73d7
Showing
6 changed files
with
97 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#include "StaticModule.h" | ||
|
||
#include <cassert> | ||
|
||
namespace module | ||
{ | ||
|
||
namespace internal | ||
{ | ||
|
||
StaticModuleList::~StaticModuleList() | ||
{ | ||
// We assume that the list instance is cleared by the time the | ||
// application is shut down | ||
assert(empty()); | ||
} | ||
|
||
void StaticModuleList::Add(const RegisterableModulePtr& module) | ||
{ | ||
Instance().push_back(module); | ||
} | ||
|
||
void StaticModuleList::ForEachModule(const std::function<void(const RegisterableModulePtr&)>& func) | ||
{ | ||
for (const auto& module : Instance()) | ||
{ | ||
func(module); | ||
} | ||
} | ||
|
||
void StaticModuleList::Clear() | ||
{ | ||
Instance().clear(); | ||
} | ||
|
||
StaticModuleList& StaticModuleList::Instance() | ||
{ | ||
static StaticModuleList _list; | ||
return _list; | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters