Base class for the host that drives a Domain. More...
#include <kanzi/core.ui/domain/domain_controller.hpp>
Public Member Functions | |
| virtual ApplicationProperties | getApplicationProperties () const |
| Returns the ApplicationProperties of this host. | |
| virtual ApplicationProperties::PerformanceInfoLevel | getPerformanceInfoLevel () const |
| Returns the Performance HUD information level of this host. | |
| virtual Vector2 | getRenderingAreaOffset () const |
| Returns the offset applied as the arrange transformation of this host's Screen. | |
| virtual TextureSharedPtr | getRootCompositionTarget () const |
| Returns the root composition target of this host. | |
| virtual ScreenContainer | getScreens () const |
| Returns the Screens of this controller's host. | |
| virtual StartupProfilerRegistry & | getStartupProfilerRegistry () const |
| Returns the StartupProfilerRegistry of this host. | |
| virtual void | setPerformanceInfoLevel (ApplicationProperties::PerformanceInfoLevel level) |
| Sets the Performance HUD information level on this host. | |
Protected Member Functions | |
| void | attach (Domain &domain) |
| Wires this DomainController as the Domain's back-reference, so plugins can reach the host through Domain::getController(). | |
| void | detach (Domain &domain) |
Clears the Domain's back-reference, so Domain::getController() returns nullptr after this call. | |
| DomainController () | |
| virtual | ~DomainController () |
Destructor is protected so that the controller cannot be deleted through a Domain::getController() pointer; virtual so that the class is polymorphic for dynamic_cast and so subclass destructors run on polymorphic delete. | |
Base class for the host that drives a Domain.
A Domain holds a non-owning back-reference to its DomainController, accessible to plugins through Domain::getController(). Plugins reach host-specific state on a host-defined subclass through Domain::getController<T>(), which encapsulates the underlying dynamic_cast:
The controller-cast is for genuinely host-specific state — customer-defined methods and fields on a host subclass. Plugins should cache the cast result rather than re-cast per access.
DomainController also exposes virtual accessors for Domain-level capabilities whose state lives on the host. Each pairs with a delegating accessor on Domain that calls through the wired controller. Plugins read these through the Domain accessor, not by calling the virtual directly. Hosts override the virtual to expose host-side state; default implementations return empty/zero values for hosts that do not expose the capability. getStartupProfilerRegistry() is the one slot where the default is a real per-instance registry owned by this base class — a reference has no empty form, so the base provides a per-instance default rather than making the accessor pure virtual.
Application derives from DomainController, so any application built on the Kanzi Application framework exposes its host instance to plugins with no source-level change. Hosts that do not derive from Application derive from DomainController directly and call attach() during their initialization to expose host-specific state to plugins through the same mechanism.
|
explicitprotected |
|
protectedvirtual |
Destructor is protected so that the controller cannot be deleted through a Domain::getController() pointer; virtual so that the class is polymorphic for dynamic_cast and so subclass destructors run on polymorphic delete.
|
virtual |
Returns the Screens of this controller's host.
Single-screen hosts return their Screen as the only element. Multi-window hosts override this to enumerate every Screen they manage. The result is a snapshot taken at call time: Screens can attach and detach afterwards, so do not cache the result across frames.
Reimplemented in kanzi::Application.
Returns the offset applied as the arrange transformation of this host's Screen.
Reimplemented in kanzi::Application.
|
virtual |
Returns the root composition target of this host.
Reimplemented in kanzi::Application.
|
virtual |
Returns the ApplicationProperties of this host.
Reimplemented in kanzi::Application.
|
virtual |
Returns the Performance HUD information level of this host.
Reimplemented in kanzi::Application.
|
virtual |
Sets the Performance HUD information level on this host.
| level | The Performance HUD information level to apply. |
Reimplemented in kanzi::Application.
|
virtual |
Returns the StartupProfilerRegistry of this host.
The default returns a per-instance registry owned by this base class.
Wires this DomainController as the Domain's back-reference, so plugins can reach the host through Domain::getController().
Hosts call this once during their initialization, passing the Domain they own.
| domain | The Domain to attach this controller to. The controller must outlive the Domain, unless detach() is called first. |
Clears the Domain's back-reference, so Domain::getController() returns nullptr after this call.
Hosts call this during their teardown, before destroying the Domain, so plugins observing the Domain mid-shutdown see a clean "no controller wired" state instead of a partially-destructed host.
| domain | The Domain to detach this controller from. No-op if a different controller is currently wired. |