Lumiera  0.pre.03
»edit your freedom«
steam-dispatcher.hpp
Go to the documentation of this file.
1 /*
2  STEAM-DISPATCHER.hpp - Steam-Layer command dispatch and execution
3 
4  Copyright (C)
5  2009, 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 
14 
45 #ifndef STEAM_CONTROL_PROC_DISPATCHER_H
46 #define STEAM_CONTROL_PROC_DISPATCHER_H
47 
48 #include "common/subsys.hpp"
49 #include "lib/depend.hpp"
50 #include "lib/sync.hpp"
51 
52 #include <memory>
53 
54 
55 
56 namespace steam {
57 namespace control {
58 
59  using std::unique_ptr;
60  using lumiera::Subsys;
61 
62 
63  class DispatcherLoop;
64 
65 
78  : public lib::Sync<>
79  {
80  unique_ptr<DispatcherLoop> runningLoop_;
81  bool active_{false};
82 
83  public:
85 
86  bool start (Subsys::SigTerm);
87  bool isRunning();
88  void requestStop() noexcept;
89 
90  void activate();
91  void deactivate();
92  void awaitDeactivation();
93  void clear();
94 
95  bool empty() const ;
96 
97  private:
98  void endRunningLoopState();
99 
100  ~SteamDispatcher();
101  SteamDispatcher();
102  friend class lib::DependencyFactory<SteamDispatcher>;
103  };
104 
105 
106 
107 
108 }} // namespace steam::control
109 #endif /*STEAM_CONTROL_PROC_DISPATCHER_H*/
Facility for monitor object based locking.
Definition: sync.hpp:209
static lib::Depend< SteamDispatcher > instance
storage for Singleton access
void awaitDeactivation()
block until the dispatcher has actually reached disabled state.
Dependencies and lifecycle of a partially independent Subsystem of the Application.
Definition: subsys.hpp:61
Guard to manage processing commands to operate on the session.
void clear()
discard any commands waiting in the dispatcher queue
Steam-Layer implementation namespace root.
Access point to singletons and other kinds of dependencies designated by type.
Definition: depend.hpp:280
Implementation namespace for support and library code.
bool start(Subsys::SigTerm)
starting the SteamDispatcher means to start the session subsystem.
Object Monitor based synchronisation.
Describing dependencies and lifecycle of the application&#39;s primary parts.
void requestStop() noexcept
signal to the loop thread that it needs to terminate.
Singleton services and Dependency Injection.
void deactivate()
halt further processing of session commands
void activate()
activate processing of enqueued session commands.
bool isRunning()
whether the »session subsystem« is operational.