Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
subsys.hpp
Go to the documentation of this file.
1/*
2 SUBSYS.hpp - interface for describing an application part to be handled by main()
3
4 Copyright (C)
5 2008, Hermann Vosseler <Ichthyostega@web.de>
6
7  **Lumiera** is free software; you can redistribute it and/or modify it
8  under the terms of the GNU General Public License as published by the
9  Free Software Foundation; either version 2 of the License, or (at your
10  option) any later version. See the file COPYING for further details.
11
12*/
13
34#ifndef LUMIERA_SUBSYS_H
35#define LUMIERA_SUBSYS_H
36
37#include "lib/error.hpp"
38#include "lib/nocopy.hpp"
39
40#include <functional>
41#include <string>
42#include <vector>
43
44
45
46namespace lumiera {
47
48 using std::string;
49 using std::function;
50
51 class Option;
52
53
54
61 class Subsys
63 {
64 public:
65 typedef function<void(string*)> SigTerm;
66
67 virtual ~Subsys();
68
70 virtual operator string() const =0;
71
72
75 Subsys& depends (Subsys& prereq);
76
79 bool isRunning() noexcept;
80
81
86 virtual bool shouldStart (lumiera::Option&) =0;
87
88
98 virtual bool start (lumiera::Option& options, SigTerm) =0;
99
100
107 virtual void triggerShutdown() noexcept =0;
108
109
110 const std::vector<Subsys*>
112
113
114 private:
120 virtual bool checkRunningState() noexcept =0;
121
122 std::vector<Subsys*> prereq_;
123 };
124
125
126
127} // namespace lumiera
128
129#endif
Frontend for handling the Lumiera application commandline arguments.
Definition option.hpp:70
Dependencies and lifecycle of a partially independent Subsystem of the Application.
Definition subsys.hpp:63
virtual ~Subsys()
Definition subsys.cpp:36
std::vector< Subsys * > prereq_
Definition subsys.hpp:122
virtual bool start(lumiera::Option &options, SigTerm)=0
attempt to bring up this subsystem up.
bool isRunning() noexcept
Definition subsys.cpp:50
const std::vector< Subsys * > getPrerequisites()
Definition subsys.hpp:111
function< void(string *)> SigTerm
Definition subsys.hpp:65
virtual bool checkRunningState() noexcept=0
whether this subsystem is actually operational.
virtual void triggerShutdown() noexcept=0
initiate termination of this subsystem.
virtual bool shouldStart(lumiera::Option &)=0
query application option state to determine if this subsystem should be activated.
Subsys & depends(Subsys &prereq)
define a dependency to another Subsys required for running this subsystem
Definition subsys.cpp:41
Any copy and copy construction prohibited.
Definition nocopy.hpp:38
Lumiera error handling (C++ interface).
Lumiera public interface.
Definition advice.hpp:102
STL namespace.
Mix-Ins to allow or prohibit various degrees of copying and cloning.