Owns factories and dynamically‑loaded libraries, providing run‑time creation.
More...
#include <gfactory.h>
|
| | GManager (const std::shared_ptr< GOptions > &gopt) |
| | 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 () override |
| |
| template<class Derived > |
| void | RegisterObjectFactory (std::string_view name) |
| | Register a concrete factory under a name.
|
| |
| template<class Derived > |
| void | RegisterObjectFactory (std::string_view name, const std::shared_ptr< GOptions > &gopts) |
| |
| template<class Base > |
| Base * | CreateObject (std::string_view name) const |
| | Create an instance of the previously registered factory.
|
| |
| template<class T > |
| std::shared_ptr< T > | LoadAndRegisterObjectFromLibrary (std::string_view name, const std::shared_ptr< 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 64 of file gfactory.h.
◆ GManager() [1/3]
| GManager::GManager |
( |
const std::shared_ptr< GOptions > & | gopt | ) |
|
|
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 >
| std::shared_ptr< T > GManager::LoadAndRegisterObjectFromLibrary |
( |
std::string_view | name, |
|
|
const std::shared_ptr< GOptions > & | gopts ) |
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ RegisterObjectFactory() [1/2]
template<class Derived >
| void GManager::RegisterObjectFactory |
( |
std::string_view | name | ) |
|
◆ RegisterObjectFactory() [2/2]
template<class Derived >
| void GManager::RegisterObjectFactory |
( |
std::string_view | name, |
|
|
const std::shared_ptr< GOptions > & | gopts ) |
The documentation for this class was generated from the following file: