Abstract factory for an ILayoutSource implementation.
More...
#include <phosphor-layout-api/include/PhosphorLayoutApi/ILayoutSourceFactory.h>
Public Member Functions | |
| virtual | ~ILayoutSourceFactory () |
| virtual QString | name () const =0 |
| Stable identifier for diagnostics / logging. | |
| virtual std::unique_ptr< ILayoutSource > | create ()=0 |
| Build a fresh source instance. Caller takes ownership. | |
Abstract factory for an ILayoutSource implementation.
Each provider library (phosphor-zones, phosphor-tiles, future phosphor-scrolling, third-party plugins) ships a concrete factory alongside its ILayoutSource implementation. The factory carries whatever provider-specific construction arguments the source requires (e.g. a borrowed registry pointer). Calling create hands the caller a fresh source instance bound to those arguments.
LayoutSourceBundle holds a list of factories and assembles a composite of every produced source. Composition roots register factories — adding a new layout-source family (the upcoming scrolling engine) is then one addFactory() line at each root, with no edits to phosphor-layout-api or to the bundle.
Factory contract: the same create() call must be safe to invoke repeatedly and from any thread the caller chooses; concrete factories are responsible for any thread-safety in their stored arguments. Returned sources are heap-owned by the caller (typically via std::unique_ptr).
|
virtual |
|
pure virtual |
Build a fresh source instance. Caller takes ownership.
Implemented in PhosphorTiles::AutotileLayoutSourceFactory, and PhosphorZones::ZonesLayoutSourceFactory.
|
pure virtual |
Stable identifier for diagnostics / logging.
Should match the provider library name (e.g. "zones", "autotile", "scrolling").
Implemented in PhosphorTiles::AutotileLayoutSourceFactory, and PhosphorZones::ZonesLayoutSourceFactory.