Owns factories and dynamically‑loaded libraries, providing run‑time creation.
More...
#include <gfactory.h>
|
| GManager (std::shared_ptr< GLogger > logger, std::string description="") |
| Construct with logger and a human‑readable name.
|
|
| GManager (const GManager &)=delete |
| No copy – the manager owns unique resources.
|
|
GManager & | operator= (const GManager &)=delete |
|
| GManager (GManager &&) noexcept=default |
| Allow move for container support.
|
|
GManager & | operator= (GManager &&) noexcept=default |
|
| ~GManager () |
|
template<class Derived > |
void | RegisterObjectFactory (std::string_view name) |
| Register a concrete factory under name .
|
|
template<class Base > |
Base * | CreateObject (std::string_view name) const |
| Create an instance of previously registered factory as Base* .
|
|
template<class T > |
T * | LoadAndRegisterObjectFromLibrary (std::string_view name, GOptions *gopts) |
| Load a shared library, look up its instantiate symbol, and return object.
|
|
void | clearDLMap () noexcept |
| Explicit cleanup (also called by destructor) – idempotent.
|
|
Usage pattern:
gemc::GManager mgr(log, "ShapeManager");
mgr.RegisterObjectFactory<Circle>("circle");
auto* c = mgr.CreateObject<
Shape>(
"circle");
delete c;
Definition at line 53 of file gfactory.h.
◆ GManager() [1/3]
GManager::GManager |
( |
std::shared_ptr< GLogger > | logger, |
|
|
std::string | description = "" ) |
|
inlineexplicit |
◆ GManager() [2/3]
◆ GManager() [3/3]
◆ ~GManager()
◆ clearDLMap()
void GManager::clearDLMap |
( |
| ) |
|
|
inlinenoexcept |
◆ CreateObject()
template<class Base >
Base * GManager::CreateObject |
( |
std::string_view | name | ) |
const |
◆ LoadAndRegisterObjectFromLibrary()
template<class T >
T * GManager::LoadAndRegisterObjectFromLibrary |
( |
std::string_view | name, |
|
|
GOptions * | gopts ) |
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ RegisterObjectFactory()
template<class Derived >
void GManager::RegisterObjectFactory |
( |
std::string_view | name | ) |
|
The documentation for this class was generated from the following file: