Kanzi 4.1.0
kanzi::DomainController Class Reference

Base class for the host that drives a Domain. More...

#include <kanzi/core.ui/domain/domain_controller.hpp>

Inheritance diagram for kanzi::DomainController:
[legend]

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 StartupProfilerRegistrygetStartupProfilerRegistry () 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.
 

Detailed Description

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:

if (auto* myApp = domain->getController<MyApplication>())
{
myApp->customState();
}
string logArgumentToString(const JNIError &jniError)
Used by logging system to convert legacy exception type objects to string.
Definition jni_error.hpp:25

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.

See also
Domain::getController()
Since
Kanzi 4.1.0

Constructor & Destructor Documentation

◆ DomainController()

kanzi::DomainController::DomainController ( )
explicitprotected

◆ ~DomainController()

virtual kanzi::DomainController::~DomainController ( )
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.

Member Function Documentation

◆ getScreens()

virtual ScreenContainer kanzi::DomainController::getScreens ( ) const
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.

Returns
The Screens that the host exposes, or an empty container if the host has none.
See also
Domain::getScreens()
Since
Kanzi 4.1.0

Reimplemented in kanzi::Application.

◆ getRenderingAreaOffset()

virtual Vector2 kanzi::DomainController::getRenderingAreaOffset ( ) const
virtual

Returns the offset applied as the arrange transformation of this host's Screen.

Returns
The offset, or a zero vector if the host does not apply one.
See also
Domain::getRenderingAreaOffset()
Since
Kanzi 4.1.0

Reimplemented in kanzi::Application.

◆ getRootCompositionTarget()

virtual TextureSharedPtr kanzi::DomainController::getRootCompositionTarget ( ) const
virtual

Returns the root composition target of this host.

Returns
Shared pointer to the root composition target, or an empty pointer if the host does not have one.
See also
Domain::getRootCompositionTarget()
Since
Kanzi 4.1.0

Reimplemented in kanzi::Application.

◆ getApplicationProperties()

virtual ApplicationProperties kanzi::DomainController::getApplicationProperties ( ) const
virtual

Returns the ApplicationProperties of this host.

Returns
Copy of the host's ApplicationProperties, or a default-constructed instance if the host does not expose them.
See also
Domain::getApplicationProperties()
Since
Kanzi 4.1.0

Reimplemented in kanzi::Application.

◆ getPerformanceInfoLevel()

virtual ApplicationProperties::PerformanceInfoLevel kanzi::DomainController::getPerformanceInfoLevel ( ) const
virtual

Returns the Performance HUD information level of this host.

Returns
The Performance HUD information level, or PerformanceInfoLevelDisabled if the host does not expose one.
See also
Domain::getPerformanceInfoLevel(), setPerformanceInfoLevel()
Since
Kanzi 4.1.0

Reimplemented in kanzi::Application.

◆ setPerformanceInfoLevel()

virtual void kanzi::DomainController::setPerformanceInfoLevel ( ApplicationProperties::PerformanceInfoLevel level)
virtual

Sets the Performance HUD information level on this host.

Parameters
levelThe Performance HUD information level to apply.
See also
Domain::setPerformanceInfoLevel(), getPerformanceInfoLevel()
Since
Kanzi 4.1.0

Reimplemented in kanzi::Application.

◆ getStartupProfilerRegistry()

virtual StartupProfilerRegistry & kanzi::DomainController::getStartupProfilerRegistry ( ) const
virtual

Returns the StartupProfilerRegistry of this host.

The default returns a per-instance registry owned by this base class.

Returns
Reference to the host's StartupProfilerRegistry.
See also
Domain::getStartupProfilerRegistry()
Since
Kanzi 4.1.0

◆ attach()

void kanzi::DomainController::attach ( Domain & domain)
protected

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.

Parameters
domainThe Domain to attach this controller to. The controller must outlive the Domain, unless detach() is called first.
See also
detach()
Since
Kanzi 4.1.0

◆ detach()

void kanzi::DomainController::detach ( Domain & domain)
protected

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.

Parameters
domainThe Domain to detach this controller from. No-op if a different controller is currently wired.
See also
attach()
Since
Kanzi 4.1.0

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