Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
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 61 of file subsys.hpp.

Public Types

typedef function< void(string *)> SigTerm
 

Public Member Functions

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

Private Member Functions

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

Private Attributes

std::vector< Subsys * > prereq_
 

Constructor & Destructor Documentation

◆ ~Subsys()

~Subsys ( )
virtual

Definition at line 36 of file subsys.cpp.

Member Typedef Documentation

◆ SigTerm

typedef function<void(string*)> SigTerm

Definition at line 65 of file subsys.hpp.

Member Function Documentation

◆ operator string()

virtual operator string ( ) const
pure virtual

◆ depends()

Subsys & depends ( Subsys prereq)

define a dependency to another Subsys required for running this subsystem

Definition at line 41 of file subsys.cpp.

References Subsys::prereq_.

Referenced by main().

+ Here is the caller graph for this function:

◆ isRunning()

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

Definition at line 50 of file subsys.cpp.

References Subsys::checkRunningState().

Referenced by SubsystemRunner::maybeRun(), SubsystemRunner::sigTerm(), and SubsystemRunner::triggerStartup().

+ Here is the call graph for this function:
+ Here is the caller 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 EngineSubsysDescriptor, NetNodeSubsysDescriptor, ScriptRunnerSubsysDescriptor, MockSys, GuiSubsysDescriptor, SessionSubsystem, and PlayOutSubsysDescriptor.

Referenced by SubsystemRunner::maybeRun().

+ Here is the caller graph for this function:

◆ 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 NetNodeSubsysDescriptor, ScriptRunnerSubsysDescriptor, EngineSubsysDescriptor, MockSys, GuiSubsysDescriptor, PlayOutSubsysDescriptor, and SessionSubsystem.

Referenced by SubsystemRunner::triggerStartup().

+ Here is the caller graph for this function:

◆ 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 GuiSubsysDescriptor, SessionSubsystem, PlayOutSubsysDescriptor, EngineSubsysDescriptor, NetNodeSubsysDescriptor, ScriptRunnerSubsysDescriptor, and MockSys.

Referenced by SubsystemRunner::shutdownAll(), and SubsystemRunner::triggerStartup().

+ Here is the caller graph for this function:

◆ getPrerequisites()

const std::vector< Subsys * > getPrerequisites ( )
inline

Definition at line 111 of file subsys.hpp.

References Subsys::prereq_.

Referenced by SubsystemRunner::triggerStartup().

+ Here is the caller graph for this function:

◆ 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 GuiSubsysDescriptor, SessionSubsystem, PlayOutSubsysDescriptor, EngineSubsysDescriptor, NetNodeSubsysDescriptor, ScriptRunnerSubsysDescriptor, and MockSys.

Referenced by Subsys::isRunning().

+ Here is the caller graph for this function:

Member Data Documentation

◆ prereq_

std::vector<Subsys*> prereq_
private

Definition at line 122 of file subsys.hpp.

Referenced by Subsys::depends(), and Subsys::getPrerequisites().

+ Inheritance diagram for Subsys:
+ Collaboration diagram for Subsys:

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