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)
5  2010, 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 
40 #ifndef STEAM_MOBJECT_SESSION_LIFECYCLE_ADVISOR_H
41 #define STEAM_MOBJECT_SESSION_LIFECYCLE_ADVISOR_H
42 
43 #include "lib/error.hpp"
44 #include "lib/nocopy.hpp"
45 #include "include/lifecycle.h"
47 #include "lib/symbol.hpp"
48 
49 
50 namespace steam {
51 namespace mobject {
52 namespace session {
53 
54  using lib::Symbol;
55 
56 
66  {
67 
68 
69  public:
79  void
81  {
82  createSessionFacilities(); // includes switch of the "current" Session
83  emitEvent (ON_SESSION_START);
84  injectSessionContent();
85  emitEvent (ON_SESSION_INIT);
86  getSessionReady();
87  openSessionInterface();
88  emitEvent (ON_SESSION_READY);
89  }
90 
91 
102  void
104  {
105  emitEvent (ON_SESSION_CLOSE);
106  closeSessionInterface();
107  disconnectRenderProcesses();
108  emitEvent (ON_SESSION_END);
109  commandLogCheckpoint();
110  deconfigure();
111  }
112 
113 
114  virtual ~LifecycleAdvisor() { }
115 
116 
117  protected: /* === Lifecycle building blocks === */
118 
119  void
120  emitEvent (Symbol eventLabel)
121  {
122  lumiera::LifecycleHook::trigger (eventLabel);
123  }
124 
125 
133  virtual void createSessionFacilities() =0;
134 
135 
139  virtual void injectSessionContent() =0;
140 
141 
145  virtual void getSessionReady() =0;
146 
147 
151  virtual void openSessionInterface() =0;
152 
153 
157  virtual void closeSessionInterface() =0;
158 
159 
163  virtual void disconnectRenderProcesses() =0;
164 
165 
169  virtual void commandLogCheckpoint() =0;
170 
171 
184  virtual void deconfigure() =0;
185  };
186 
187 
188 
189 }}} // namespace mobject::session
190 #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:87
void pullUp()
operation sequence to pull up the session.
Any copy and copy construction prohibited.
Definition: nocopy.hpp:37
Steam-Layer implementation namespace root.
Namespace of Session and user visible high-level objects.
Definition: sequence.hpp:65
static void trigger(Symbol eventLabel)
trigger lifecycle callbacks registered under the given label
Definition: lifecycle.cpp:72
Skeleton of operations conducting the session lifecycle sequences.
Token or Atom with distinct identity.
Definition: symbol.hpp:117
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:106
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:95
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:125
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:115
void shutDown()
operation sequence for cleanly shutting down the session.