/* SESSION-IMPL.hpp - holds the complete session data to be edited by the user Copyright (C) Lumiera.org 2008, Hermann Vosseler This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /** @file session-impl.hpp ** Session and SessionManager Implementation classes. ** Session and the corresponding Manager are primary Interfaces ** to control the behaviour of the editing part of the application. ** All all implementation complexities are hidden behind a "PImpl". ** ** This file contains the implementation classes, it should never ** be included by client code. ** ** @see session-service-access-test.cpp for a complete simplified mock session manager ** */ #ifndef MOBJECT_SESSION_SESSIONIMPL_H #define MOBJECT_SESSION_SESSIONIMPL_H #include "proc/mobject/session.hpp" #include "proc/mobject/session/edl.hpp" #include "proc/mobject/session/fixture.hpp" #include "proc/mobject/session/placement-index.hpp" #include "proc/mobject/session/session-services.hpp" #include "proc/mobject/session/session-service-fetch.hpp" #include "proc/mobject/session/session-service-explore-scope.hpp" #include "proc/mobject/session/session-service-mock-index.hpp" #include "proc/mobject/session/session-service-defaults.hpp" #include #include namespace mobject { namespace session { using std::vector; using boost::scoped_ptr; using std::tr1::shared_ptr; /** * Implementation class for the Session interface */ class SessionImpl : public mobject::Session { uint focusEDL_; vector edls; PFix fixture; shared_ptr pIdx_; scoped_ptr defaultsManager_; ///////////TODO: later, this will be the real defaults manager. Currently this is just never initialised (11/09) /* ==== Session API ==== */ virtual bool isValid (); virtual void add (PMO& placement); virtual bool remove (PMO& placement); virtual EDL& currEDL (); virtual PFix& getFixture (); virtual void rebuildFixture (); protected: /* == management API === */ SessionImpl (); friend class SessManagerImpl; void clear (); }; /* ===== providing internal services for Proc ===== */ template struct ServiceAccessPoint : IMPL { bool isRegisteredID (PMO::ID const& placementID) { UNIMPLEMENTED ("check if index contains the given ID"); } PMO& resolveID (PMO::ID const& placementID) { UNIMPLEMENTED ("fetch from PlacementIndex, throw on failure"); // IMPL::implementationService(); } }; template struct ServiceAccessPoint : IMPL { QueryResolver& getResolver() { UNIMPLEMENTED ("how actually to manage the PlacementIndexQueryResolver wrapper instance"); // return IMPL::magic_; } }; template struct ServiceAccessPoint : IMPL { ////////////////////////////TODO }; template struct ServiceAccessPoint : IMPL // , SessionServiceDefaults { ////////////////////////////TODO }; class SessManagerImpl; typedef SessionServices< Types< SessionServiceFetch , SessionServiceExploreScope , SessionServiceMockIndex , SessionServiceDefaults > // List of the APIs to provide , SessManagerImpl // frontend for access , SessionImpl // implementation base class > // SessionImplAPI; /** * Session manager implementation class holding the * actual smart pointer to the current Session impl. * @todo couldn't this be pushed down into session.cpp? */ class SessManagerImpl : public SessManager { scoped_ptr pImpl_; SessManagerImpl() throw(); friend class lib::singleton::StaticCreate; virtual ~SessManagerImpl() {} /* ==== SessManager API ==== */ virtual void clear () ; virtual void reset () ; virtual void load () ; virtual void save () ; public: /* ==== proc layer internal API ==== */ /** @internal access point for PlacementIndex and PlacementRef */ static shared_ptr& getCurrentIndex () ; virtual SessionImplAPI* operator-> () throw() ; }; }} // namespace mobject::session #endif