Lumiera  0.pre.03
»edit your freedom«
Subsys Class Referenceabstract

#include "common/subsys.hpp"

Description

Dependencies and lifecycle of a partially independent Subsystem of the Application.

Using such descriptors, AppState as activated from main() is able to pull up, maintain and shut down the primary parts of the Application.

Note
synchronisation is up to the implementor.

Definition at line 70 of file subsys.hpp.

Public Types

typedef function< void(string *)> SigTerm
 

Public Member Functions

Subsysdepends (Subsys &prereq)
 define a dependency to another Subsys required for running this subsystem
 
const std::vector< Subsys * > getPrerequisites ()
 
bool isRunning () noexcept
 
virtual operator string () const =0
 a human readable name
 
virtual bool shouldStart (lumiera::Option &)=0
 query application option state to determine if this subsystem should be activated. More...
 
virtual bool start (lumiera::Option &options, SigTerm)=0
 attempt to bring up this subsystem up. More...
 
virtual void triggerShutdown () noexcept=0
 initiate termination of this subsystem. More...
 

Private Member Functions

virtual bool checkRunningState () noexcept=0
 whether this subsystem is actually operational. More...
 
- Private Member Functions inherited from NonCopyable
 NonCopyable (NonCopyable const &)=delete
 
NonCopyableoperator= (NonCopyable const &)=delete
 

Private Attributes

std::vector< Subsys * > prereq_
 

Member Function Documentation

◆ isRunning()

bool isRunning ( )
noexcept
Returns
true if Up
Warning
must not block nor throw.

Definition at line 59 of file subsys.cpp.

References Subsys::checkRunningState().

+ Here is the call graph for this function:

◆ shouldStart()

virtual bool shouldStart ( lumiera::Option )
pure virtual

query application option state to determine if this subsystem should be activated.

Note
even if not started explicitly, it could still be started as prerequisite of another one

Implemented in MockSys, PlayOutSubsysDescriptor, GuiSubsysDescriptor, SessionSubsystem, DummyPlayerSubsysDescriptor, EngineSubsysDescriptor, ScriptRunnerSubsysDescriptor, and NetNodeSubsysDescriptor.

◆ start()

virtual bool start ( lumiera::Option options,
SigTerm   
)
pure virtual

attempt to bring up this subsystem up.

On return, the subsystem must be operational, according to checkRunningState(). Failure to start up usually terminates the whole application. When this subsystem ceases to work, it must ensure to activate the given callback signal.

Parameters
optionsmay be influencing the operation mode
SigTermto be signalled by the subsystem.
Warning
termination must be signalled reliably.
Returns
true if actually started.

Implemented in MockSys, GuiSubsysDescriptor, PlayOutSubsysDescriptor, SessionSubsystem, DummyPlayerSubsysDescriptor, EngineSubsysDescriptor, ScriptRunnerSubsysDescriptor, and NetNodeSubsysDescriptor.

◆ triggerShutdown()

virtual void triggerShutdown ( )
pure virtualnoexcept

initiate termination of this subsystem.

This trigger may be called repeatedly any time... When the subsystem actually has terminated, the SigTerm passed to start must be invoked.

Note
called within a locked context (barrier)
Warning
must not block nor throw.

Implemented in MockSys, GuiSubsysDescriptor, PlayOutSubsysDescriptor, DummyPlayerSubsysDescriptor, SessionSubsystem, EngineSubsysDescriptor, ScriptRunnerSubsysDescriptor, and NetNodeSubsysDescriptor.

◆ checkRunningState()

virtual bool checkRunningState ( )
privatepure virtualnoexcept

whether this subsystem is actually operational.

When returning false here, the application may terminate at any point without further notice Note further, that a subsystem must not be in running state when signalling termination.

Implemented in MockSys, GuiSubsysDescriptor, PlayOutSubsysDescriptor, DummyPlayerSubsysDescriptor, SessionSubsystem, EngineSubsysDescriptor, ScriptRunnerSubsysDescriptor, and NetNodeSubsysDescriptor.

Referenced by Subsys::isRunning().

+ Here is the caller graph for this function:
+ Inheritance diagram for Subsys:
+ Collaboration diagram for Subsys:

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