From fa0482fab4931ed898b4dc5ca5288aedfbd7eee0 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Mon, 8 Mar 2010 05:26:09 +0100 Subject: [PATCH] WIP add sub-interfaces to the session API --- src/proc/mobject/session.hpp | 45 ++++++++++++++++++----- src/proc/mobject/session/session-impl.hpp | 8 ++-- src/proc/mobject/session/session.cpp | 9 ++++- tests/43session.tests | 6 ++- 4 files changed, 52 insertions(+), 16 deletions(-) diff --git a/src/proc/mobject/session.hpp b/src/proc/mobject/session.hpp index 4c55b45bf..cd1fa0cfb 100644 --- a/src/proc/mobject/session.hpp +++ b/src/proc/mobject/session.hpp @@ -40,6 +40,9 @@ ** but simplified mock setup of the session and session manager, without ** any access and synchronisation and similar concerns, to read top down. ** + ** @see session-structure-test.cpp + ** @see timeline-sequence-handling-test.cpp + ** @see session-modify-parts-test.cpp */ @@ -48,14 +51,21 @@ #include "proc/mobject/placement.hpp" #include "proc/mobject/session/defsmanager.hpp" +#include "lib/ref-array.hpp" #include "lib/singleton.hpp" #include "lib/symbol.hpp" +#include "lib/p.hpp" #include #include +namespace asset { + class Timeline; typedef lumiera::P PTimeline; + class Sequence; typedef lumiera::P PSequence; +} + namespace mobject { namespace session { @@ -77,31 +87,46 @@ namespace mobject { * * Opening a Session has effectively global consequences, * because the Session defines the available Assets, and some - * kinds of Assets define default behaviour. Thus, access to - * the Session is similar to a Singleton instance. + * kinds of Assets define default behaviour. Thus, access to the + * Session is similar to a Singleton, through \c Session::current + * Besides the SessionManager, several sub-interfaces are exposed + * as embedded components: DefaultsManger, timelines and sequences. * * @note Any client should be aware that the Session can be closed, * replaced and loaded. The only way to access the Session is * via a "PImpl" smart pointer session::PSess (which indeed is * a reference to the SessManager and is accessible as the static - * field Session::current). You will never be able to get a direct + * field Session::current). Clients shouldn't try to get a direct * pointer or reference to the Session object. * */ - class Session : private boost::noncopyable + class Session + : boost::noncopyable { protected: - Session (session::DefsManager&) throw(); + typedef session::DefsManager& DefaultsAccess; + typedef lib::RefArray& TimelineAccess; + typedef lib::RefArray& SequenceAccess; + + + Session (DefaultsAccess + ,TimelineAccess + ,SequenceAccess) throw(); virtual ~Session (); - + + public: - static session::SessManager& current; static bool initFlag; ///////////////TICKET #518 yet another hack; actually need to care for session manager startup. - session::DefsManager& defaults; ///////////////TODO this is a hack... better solve it based on the new SessionServices mechanism + + static session::SessManager& current; + + DefaultsAccess defaults; + TimelineAccess timelines; + SequenceAccess sequences; virtual bool isValid () = 0; - virtual void add (PMO& placement) = 0; - virtual bool remove (PMO& placement) = 0; + virtual void attach (PMO& placement) = 0; + virtual bool detach (PMO& placement) = 0; virtual session::PFix& getFixture () = 0; virtual void rebuildFixture () = 0; diff --git a/src/proc/mobject/session/session-impl.hpp b/src/proc/mobject/session/session-impl.hpp index 6fb3e25b3..8b7873b5d 100644 --- a/src/proc/mobject/session/session-impl.hpp +++ b/src/proc/mobject/session/session-impl.hpp @@ -87,8 +87,8 @@ namespace session { /* ==== Session API ==== */ virtual bool isValid (); - virtual void add (PMO& placement); - virtual bool remove (PMO& placement); + virtual void attach (PMO& placement); + virtual bool detach (PMO& placement); virtual PFix& getFixture (); virtual void rebuildFixture (); @@ -221,7 +221,9 @@ namespace session { * actual configuration of the session implementation compound: * forming an inheritance chain of all internal SesssionServices * stacked on top of the SessionImpl class. - * @note SessionImplAPI is actually an alias to the global Session PImpl + * @note SessionImplAPI is actually used within the SessManagerImpl + * to create "the session" instance and expose it through the + * global Session PImpl */ typedef SessionServices< Types< SessionServiceFetch , SessionServiceExploreScope diff --git a/src/proc/mobject/session/session.cpp b/src/proc/mobject/session/session.cpp index 3c344a2e7..6c47011c3 100644 --- a/src/proc/mobject/session/session.cpp +++ b/src/proc/mobject/session/session.cpp @@ -121,10 +121,15 @@ namespace mobject { - Session::Session (session::DefsManager& def) throw() - : defaults(def) + Session::Session (DefaultsAccess defs + ,TimelineAccess tils + ,SequenceAccess seqs) throw() + : defaults(defs) + , timelines(tils) + , sequences(seqs) { } + // Emit the vtables and other magic stuff here... SessManager::~SessManager() { } Session::~Session () { } diff --git a/tests/43session.tests b/tests/43session.tests index 0611327a1..d395965c5 100644 --- a/tests/43session.tests +++ b/tests/43session.tests @@ -212,7 +212,11 @@ out: current Session-Impl-ID = 3 END -PLANNED "SessionStructure_test" SessionStructure_test <