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

Example base class used to demonstrate static factory registration. More...

#include <ShapeFactory.h>

Public Member Functions

 ~Shape () override=default
 Virtual destructor for polymorphic deletion.
 
 Shape (const std::shared_ptr< GOptions > &g)
 Construct the base with a shared options/configuration instance.
 
virtual void Area ()=0
 Compute or report the shape area (example API).
 
- Public Member Functions inherited from GBase< Shape >
 GBase (const std::shared_ptr< GOptions > &gopt, std::string logger_name="")
 
 GBase (const std::shared_ptr< GLogger > &logger)
 
 GBase (const GBase &)=default
 
 GBase (GBase &&) noexcept=default
 
virtual ~GBase ()
 
GBaseoperator= (const GBase &)=default
 
GBaseoperator= (GBase &&) noexcept=default
 

Additional Inherited Members

- Protected Attributes inherited from GBase< Shape >
std::shared_ptr< GLoggerlog
 

Detailed Description

In the example program, concrete shapes are registered directly with GManager because the application has compile-time access to both base and derived types.

Definition at line 16 of file ShapeFactory.h.

Constructor & Destructor Documentation

◆ ~Shape()

Shape::~Shape ( )
overridedefault

◆ Shape()

Shape::Shape ( const std::shared_ptr< GOptions > & g)
inlineexplicit
Parameters
gShared options object used to initialize logging via GBase.

Definition at line 27 of file ShapeFactory.h.

Member Function Documentation

◆ Area()

virtual void Shape::Area ( )
pure virtual

The example implementations print to stdout.

Implemented in Triangle, and Box.


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