diff --git a/src/proc/mobject/session/sess-manager-impl.cpp b/src/proc/mobject/session/sess-manager-impl.cpp index a7de7b72e..2ad161383 100644 --- a/src/proc/mobject/session/sess-manager-impl.cpp +++ b/src/proc/mobject/session/sess-manager-impl.cpp @@ -37,7 +37,7 @@ #include "proc/mobject/session.hpp" -#include "proc/mobject/session/session-impl.hpp" +#include "proc/mobject/session/sess-manager-impl.hpp" #include "proc/mobject/session/defsmanager.hpp" //#include "proc/mobject/session/defsregistry.hpp" #include "lib/error.hpp" diff --git a/src/proc/mobject/session/sess-manager-impl.hpp b/src/proc/mobject/session/sess-manager-impl.hpp new file mode 100644 index 000000000..22eb310bf --- /dev/null +++ b/src/proc/mobject/session/sess-manager-impl.hpp @@ -0,0 +1,65 @@ +/* + SESS-MANAGER-IMPL.hpp - global session access and lifecycle + + Copyright (C) Lumiera.org + 2009, 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. + +*/ + + +#ifndef MOBJECT_SESSION_SESS_MANAGER_IMPL_H +#define MOBJECT_SESSION_SESS_MANAGER_IMPL_H + +#include "proc/mobject/session/session-impl.hpp" + + +namespace mobject { +namespace session { + + + + /** + * Session manager implementation class holding the + * actual smart pointer to the current Session impl. + */ + 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 ==== */ + + virtual SessionImplAPI* operator-> () throw() ; + + }; + + + +}} // namespace mobject::session +#endif diff --git a/src/proc/mobject/session/session-impl.hpp b/src/proc/mobject/session/session-impl.hpp index e185557f1..c757c9c44 100644 --- a/src/proc/mobject/session/session-impl.hpp +++ b/src/proc/mobject/session/session-impl.hpp @@ -22,11 +22,11 @@ /** @file session-impl.hpp - ** Session and SessionManager Implementation classes. + ** Session and SessionServices 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 level API, it should never ** be included by client code. Besides the actual SessionImpl, a set ** of further implementation level services is provided for use by @@ -70,7 +70,7 @@ namespace session { using std::vector; using boost::scoped_ptr; using std::tr1::shared_ptr; - + /** * Implementation class for the Session interface @@ -112,120 +112,98 @@ namespace session { }; - /* ===== providing internal services for Proc ===== */ - - template - struct ServiceAccessPoint - : IMPL - { - bool - isRegisteredID (PMO::ID const& placementID) - { - return IMPL::getPlacementIndex()->contains (placementID); //never throws - } - - PMO& - resolveID (PMO::ID const& placementID) - { - return IMPL::getPlacementIndex()->find (placementID); //may throw - } - }; - - - template - struct ServiceAccessPoint - : IMPL - { - QueryResolver& - getResolver() - { - UNIMPLEMENTED ("how actually to manage the PlacementIndexQueryResolver wrapper instance"); - -// return IMPL::magic_; - } - }; - - - template - struct ServiceAccessPoint - : IMPL - { - PPIdx const& - getPlacementIndex() - { - if (mockIndex_) - return mockIndex_; - else - return IMPL::getPlacementIndex(); - } - - void - reset_PlacementIndex (PPIdx const& alternativeIndex) - { - mockIndex_ = alternativeIndex; - } - - private: - PPIdx mockIndex_; - }; - - - 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; + /* ===== providing internal services for Proc ===== */ - - - /** - * 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 + template + struct ServiceAccessPoint + : IMPL { - 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 ==== */ - - virtual SessionImplAPI* operator-> () throw() ; + bool + isRegisteredID (PMO::ID const& placementID) + { + return IMPL::getPlacementIndex()->contains (placementID); //never throws + } + PMO& + resolveID (PMO::ID const& placementID) + { + return IMPL::getPlacementIndex()->find (placementID); //may throw + } }; + template + struct ServiceAccessPoint + : IMPL + { + QueryResolver& + getResolver() + { + UNIMPLEMENTED ("how actually to manage the PlacementIndexQueryResolver wrapper instance"); + +// return IMPL::magic_; + } + }; + + + template + struct ServiceAccessPoint + : IMPL + { + PPIdx const& + getPlacementIndex() + { + if (mockIndex_) + return mockIndex_; + else + return IMPL::getPlacementIndex(); + } + + void + reset_PlacementIndex (PPIdx const& alternativeIndex) + { + mockIndex_ = alternativeIndex; + } + + private: + PPIdx mockIndex_; + }; + + + template + struct ServiceAccessPoint + : IMPL +// , SessionServiceDefaults + { + ////////////////////////////TODO + }; + + + + + + + class SessManagerImpl; + + /** + * 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 + */ + typedef SessionServices< Types< SessionServiceFetch + , SessionServiceExploreScope + , SessionServiceMockIndex + , SessionServiceDefaults + > // List of the APIs to provide + , SessManagerImpl // frontend for access + , SessionImpl // implementation base class + > // + SessionImplAPI; + + + }} // namespace mobject::session #endif diff --git a/src/proc/mobject/session/session-services.cpp b/src/proc/mobject/session/session-services.cpp index 6a76d2ee0..c0128ae38 100644 --- a/src/proc/mobject/session/session-services.cpp +++ b/src/proc/mobject/session/session-services.cpp @@ -28,6 +28,7 @@ #include "proc/mobject/session/session-services.hpp" #include "proc/mobject/session/session-impl.hpp" +#include "proc/mobject/session/sess-manager-impl.hpp" namespace mobject { namespace session { diff --git a/src/proc/mobject/session/session.cpp b/src/proc/mobject/session/session.cpp index f15f16192..f5513574a 100644 --- a/src/proc/mobject/session/session.cpp +++ b/src/proc/mobject/session/session.cpp @@ -34,6 +34,7 @@ #include "proc/mobject/session.hpp" #include "proc/mobject/session/defsmanager.hpp" #include "proc/mobject/session/session-impl.hpp" +#include "proc/mobject/session/sess-manager-impl.hpp" #include "lib/symbol.hpp" #include "lib/singleton.hpp"