now SessManagerImpl can go down entirely on implementation level
This commit is contained in:
parent
5535a7a00e
commit
bfd97bd98e
5 changed files with 156 additions and 111 deletions
|
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
|
|
||||||
#include "proc/mobject/session.hpp"
|
#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/defsmanager.hpp"
|
||||||
//#include "proc/mobject/session/defsregistry.hpp"
|
//#include "proc/mobject/session/defsregistry.hpp"
|
||||||
#include "lib/error.hpp"
|
#include "lib/error.hpp"
|
||||||
|
|
|
||||||
65
src/proc/mobject/session/sess-manager-impl.hpp
Normal file
65
src/proc/mobject/session/sess-manager-impl.hpp
Normal file
|
|
@ -0,0 +1,65 @@
|
||||||
|
/*
|
||||||
|
SESS-MANAGER-IMPL.hpp - global session access and lifecycle
|
||||||
|
|
||||||
|
Copyright (C) Lumiera.org
|
||||||
|
2009, Hermann Vosseler <Ichthyostega@web.de>
|
||||||
|
|
||||||
|
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<SessionImplAPI> pImpl_;
|
||||||
|
|
||||||
|
SessManagerImpl() throw();
|
||||||
|
friend class lib::singleton::StaticCreate<SessManagerImpl>;
|
||||||
|
|
||||||
|
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
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
/** @file session-impl.hpp
|
/** @file session-impl.hpp
|
||||||
** Session and SessionManager Implementation classes.
|
** Session and SessionServices Implementation classes.
|
||||||
** Session and the corresponding Manager are primary Interfaces
|
** Session and the corresponding Manager are primary Interfaces
|
||||||
** to control the behaviour of the editing part of the application.
|
** to control the behaviour of the editing part of the application.
|
||||||
** All all implementation complexities are hidden behind a "PImpl".
|
** All all implementation complexities are hidden behind a "PImpl".
|
||||||
|
|
@ -112,118 +112,96 @@ namespace session {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* ===== providing internal services for Proc ===== */
|
|
||||||
|
|
||||||
template<class IMPL>
|
/* ===== providing internal services for Proc ===== */
|
||||||
struct ServiceAccessPoint<SessionServiceFetch, IMPL>
|
|
||||||
: IMPL
|
|
||||||
{
|
|
||||||
bool
|
|
||||||
isRegisteredID (PMO::ID const& placementID)
|
|
||||||
{
|
|
||||||
return IMPL::getPlacementIndex()->contains (placementID); //never throws
|
|
||||||
}
|
|
||||||
|
|
||||||
PMO&
|
template<class IMPL>
|
||||||
resolveID (PMO::ID const& placementID)
|
struct ServiceAccessPoint<SessionServiceFetch, IMPL>
|
||||||
{
|
: IMPL
|
||||||
return IMPL::getPlacementIndex()->find (placementID); //may throw
|
{
|
||||||
}
|
bool
|
||||||
};
|
isRegisteredID (PMO::ID const& placementID)
|
||||||
|
|
||||||
|
|
||||||
template<class IMPL>
|
|
||||||
struct ServiceAccessPoint<SessionServiceExploreScope, IMPL>
|
|
||||||
: IMPL
|
|
||||||
{
|
|
||||||
QueryResolver&
|
|
||||||
getResolver()
|
|
||||||
{
|
|
||||||
UNIMPLEMENTED ("how actually to manage the PlacementIndexQueryResolver wrapper instance");
|
|
||||||
|
|
||||||
// return IMPL::magic_;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
template<class IMPL>
|
|
||||||
struct ServiceAccessPoint<SessionServiceMockIndex, IMPL>
|
|
||||||
: IMPL
|
|
||||||
{
|
|
||||||
PPIdx const&
|
|
||||||
getPlacementIndex()
|
|
||||||
{
|
|
||||||
if (mockIndex_)
|
|
||||||
return mockIndex_;
|
|
||||||
else
|
|
||||||
return IMPL::getPlacementIndex();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
reset_PlacementIndex (PPIdx const& alternativeIndex)
|
|
||||||
{
|
{
|
||||||
mockIndex_ = alternativeIndex;
|
return IMPL::getPlacementIndex()->contains (placementID); //never throws
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
PMO&
|
||||||
PPIdx mockIndex_;
|
resolveID (PMO::ID const& placementID)
|
||||||
};
|
{
|
||||||
|
return IMPL::getPlacementIndex()->find (placementID); //may throw
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
template<class IMPL>
|
template<class IMPL>
|
||||||
struct ServiceAccessPoint<SessionServiceDefaults, IMPL>
|
struct ServiceAccessPoint<SessionServiceExploreScope, IMPL>
|
||||||
: IMPL
|
: IMPL
|
||||||
// , SessionServiceDefaults
|
{
|
||||||
|
QueryResolver&
|
||||||
|
getResolver()
|
||||||
|
{
|
||||||
|
UNIMPLEMENTED ("how actually to manage the PlacementIndexQueryResolver wrapper instance");
|
||||||
|
|
||||||
|
// return IMPL::magic_;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template<class IMPL>
|
||||||
|
struct ServiceAccessPoint<SessionServiceMockIndex, IMPL>
|
||||||
|
: IMPL
|
||||||
|
{
|
||||||
|
PPIdx const&
|
||||||
|
getPlacementIndex()
|
||||||
|
{
|
||||||
|
if (mockIndex_)
|
||||||
|
return mockIndex_;
|
||||||
|
else
|
||||||
|
return IMPL::getPlacementIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
reset_PlacementIndex (PPIdx const& alternativeIndex)
|
||||||
{
|
{
|
||||||
|
mockIndex_ = alternativeIndex;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////TODO
|
private:
|
||||||
};
|
PPIdx mockIndex_;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template<class IMPL>
|
||||||
|
struct ServiceAccessPoint<SessionServiceDefaults, IMPL>
|
||||||
|
: 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;
|
|
||||||
|
|
||||||
|
|
||||||
|
class SessManagerImpl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Session manager implementation class holding the
|
* actual configuration of the session implementation compound:
|
||||||
* actual smart pointer to the current Session impl.
|
* forming an inheritance chain of all internal SesssionServices
|
||||||
* @todo couldn't this be pushed down into session.cpp?
|
* stacked on top of the SessionImpl class.
|
||||||
|
* @note SessionImplAPI is actually an alias to the global Session PImpl
|
||||||
*/
|
*/
|
||||||
class SessManagerImpl : public SessManager
|
typedef SessionServices< Types< SessionServiceFetch
|
||||||
{
|
, SessionServiceExploreScope
|
||||||
scoped_ptr<SessionImplAPI> pImpl_;
|
, SessionServiceMockIndex
|
||||||
|
, SessionServiceDefaults
|
||||||
|
> // List of the APIs to provide
|
||||||
|
, SessManagerImpl // frontend for access
|
||||||
|
, SessionImpl // implementation base class
|
||||||
|
> //
|
||||||
|
SessionImplAPI;
|
||||||
|
|
||||||
SessManagerImpl() throw();
|
|
||||||
friend class lib::singleton::StaticCreate<SessManagerImpl>;
|
|
||||||
|
|
||||||
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() ;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
#include "proc/mobject/session/session-services.hpp"
|
#include "proc/mobject/session/session-services.hpp"
|
||||||
#include "proc/mobject/session/session-impl.hpp"
|
#include "proc/mobject/session/session-impl.hpp"
|
||||||
|
#include "proc/mobject/session/sess-manager-impl.hpp"
|
||||||
|
|
||||||
namespace mobject {
|
namespace mobject {
|
||||||
namespace session {
|
namespace session {
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@
|
||||||
#include "proc/mobject/session.hpp"
|
#include "proc/mobject/session.hpp"
|
||||||
#include "proc/mobject/session/defsmanager.hpp"
|
#include "proc/mobject/session/defsmanager.hpp"
|
||||||
#include "proc/mobject/session/session-impl.hpp"
|
#include "proc/mobject/session/session-impl.hpp"
|
||||||
|
#include "proc/mobject/session/sess-manager-impl.hpp"
|
||||||
|
|
||||||
#include "lib/symbol.hpp"
|
#include "lib/symbol.hpp"
|
||||||
#include "lib/singleton.hpp"
|
#include "lib/singleton.hpp"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue