gfactory
Loading...
Searching...
No Matches
GFactoryBase Class Referenceabstract

Type-erased factory interface used by GManager. More...

#include <gfactory.h>

Public Member Functions

virtual ~GFactoryBase ()=default
 Virtual destructor for safe deletion through base pointer.
 
virtual void * Create ()=0
 Instantiate the concrete product.
 

Detailed Description

GManager stores factories for many unrelated types inside a single container. This is achieved by type-erasing the creation operation into Create(), which returns a raw pointer as void*.

Note
The returned pointer is owned by the caller of CreateObject(). The caller is responsible for deleting it (typically via a base-class pointer).

Definition at line 37 of file gfactory.h.

Constructor & Destructor Documentation

◆ ~GFactoryBase()

virtual GFactoryBase::~GFactoryBase ( )
virtualdefault

Member Function Documentation

◆ Create()

virtual void * GFactoryBase::Create ( )
pure virtual
Returns
A raw, heap-allocated object pointer cast to void*.
Warning
Ownership is transferred to the caller.

Implemented in GFactory< T >.


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