gfactory
Loading...
Searching...
No Matches
GFactory< T > Class Template Referencefinal

Concrete factory that creates objects of type T. More...

#include <gfactory.h>

Public Member Functions

 GFactory (const std::shared_ptr< GOptions > &gopts)
 Construct a factory bound to a specific configuration/options instance.
 
void * Create () override
 Allocate a new instance of T.
 
- Public Member Functions inherited from GFactoryBase
virtual ~GFactoryBase ()=default
 Virtual destructor for safe deletion through base pointer.
 

Detailed Description

template<class T>
class GFactory< T >

This factory assumes that T can be constructed from const std::shared_ptr<GOptions>&. The options object is captured at factory construction time and forwarded during instantiation.

Template Parameters
TConcrete type to allocate with new T(...).
Note
This class exists primarily to satisfy the GFactoryBase interface.

Definition at line 65 of file gfactory.h.

Constructor & Destructor Documentation

◆ GFactory()

template<class T >
GFactory< T >::GFactory ( const std::shared_ptr< GOptions > & gopts)
inlineexplicit
Parameters
goptsShared options/configuration object forwarded to each constructed instance.
Note
The factory stores a copy of the shared pointer; it does not take exclusive ownership.

Definition at line 75 of file gfactory.h.

Member Function Documentation

◆ Create()

template<class T >
void * GFactory< T >::Create ( )
inlineoverridevirtual
Returns
The newly allocated object as void* (caller owns it).

Implements GFactoryBase.

Definition at line 85 of file gfactory.h.


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