gfactory
Loading...
Searching...
No Matches
ShapeFactory.h
Go to the documentation of this file.
1#pragma once
2
3// gemc
4#include "gbase.h"
5
6// gfactory
7#include "gfactory_options.h"
8
16class Shape : public GBase<Shape>
17{
18public:
20 ~Shape() override = default;
21
27 explicit Shape(const std::shared_ptr<GOptions>& g) : GBase(g, PLUGIN_LOGGER) {
28 }
29
35 virtual void Area() = 0;
36};
37
42class Triangle : public Shape
43{
44public:
46 using Shape::Shape;
47
49 void Area();
50};
51
56class Box : public Shape
57{
58public:
60 using Shape::Shape;
61
63 void Area();
64};
Example concrete Shape implementation used in static registration.
void Area()
Example implementation that prints a message.
Example base class used to demonstrate static factory registration.
~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).
Example concrete Shape implementation used in static registration.
void Area()
Example implementation that prints a message.
constexpr const char * PLUGIN_LOGGER
Logger channel used by the gfactory module and plugins loaded through it.