gfactory
GManager Class Reference

Owns factories and dynamically‑loaded libraries, providing run‑time creation. More...

#include <gfactory.h>

Collaboration diagram for GManager:
Collaboration graph

Public Member Functions

 GManager (std::shared_ptr< GLogger > logger, std::string description="")
 Construct with logger and a human‑readable name. More...
 
 GManager (const GManager &)=delete
 No copy – the manager owns unique resources. More...
 
GManageroperator= (const GManager &)=delete
 
 GManager (GManager &&) noexcept=default
 Allow move for container support. More...
 
GManageroperator= (GManager &&) noexcept=default
 
 ~GManager ()
 
template<class Derived >
void RegisterObjectFactory (std::string_view name)
 Register a concrete factory under name. More...
 
template<class Base >
Base * CreateObject (std::string_view name) const
 Create an instance of previously registered factory as Base*. More...
 
template<class T >
T * LoadAndRegisterObjectFromLibrary (std::string_view name, GOptions *gopts)
 Load a shared library, look up its instantiate symbol, and return object. More...
 
void clearDLMap () noexcept
 Explicit cleanup (also called by destructor) – idempotent. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ GManager() [1/3]

GManager::GManager ( std::shared_ptr< GLogger >  logger,
std::string  description = "" 
)
inlineexplicit

Definition at line 93 of file gfactory.h.

◆ GManager() [2/3]

GManager::GManager ( const GManager )
delete

◆ GManager() [3/3]

GManager::GManager ( GManager &&  )
defaultnoexcept

◆ ~GManager()

GManager::~GManager ( )
inline

Definition at line 99 of file gfactory.h.

Member Function Documentation

◆ clearDLMap()

void GManager::clearDLMap ( )
inlinenoexcept

Definition at line 104 of file gfactory.h.

◆ CreateObject()

template<class Base >
Base * GManager::CreateObject ( std::string_view  name) const

Definition at line 120 of file gfactory.h.

◆ LoadAndRegisterObjectFromLibrary()

template<class T >
T * GManager::LoadAndRegisterObjectFromLibrary ( std::string_view  name,
GOptions *  gopts 
)

Definition at line 131 of file gfactory.h.

◆ operator=() [1/2]

GManager& GManager::operator= ( const GManager )
delete

◆ operator=() [2/2]

GManager& GManager::operator= ( GManager &&  )
defaultnoexcept

◆ RegisterObjectFactory()

template<class Derived >
void GManager::RegisterObjectFactory ( std::string_view  name)

Definition at line 114 of file gfactory.h.


The documentation for this class was generated from the following file: