Lumiera  0.pre.03
»edityourfreedom«
NotificationService Class Reference

#include "gui/notification-service.hpp"

Description

Actual implementation of the GuiNotification service within the Lumiera GTK GUI.

Creating an instance of this class automatically registers the interface with the Lumiera Interface/Plugin system and creates a forwarding proxy within the application core to route calls through this interface.

Note
the ctor of this class establishes an "up-link" connection to the UI-Bus, which enables the service implementation to talk to other facilities within the UI.

Definition at line 75 of file notification-service.hpp.

Public Member Functions

 NotificationService (ctrl::BusTerm &upLink, ctrl::UiManager &uiManager)
 When started, NotificationService connects to the UI-Bus via the provided connection. More...
 
 ~NotificationService ()
 
void displayInfo (NotifyLevel, string const &text) override
 push a user visible notification text More...
 
void markError (ID uiElement, string const &text) override
 
void markNote (ID uiElement, string const &text) override
 
void mutate (ID uiElement, MutationMessage &&) override
 
void triggerGuiShutdown (string const &cause) override
 causes the GUI to shut down unconditionally More...
 
- Public Member Functions inherited from GuiNotification
virtual void markError (ID uiElement, string const &text)=0
 highlight an element in the UI as problem location More...
 
virtual void markNote (ID uiElement, string const &text)=0
 attach an warning or state information element More...
 
virtual void mutate (ID uiElement, MutationMessage &&)=0
 push a diff message up into the user interface. More...
 
- Public Member Functions inherited from BusTerm
 BusTerm (BusTerm &&)=default
 may be moved, but not copied, due to the embedded identity More...
 
virtual ~BusTerm ()
 this is an interface More...
 
virtual void act (GenNode const &command)
 prepare or trigger invocation of a command. More...
 
BusTerm attach (ID, Tangible &newNode)
 Builder function: establish and wire a new BusTerm. More...
 
virtual bool change (ID subject, MutationMessage &&diff)
 alter and reshape the designated subject by applying the given diff message. More...
 
ID getID () const
 
virtual bool mark (ID subject, GenNode const &mark)
 route a state update or notification to the given subject. More...
 
virtual size_t markAll (GenNode const &mark)
 broadcast a notification message to all currently connected bus terminals. More...
 
virtual void note (ID subject, GenNode const &mark)
 capture and record a "state mark" for later replay for restoring UI state. More...
 
void note (GenNode const &mark)
 record state mark from this subject More...
 
virtual operator string () const
 

Private Types

using ServiceInstanceHandle = lumiera::InstanceHandle< LUMIERA_INTERFACE_INAME(lumieraorg_GuiNotification, 0), GuiNotification >
 

Private Member Functions

void dispatchMsg (ID, lib::diff::GenNode &&)
 

Private Attributes

std::unique_ptr< ctrl::UiDispatcherdispatch_
 
ServiceInstanceHandle serviceInstance_
 
ctrl::UiManageruiManager_
 

Additional Inherited Members

- Public Types inherited from BusTerm
using ID = EntryID const &
 
- Static Public Attributes inherited from GuiNotification
static lib::Depend< GuiNotificationfacade
 static storage for the facade access front-end More...
 
- Protected Types inherited from BusTerm
using EntryID = lib::idi::BareEntryID
 
using Tangible = gui::model::Tangible
 
- Protected Member Functions inherited from GuiNotification
virtual ~GuiNotification ()
 this is an interface More...
 
- Protected Member Functions inherited from BusTerm
 BusTerm (ID identity, BusTerm &attached_to)
 
bool isShortCircuit (ID) const noexcept
 
virtual BusTermrouteAdd (ID, Tangible &)
 
virtual void routeDetach (ID) noexcept
 
- Protected Attributes inherited from BusTerm
EntryID endpointID_
 
BusTermtheBus_
 

Member Typedef Documentation

◆ ServiceInstanceHandle

using ServiceInstanceHandle = lumiera::InstanceHandle< LUMIERA_INTERFACE_INAME(lumieraorg_GuiNotification, 0) , GuiNotification >
private

Definition at line 90 of file notification-service.hpp.

Constructor & Destructor Documentation

◆ ~NotificationService()

Definition at line 293 of file notification-service.cpp.

◆ NotificationService()

NotificationService ( ctrl::BusTerm upLink,
ctrl::UiManager uiManager 
)

When started, NotificationService connects to the UI-Bus via the provided connection.

This is a simple, unidirectional up-link connection, without actively adding NotificationService into the routing tables in [Nexus]. Yet this simple connection is sufficient to implement this service by talking to other facilities within the UI layer.

Remarks
internally this service relies on a UiDispatcher queue to hand over any invocations into the GTK event loop thread.

Definition at line 283 of file notification-service.cpp.

References NotificationService::dispatch_, NotificationService::displayInfo(), LUMIERA_INTERFACE_REF, gui::NOTE_ERROR, NotificationService::serviceInstance_, and NotificationService::uiManager_.

+ Here is the call graph for this function:

Member Function Documentation

◆ dispatchMsg()

void dispatchMsg ( ID  uiElement,
lib::diff::GenNode &&  uiMessage 
)
private

helper to move a given UI-Bus message (GenNode) into the closure of an event-lambda, which then is handed over to the UI event thread through the dispatcher queue.

Definition at line 83 of file notification-service.cpp.

References NotificationService::dispatch_, and BusTerm::mark().

Referenced by NotificationService::markError(), and NotificationService::markNote().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ displayInfo()

void displayInfo ( NotifyLevel  ,
string const &  text 
)
overridevirtual

push a user visible notification text

Implements GuiNotification.

Definition at line 93 of file notification-service.cpp.

References util::cStr(), and Wizard::getErrorLogID().

Referenced by NotificationService::NotificationService(), and NotificationService::triggerGuiShutdown().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ markError()

void markError ( ID  uiElement,
string const &  text 
)
override

Definition at line 103 of file notification-service.cpp.

References NotificationService::dispatchMsg().

Referenced by NotificationService::triggerGuiShutdown().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ markNote()

void markNote ( ID  uiElement,
string const &  text 
)
override

Definition at line 110 of file notification-service.cpp.

References NotificationService::dispatchMsg().

Referenced by NotificationService::triggerGuiShutdown().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutate()

void mutate ( ID  uiElement,
MutationMessage &&  diff 
)
override

Definition at line 117 of file notification-service.cpp.

References BusTerm::change(), NotificationService::dispatch_, and util::unConst().

Referenced by NotificationService::triggerGuiShutdown().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ triggerGuiShutdown()

void triggerGuiShutdown ( string const &  cause)
overridevirtual

causes the GUI to shut down unconditionally

Parameters
causeuser visible explanation of the reason causing this shutdown
Warning
since the UI is a subsystem, this call eventually terminates the whole application.

Implements GuiNotification.

Definition at line 128 of file notification-service.cpp.

References util::cStr(), NotificationService::dispatch_, NotificationService::displayInfo(), LERR_, lumiera_error_set(), LUMIERA_INTERFACE_EXPERIMENTAL, LUMIERA_INTERFACE_INSTANCE, LUMIERA_INTERFACE_REF, NotificationService::markError(), NotificationService::markNote(), NotificationService::mutate(), gui::NOTE_ERROR, NULL, UiManager::terminateUI(), and NotificationService::uiManager_.

+ Here is the call graph for this function:

Member Data Documentation

◆ dispatch_

◆ uiManager_

◆ serviceInstance_

ServiceInstanceHandle serviceInstance_
private

Definition at line 91 of file notification-service.hpp.

Referenced by NotificationService::NotificationService().

+ Inheritance diagram for NotificationService:
+ Collaboration diagram for NotificationService:

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