session lifecycle implementation..
This commit is contained in:
parent
85b62d99dc
commit
9fc366bd25
5 changed files with 57 additions and 31 deletions
|
|
@ -160,14 +160,14 @@ namespace session {
|
|||
using mobject::session::Track;
|
||||
using mobject::session::PTrack;
|
||||
|
||||
template PPipe DefsManager::operator() (const Query<Pipe>&);
|
||||
template PProcPatt DefsManager::operator() (const Query<const ProcPatt>&);
|
||||
template PTrack DefsManager::operator() (const Query<Track>&);
|
||||
template PTimeline DefsManager::operator() (const Query<Timeline>&);
|
||||
template PSequence DefsManager::operator() (const Query<Sequence>&);
|
||||
template PPipe DefsManager::operator() (Query<Pipe> const&);
|
||||
template PProcPatt DefsManager::operator() (Query<const ProcPatt> const&);
|
||||
template PTrack DefsManager::operator() (Query<Track> const&);
|
||||
template PTimeline DefsManager::operator() (Query<Timeline> const&);
|
||||
template PSequence DefsManager::operator() (Query<Sequence> const&);
|
||||
|
||||
template bool DefsManager::define (const PPipe&, const Query<Pipe>&);
|
||||
template bool DefsManager::forget (const PPipe&);
|
||||
template bool DefsManager::define (PPipe const&, Query<Pipe> const&);
|
||||
template bool DefsManager::forget (PPipe const&);
|
||||
|
||||
|
||||
}} // namespace mobject::session
|
||||
|
|
|
|||
|
|
@ -72,14 +72,14 @@ namespace mobject {
|
|||
* is considered \e misconfiguration.
|
||||
*/
|
||||
template<class TAR>
|
||||
P<TAR> operator() (const lumiera::Query<TAR>&);
|
||||
P<TAR> operator() (lumiera::Query<TAR> const&);
|
||||
|
||||
|
||||
/** search through the registered defaults, never create anything.
|
||||
* @return object fulfilling the query, \c empty ptr if not found.
|
||||
*/
|
||||
template<class TAR>
|
||||
P<TAR> search (const lumiera::Query<TAR>&);
|
||||
P<TAR> search (lumiera::Query<TAR> const&);
|
||||
|
||||
/** retrieve an object fulfilling the query and register it as default.
|
||||
* The resolution is delegated to the ConfigQuery system (which may cause
|
||||
|
|
@ -87,7 +87,7 @@ namespace mobject {
|
|||
* @return object fulfilling the query, \c empty ptr if no solution.
|
||||
*/
|
||||
template<class TAR>
|
||||
P<TAR> create (const lumiera::Query<TAR>&);
|
||||
P<TAR> create (lumiera::Query<TAR> const&);
|
||||
|
||||
/** register the given object as default, after ensuring it fulfils the
|
||||
* query. The latter may cause some properties of the object to be set,
|
||||
|
|
@ -96,13 +96,13 @@ namespace mobject {
|
|||
* @note only a weak ref to the object is stored
|
||||
*/
|
||||
template<class TAR>
|
||||
bool define (const P<TAR>&, const lumiera::Query<TAR>&);
|
||||
bool define (P<TAR> const&, lumiera::Query<TAR> const&);
|
||||
|
||||
/** remove the defaults registration of the given object, if there was such
|
||||
* @return false if nothing has been changed because the object wasn't registered
|
||||
*/
|
||||
template<class TAR>
|
||||
bool forget (const P<TAR>&);
|
||||
bool forget (P<TAR> const&);
|
||||
|
||||
|
||||
// Q: can we have something along the line of...?
|
||||
|
|
|
|||
|
|
@ -40,12 +40,15 @@
|
|||
#include "proc/mobject/session/sess-manager-impl.hpp"
|
||||
#include "proc/mobject/session/defsmanager.hpp"
|
||||
#include "proc/mobject/session/lifecycle-advisor.hpp"
|
||||
#include "proc/asset/timeline.hpp"
|
||||
#include "lib/error.hpp"
|
||||
#include "lib/query.hpp"
|
||||
|
||||
using boost::scoped_ptr;
|
||||
|
||||
|
||||
|
||||
|
||||
namespace mobject {
|
||||
namespace session {
|
||||
|
||||
|
|
@ -92,20 +95,34 @@ namespace session {
|
|||
: public LifecycleAdvisor
|
||||
{
|
||||
SessionPImpl & session_;
|
||||
bool shall_load_; ////////////TODO a placeholder; later we'll pass in a de-serialiser
|
||||
|
||||
|
||||
|
||||
/** @note Any session services get up into default configured state.
|
||||
* After the swap, \c tmpS holds onto the old session, which
|
||||
* consequently should unwind on leaving this scope. */
|
||||
void
|
||||
createSessionFacilities()
|
||||
{
|
||||
UNIMPLEMENTED ("create session implementation objects, pImpl switch");
|
||||
SessionPImpl tmpS (new SessionImplAPI);
|
||||
session_.swap (tmpS);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
injectSessionContent()
|
||||
{
|
||||
UNIMPLEMENTED ("load default content of de-serialise");
|
||||
if (shall_load_)
|
||||
{
|
||||
UNIMPLEMENTED ("loading session from persistent storage");
|
||||
}
|
||||
else
|
||||
{ // inject some default session content
|
||||
asset::PTimeline initialTimeline = session_->defaults (lumiera::Query<asset::Timeline> ());
|
||||
/////////////TODO howto "attach a timeline"??
|
||||
//session_->attach( timeline );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -147,7 +164,8 @@ namespace session {
|
|||
void
|
||||
deconfigure()
|
||||
{
|
||||
UNIMPLEMENTED ("anything berfore destroying objects");
|
||||
TODO ("reset the assets registered with AssetManager");
|
||||
/////////////////////////////////////////////////////////////////// TICKET #154
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -156,6 +174,7 @@ namespace session {
|
|||
public:
|
||||
SessionLifecycleDetails(SessionPImpl& currentSessionAccessPoint)
|
||||
: session_(currentSessionAccessPoint)
|
||||
, shall_load_(false)
|
||||
{ }
|
||||
};
|
||||
|
||||
|
|
@ -190,7 +209,7 @@ namespace session {
|
|||
bool
|
||||
SessManagerImpl::isUp ()
|
||||
{
|
||||
return bool(pImpl_);
|
||||
return bool(pImpl_); ///////////////////// TICKET #702 possible race, because this gets true way before the interface is up
|
||||
}
|
||||
|
||||
/** @note no transactional behaviour. may succeed partially.
|
||||
|
|
@ -199,6 +218,7 @@ namespace session {
|
|||
void
|
||||
SessManagerImpl::clear ()
|
||||
{
|
||||
Lock sync(this);
|
||||
pImpl_->clear();
|
||||
}
|
||||
|
||||
|
|
@ -210,7 +230,9 @@ namespace session {
|
|||
void
|
||||
SessManagerImpl::close ()
|
||||
{
|
||||
UNIMPLEMENTED("clean session shutdown");
|
||||
Lock sync(this);
|
||||
lifecycle_->shutDown();
|
||||
pImpl_.reset();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -223,13 +245,9 @@ namespace session {
|
|||
void
|
||||
SessManagerImpl::reset ()
|
||||
{
|
||||
scoped_ptr<SessionImplAPI> tmpS (new SessionImplAPI);
|
||||
|
||||
TODO ("reset the assets registered with AssetManager");
|
||||
/////////////////////////////////////////////////////////////////// TICKET #154
|
||||
|
||||
TODO ("thread lock");
|
||||
pImpl_.swap (tmpS);
|
||||
Lock sync(this);
|
||||
lifecycle_->shutDown();
|
||||
lifecycle_->pullUp();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -237,6 +255,9 @@ namespace session {
|
|||
SessManagerImpl::load ()
|
||||
{
|
||||
UNIMPLEMENTED ("load serialised session");
|
||||
Lock sync(this);
|
||||
lifecycle_->shutDown();
|
||||
lifecycle_->pullUp();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -252,6 +273,7 @@ namespace session {
|
|||
SessManagerImpl::save ()
|
||||
{
|
||||
UNIMPLEMENTED ("save session (serialised)");
|
||||
/////////////////////////////////////////////////TODO: need lock?
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#define MOBJECT_SESSION_SESS_MANAGER_IMPL_H
|
||||
|
||||
#include "proc/mobject/session/session-impl.hpp"
|
||||
#include "lib/sync.hpp"
|
||||
|
||||
|
||||
namespace mobject {
|
||||
|
|
@ -37,7 +38,9 @@ namespace session {
|
|||
* Session manager implementation class holding the
|
||||
* actual smart pointer to the current Session impl.
|
||||
*/
|
||||
class SessManagerImpl : public SessManager
|
||||
class SessManagerImpl
|
||||
: public SessManager
|
||||
, public lib::Sync<>
|
||||
{
|
||||
scoped_ptr<SessionImplAPI> pImpl_;
|
||||
scoped_ptr<LifecycleAdvisor> lifecycle_;
|
||||
|
|
|
|||
|
|
@ -2440,7 +2440,7 @@ The general idea is, that each facade interface actually provides access to a sp
|
|||
|
||||
</pre>
|
||||
</div>
|
||||
<div title="LifecycleAdvisor" modifier="Ichthyostega" modified="201010230311" created="201010220319" tags="def SessionLogic impl" changecount="7">
|
||||
<div title="LifecycleAdvisor" modifier="Ichthyostega" modified="201010232308" created="201010220319" tags="def SessionLogic impl" changecount="8">
|
||||
<pre>An implementation facility used by the session manager implementation to ensure a consistent lifecycle. A template-method-like skeleton of operations can be invoked by the session manager to go through the various lifecycle stages, while the actual implementation functionality is delegated to facilities within the session. The assumption is for the lifecycle advisor to be executed within a controlled environment, a single instance and single threaded.
|
||||
|
||||
---------------------
|
||||
|
|
@ -2452,15 +2452,16 @@ Reading the source code should convey a complete picture about what is going on
|
|||
;close
|
||||
: the shutdown sequence cleanly unwinds any contents and returns into //uninitialised state.//
|
||||
;reset
|
||||
: is compriesd of two phases: shutdown and startup of an empty new session
|
||||
: is comprised of two phases: shutdown and startup of an empty new session
|
||||
: shutdown will be skipped automatically when uninitialised
|
||||
: startup has to inject default session content
|
||||
;load
|
||||
: similar to the startup sequence of __reset__, but injects serialised content
|
||||
: again, first an existing session is brought down cleanly
|
||||
: the startup sequence behaves similarly to __reset__, but injects serialised content
|
||||
Note that, while causing a short //freeze period,// __saving__ and __(re-)building__ aren't considered lifecycle operations
|
||||
|
||||
!!operation sequences
|
||||
The ''pull up'' sequence performes basic initialsiation of the session facilities and then, after the pImpl-switch, executes the various loading and startup phases. Any previous session switched away is assumed to unwind automatically, nothing is done especially to disconnnect such an existing session, we simply require the session subsystem to be in a pristine state initially.
|
||||
The ''pull up'' sequence performs basic initialisation of the session facilities and then, after the pImpl-switch, executes the various loading and startup phases. Any previous session switched away is assumed to unwind automatically, nothing is done especially to disconnect such an existing session, we simply require the session subsystem to be in a pristine state initially.
|
||||
The ''shut down'' sequence does exactly that: halt processing and rendering, disconnect an existing session, if any, get back into initial state. It doesn't care for unwinding session contents, which is assumed to happen automatically when references to previous session contents go out of scope.
|
||||
</pre>
|
||||
</div>
|
||||
|
|
@ -4665,7 +4666,7 @@ Currently, I'm planning to modify MObjectRef to return only a const ref to the u
|
|||
<<<
|
||||
</pre>
|
||||
</div>
|
||||
<div title="SessionLifecycle" modifier="Ichthyostega" modified="201010220313" created="200911070329" tags="SessionLogic spec" changecount="25">
|
||||
<div title="SessionLifecycle" modifier="Ichthyostega" modified="201010232310" created="200911070329" tags="SessionLogic spec" changecount="26">
|
||||
<pre>The current [[Session]] is the root of any state found within Proc-Layer. Thus, events defining the session's lifecycle influence and synchronise the cooperative behaviour of the entities within the model, the ProcDispatcher, [[Fixture]] and any facility below.
|
||||
* when ''starting'', on first access an empty session is created, which puts any related facility into a defined initial state.
|
||||
* when ''closing'' the session, any dependent facilities are disabled, disconnected, halted or closed
|
||||
|
|
@ -4700,7 +4701,7 @@ As detailed above, {{{Session::current}}} exposes the management / lifecycle API
|
|||
|
||||
!!!closing the session
|
||||
# top-level facilities accessing the session (GUI, command processing, scripts) are blocked and the LayerSeparationInterface is closed
|
||||
# any render processes are ensured to be terminated (or //disconnected// &mdash; so the can't do any harm)
|
||||
# any render processes are ensured to be terminated (or //disconnected// &mdash; so they can't do any harm)
|
||||
# the {{{ON_SESSION_END}}} event is emitted
|
||||
# the command processing log is tagged
|
||||
# the command queue(s) are emptied, discarding any commands not yet executed
|
||||
|
|
|
|||
Loading…
Reference in a new issue