A Stride<SharedLibrary, Ts...> : a loaded dll IS a row, a contract (Ts...) IS a column, a module is the cell where they meet.
More...
|
| bool | Load (const std::string &path, const std::string &key) |
| | Opens the dll, adds its row, fills the columns it provides.
|
| |
| void | Unload (const std::string &key) |
| | Clears this row's columns AND its identity, which closes the dll. One call, nothing left to tidy up.
|
| |
| std::optional< Entity > | Find (const std::string &key) const |
| | The row named by this key, or nothing.
|
| |
| template<typename T > |
| T * | Get (const std::string &key) |
| | The T module of the library named by this key, or nullptr.
|
| |
| template<typename T > |
| T * | Get (Entity e) |
| | The T module of this exact row, or nullptr.
|
| |
| SharedLibrary * | Get (Entity e) |
| | The SharedLibrary of this exact row, or nullptr.
|
| |
| template<typename T > |
| std::vector< T * > | GetAll () |
| | Every library providing T.
|
| |
| std::vector< IModule * > | GetAllByKey (const std::string &key) override |
| | Every module the library named by this key provides.
|
| |
| std::vector< IModule * > | GetAll () override |
| | Every module of every loaded library.
|
| |
| IModule * | Get (const std::string &type, const std::string &key) override |
| | La case, par deux chaines. Impose par IModuleRegistry.
|
| |
| IModule * | Current (const std::string &type) override |
| | Le module en service pour ce contrat, ou nullptr.
|
| |
| void | Select (const std::string &type, IModule *module) override |
| | L'hote declare son choix. Un seul par contrat.
|
| |
| std::vector< IModule * > | GetAllByType (const std::string &type) override |
| | La ligne, par chaine. Impose par IModuleRegistry.
|
| |
template<std::derived_from< IModule >... Ts>
class ModuleManager< Ts >
A Stride<SharedLibrary, Ts...> : a loaded dll IS a row, a contract (Ts...) IS a column, a module is the cell where they meet.
Two identifiers, one per axis, and nothing else :
- the KEY you passed to Load() names a row,
- the static type T names a column.
Both are yours. The manager never reads IModule::name() or type() — a module's identity is its position in the table, not something it declares about itself. IModule is only required so GetAllByKey(key) has a common base to hand a whole row back through.
ModuleManager<IGraphicModule, IWindowModule> modules;
modules.Load("./ray.so", "ray");
modules.Get<IGraphicModule>("ray"); // one, by contract and key
modules.GetAll<IGraphicModule>(); // every library providing it
modules.GetAllByKey("ray"); // everything "ray" provides
modules.Get<IGraphicModule>(e); // one, by row
modules.Get(e); // the SharedLibrary of this row
modules.Unload("ray"); // clears the row, closes the dll
template<std::derived_from< IModule >... Ts>
| IModule * ModuleManager< Ts >::Get |
( |
const std::string & |
type, |
|
|
const std::string & |
key |
|
) |
| |
|
inlineoverride |
La case, par deux chaines. Impose par IModuleRegistry.
SEUL endroit ou ce manager lit type(). Il ne s'en sert jamais pour son propre rangement - ses colonnes sont des types statiques. Il ne le lit que pour repondre a une question posee en chaines, par quelqu'un qui n'a pas les types sous la main.
O(colonnes) au lieu de O(1) : la voie rapide de ce manager reste Get<T>(cle).
- Parameters
-
- Returns
- IModule*