Lumiera  0.pre.03
»edityourfreedom«
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
facade.cpp
Go to the documentation of this file.
1 /*
2  Facade - access point for communicating with the Proc-Interface
3 
4  Copyright (C) Lumiera.org
5  2008, Hermann Vosseler <Ichthyostega@web.de>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 * *****************************************************/
22 
23 
47 #include "proc/facade.hpp"
48 #include "lib/depend.hpp"
51 
52 #include <string>
53 
54 
55 namespace proc {
56 
57  using std::string;
58  using std::unique_ptr;
59  using lumiera::Subsys;
60  using lumiera::Option;
62 
63 
65  : public Subsys
66  {
67  operator string() const { return "Session"; }
68 
72  bool
73  shouldStart (Option&) override
74  {
75  return false;
76  }
77 
78  bool
79  start (Option&, Subsys::SigTerm termNotification) override
80  {
81  return ProcDispatcher::instance().start (termNotification);
82  }
83 
84  void
85  triggerShutdown() noexcept override
86  {
87  ProcDispatcher::instance().requestStop();
88  }
89 
90  bool
91  checkRunningState() noexcept override
92  {
93  return ProcDispatcher::instance().isRunning();
94  }
95  };
96 
97 
98 
100  : public Subsys
101  {
102  operator string() const { return "PlayOut"; }
103 
111  bool
112  shouldStart (Option&) override
113  {
114  TODO ("extract options about specific output systems to be brought up");
115  return false;
116  }
117 
118  bool
119  start (Option&, Subsys::SigTerm termination) override
120  {
121  this->completedSignal_ = termination;
122  return play::OutputDirector::instance().connectUp();
123  }
124 
126 
127 
128  void
129  triggerShutdown() noexcept override
130  {
131  play::OutputDirector::instance().triggerDisconnect (completedSignal_);
132  }
133 
134 
135  bool
136  checkRunningState() noexcept override
137  {
138  return play::OutputDirector::instance().isOperational();
139  }
140  };
141 
142  namespace {
143  lib::Depend<SessionSubsystem> theSessionSubsystemLifecycle;
144  lib::Depend<PlayOutSubsysDescriptor> thePlayOutDescriptor;
145  }
146 
147 
148 
149 
151  Subsys&
153  {
154  return theSessionSubsystemLifecycle();
155  }
156 
157 
159  Subsys&
161  {
162  return thePlayOutDescriptor();
163  }
164 
165 
166 
167 } // namespace proc
Dependencies and lifecycle of a partially independent Subsystem of the Application.
Definition: subsys.hpp:70
A global service to coordinate and handle all external output activities.
static lumiera::Subsys & getSessionDescriptor()
provide a descriptor for lumiera::AppState, wired accordingly to allow main() to boot the support inf...
Definition: facade.cpp:152
void triggerShutdown() noexceptoverride
initiate termination of this subsystem.
Definition: facade.cpp:85
bool checkRunningState() noexceptoverride
whether this subsystem is actually operational.
Definition: facade.cpp:91
void triggerShutdown() noexceptoverride
initiate termination of this subsystem.
Definition: facade.cpp:129
Frontend for handling the Lumiera application commandline arguments.
Definition: option.hpp:76
bool start(Option &, Subsys::SigTerm termNotification) override
attempt to bring up this subsystem up.
Definition: facade.cpp:79
Access point to singletons and other kinds of dependencies designated by type.
Definition: depend.hpp:275
bool shouldStart(Option &) override
determine, if any output system is required to start up explicitly.
Definition: facade.cpp:112
bool checkRunningState() noexceptoverride
whether this subsystem is actually operational.
Definition: facade.cpp:136
bool shouldStart(Option &) override
Definition: facade.cpp:73
Singleton services and Dependency Injection.
static lib::Depend< ProcDispatcher > instance
storage for Singleton access
static lib::Depend< OutputDirector > instance
storage for the single application wide OutputDirector instance
static lumiera::Subsys & getPlayOutDescriptor()
provide a descriptor for lumiera::AppState, wired accordingly to allow main() to bring up the render ...
Definition: facade.cpp:160
function< void(string *)> SigTerm
Definition: subsys.hpp:74
Guard to manage processing commands working on the session.
Proc-Layer implementation namespace root.
Definition: id-scheme.hpp:63
bool start(Option &, Subsys::SigTerm termination) override
attempt to bring up this subsystem up.
Definition: facade.cpp:119
Dispatch and execute mutation operations on the High-level model.