Hedgehog  0.0.0
A library to generate hybrid pipeline workflow systems
hh::GraphSignalHandler< GraphOutput, GraphInputs > Class Template Reference

Implements a signal handler to catch events such as termination and killing. More...

#include "graph_signal_handler.h"

Collaboration diagram for hh::GraphSignalHandler< GraphOutput, GraphInputs >:
Collaboration graph

Static Public Member Functions

static void handleSignal (int signum=SIGTERM)
 Function that handles signals. More...
 
static void atExit ()
 Create a dot file at exit if the instance still exist.
 
static void setColorScheme (ColorScheme scheme)
 Sets the color scheme for dot file generation. More...
 
static void setStructureOptions (StructureOptions options)
 Sets the structure options for dot file generation. More...
 
static void setDebugOptions (DebugOptions options)
 Sets the debug options for dot file generation. More...
 
static void registerGraph (Graph< GraphOutput, GraphInputs... > *graph)
 Registers a task graph to be displayed when a signal is fired. More...
 
static void registerSignal (int signum=SIGTERM, bool atExit=false)
 Registers a signal for handling. (default SIGTERM) More...
 

Static Private Attributes

static Graph< GraphOutput, GraphInputs... > * graphInstance_ = nullptr
 < The outer graph instance More...
 
static bool signalHandled_ = false
 Flag to indicate if a signal has been fired or not. More...
 
static ColorScheme colorScheme = ColorScheme::EXECUTION
 < The color scheme to use for graph dot file More...
 
static StructureOptions structureOptions = StructureOptions::ALL
 < The structure options to use for graph dot file More...
 
static DebugOptions debugOptions = DebugOptions::DEBUG
 < The debug options to use for graph dot file More...
 

Detailed Description

template<class GraphOutput, class ... GraphInputs>
class hh::GraphSignalHandler< GraphOutput, GraphInputs >

Implements a signal handler to catch events such as termination and killing.

Once a signal is caught, all task graphs that are registered with the signal handler will be written as a dot file. The dot file is output in the working directory with the name of the signal as a prefix and '<#>-graph-output.dot' as the suffix.

Template Parameters
GraphOutputGraph Output type
GraphInputsGraph Inputs type

Definition at line 37 of file graph_signal_handler.h.

Member Function Documentation

◆ handleSignal()

template<class GraphOutput , class ... GraphInputs>
static void hh::GraphSignalHandler< GraphOutput, GraphInputs >::handleSignal ( int  signum = SIGTERM)
inlinestatic

Function that handles signals.

Use TaskGraphSignalHandler::registerSignal to signal to this function

Attention
This function is used by the signal handler that is registered from std::signal, and should not be called directly by the user.
Parameters
signumthe signal number that was triggered

Definition at line 54 of file graph_signal_handler.h.

Here is the call graph for this function:

◆ registerGraph()

template<class GraphOutput , class ... GraphInputs>
static void hh::GraphSignalHandler< GraphOutput, GraphInputs >::registerGraph ( Graph< GraphOutput, GraphInputs... > *  graph)
inlinestatic

Registers a task graph to be displayed when a signal is fired.

Parameters
graphthe task graph to be displayed.

Definition at line 95 of file graph_signal_handler.h.

◆ registerSignal()

template<class GraphOutput , class ... GraphInputs>
static void hh::GraphSignalHandler< GraphOutput, GraphInputs >::registerSignal ( int  signum = SIGTERM,
bool  atExit = false 
)
inlinestatic

Registers a signal for handling. (default SIGTERM)

Parameters
signumSignal number id
atExitBoolean to test if GraphSignalHandler::atExit is called

Definition at line 102 of file graph_signal_handler.h.

Here is the call graph for this function:

◆ setColorScheme()

template<class GraphOutput , class ... GraphInputs>
static void hh::GraphSignalHandler< GraphOutput, GraphInputs >::setColorScheme ( ColorScheme  scheme)
inlinestatic

Sets the color scheme for dot file generation.

Parameters
schemethe color scheme

Definition at line 77 of file graph_signal_handler.h.

◆ setDebugOptions()

template<class GraphOutput , class ... GraphInputs>
static void hh::GraphSignalHandler< GraphOutput, GraphInputs >::setDebugOptions ( DebugOptions  options)
inlinestatic

Sets the debug options for dot file generation.

Parameters
optionsthe debug options

Definition at line 89 of file graph_signal_handler.h.

◆ setStructureOptions()

template<class GraphOutput , class ... GraphInputs>
static void hh::GraphSignalHandler< GraphOutput, GraphInputs >::setStructureOptions ( StructureOptions  options)
inlinestatic

Sets the structure options for dot file generation.

Parameters
optionsthe structure options

Definition at line 83 of file graph_signal_handler.h.

Member Data Documentation

◆ colorScheme

template<class GraphOutput , class ... GraphInputs>
ColorScheme hh::GraphSignalHandler< GraphOutput, GraphInputs >::colorScheme = ColorScheme::EXECUTION
staticprivate

< The color scheme to use for graph dot file

Sets the default color scheme.

Definition at line 44 of file graph_signal_handler.h.

◆ debugOptions

template<class GraphOutput , class ... GraphInputs>
DebugOptions hh::GraphSignalHandler< GraphOutput, GraphInputs >::debugOptions = DebugOptions::DEBUG
staticprivate

< The debug options to use for graph dot file

Sets the default debug options.

Definition at line 46 of file graph_signal_handler.h.

◆ graphInstance_

template<class GraphOutput , class ... GraphInputs>
Graph< GraphOutput, GraphInputs... > * hh::GraphSignalHandler< GraphOutput, GraphInputs >::graphInstance_ = nullptr
staticprivate

< The outer graph instance

Set default value at nullptr.

Definition at line 40 of file graph_signal_handler.h.

◆ signalHandled_

template<class GraphOutput , class ... GraphInputs>
bool hh::GraphSignalHandler< GraphOutput, GraphInputs >::signalHandled_ = false
staticprivate

Flag to indicate if a signal has been fired or not.

Set default value at false.

Definition at line 42 of file graph_signal_handler.h.

◆ structureOptions

template<class GraphOutput , class ... GraphInputs>
StructureOptions hh::GraphSignalHandler< GraphOutput, GraphInputs >::structureOptions = StructureOptions::ALL
staticprivate

< The structure options to use for graph dot file

Sets the default structure options.

Definition at line 45 of file graph_signal_handler.h.


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