Lumiera  0.pre.03
»edit your freedom«
lifecycle-advisor.hpp
Go to the documentation of this file.
1 /*
2  LIFECYCLE-ADVISOR.hpp - outline of the session lifecycle
3 
4  Copyright (C) Lumiera.org
5  2010, 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 
49 #ifndef STEAM_MOBJECT_SESSION_LIFECYCLE_ADVISOR_H
50 #define STEAM_MOBJECT_SESSION_LIFECYCLE_ADVISOR_H
51 
52 #include "lib/error.hpp"
53 #include "lib/nocopy.hpp"
54 #include "include/lifecycle.h"
56 #include "lib/symbol.hpp"
57 
58 
59 namespace steam {
60 namespace mobject {
61 namespace session {
62 
63  using lib::Symbol;
64 
65 
75  {
76 
77 
78  public:
88  void
90  {
91  createSessionFacilities(); // includes switch of the "current" Session
92  emitEvent (ON_SESSION_START);
93  injectSessionContent();
94  emitEvent (ON_SESSION_INIT);
95  getSessionReady();
96  openSessionInterface();
97  emitEvent (ON_SESSION_READY);
98  }
99 
100 
111  void
113  {
114  emitEvent (ON_SESSION_CLOSE);
115  closeSessionInterface();
116  disconnectRenderProcesses();
117  emitEvent (ON_SESSION_END);
118  commandLogCheckpoint();
119  deconfigure();
120  }
121 
122 
123  virtual ~LifecycleAdvisor() { }
124 
125 
126  protected: /* === Lifecycle building blocks === */
127 
128  void
129  emitEvent (Symbol eventLabel)
130  {
131  lumiera::LifecycleHook::trigger (eventLabel);
132  }
133 
134 
142  virtual void createSessionFacilities() =0;
143 
144 
148  virtual void injectSessionContent() =0;
149 
150 
154  virtual void getSessionReady() =0;
155 
156 
160  virtual void openSessionInterface() =0;
161 
162 
166  virtual void closeSessionInterface() =0;
167 
168 
172  virtual void disconnectRenderProcesses() =0;
173 
174 
178  virtual void commandLogCheckpoint() =0;
179 
180 
193  virtual void deconfigure() =0;
194  };
195 
196 
197 
198 }}} // namespace mobject::session
199 #endif
Installing and invoking of application lifecycle event callbacks.
const char * ON_SESSION_START
LifecycleHook, to perform all the basic setup for a new session, prior to adding any specific data...
Definition: session.cpp:96
void pullUp()
operation sequence to pull up the session.
Any copy and copy construction prohibited.
Definition: nocopy.hpp:46
Steam-Layer implementation namespace root.
Namespace of Session and user visible high-level objects.
Definition: sequence.hpp:74
static void trigger(Symbol eventLabel)
trigger lifecycle callbacks registered under the given label
Definition: lifecycle.cpp:81
Skeleton of operations conducting the session lifecycle sequences.
Token or Atom with distinct identity.
Definition: symbol.hpp:126
Mix-Ins to allow or prohibit various degrees of copying and cloning.
const char * ON_SESSION_READY
LifecycleHook, to perform post loading tasks, requiring an already completely usable and configured s...
Definition: session.cpp:115
Marker types to indicate a literal string and a Symbol.
virtual void createSessionFacilities()=0
Build and wire all the sub components together forming the session implementation.
virtual void deconfigure()=0
This final stage of the session lifecycle terminates the operational state of all parts of the curren...
const char * ON_SESSION_INIT
LifecycleHook, to perform any initialisation, wiring and registrations necessary to get the session i...
Definition: session.cpp:104
Lumiera error handling (C++ interface).
const char * ON_SESSION_END
LifecycleHook, to perform any state saving, deregistration or de-activation necessary before bringing...
Definition: session.cpp:134
Primary Interface to the current Session.
const char * ON_SESSION_CLOSE
LifecycleHook, to commence any activity relying on an opened and fully operative session.
Definition: session.cpp:124
void shutDown()
operation sequence for cleanly shutting down the session.