phase out the existing access functions, now superseeded by SessionServices

This commit is contained in:
Fischlurch 2009-11-11 05:44:58 +01:00
parent 1a76ce7a5f
commit 5535a7a00e
9 changed files with 13 additions and 81 deletions

View file

@ -155,54 +155,6 @@ namespace session {
namespace { // implementation detail: default global placement index access
PPIdx globalIndex;
PPIdx const&
getGlobalIndex()
{
if (globalIndex)
return globalIndex;
else
return session::SessManagerImpl::getCurrentIndex();
}
} // (End) implementation detail
void
reset_PlacementIndex (PPIdx const& alternativeIndex)
{
globalIndex = alternativeIndex;
}
/** @internal restore the implicit PlacementIndex to its default implementation (=the session) */
void
reset_PlacementIndex()
{
globalIndex.reset();
}
/** by default, this reaches for the PlacementIndex maintained within
* the current session. But for the purpose of unit tests, an alternative
* PlacementIndex may have been \link #reset_PlacementIndex installed \endlink
*/
Placement<MObject> &
fetch_PlacementIndex (Placement<MObject>::ID const& pID)
{
return getGlobalIndex()->find (pID);
}
/** @internal used by PlacementRef to implement a self-check */
bool
checkContains_PlacementIndex (Placement<MObject>::ID const& pID)
{
return getGlobalIndex()->contains (pID);
}
}} // namespace mobject::session

View file

@ -138,19 +138,6 @@ namespace session {
/** @internal there is an implicit PlacementIndex available on a global scale,
* by default implemented within the current session. This function allows
* to re-define this implicit index temporarily, e.g. for unit tests. */
void
reset_PlacementIndex(PPIdx const&) ;
/** @internal restore the implicit PlacementIndex to its default implementation (=the session) */
void
reset_PlacementIndex() ;
/** @internal access point for PlacementRef to the implicit global PlacementIndex */
Placement<MObject> &
fetch_PlacementIndex(Placement<MObject>::ID const&) ;

View file

@ -142,12 +142,5 @@ namespace session {
}
shared_ptr<PlacementIndex>&
SessManagerImpl::getCurrentIndex ()
{
return static_cast<SessManagerImpl&> (Session::current).pImpl_->pIdx_;
}
}} // namespace mobject::session

View file

@ -98,9 +98,9 @@ namespace session {
protected: /* == management API === */
SessionImpl ();
friend class SessManagerImpl;
void clear ();
friend class SessManagerImpl;
PPIdx const&
getPlacementIndex()
@ -221,9 +221,6 @@ namespace session {
public:
/* ==== proc layer internal API ==== */
/** @internal access point for PlacementIndex and PlacementRef */
static shared_ptr<PlacementIndex>& getCurrentIndex () ;
virtual SessionImplAPI* operator-> () throw() ;
};

View file

@ -63,7 +63,7 @@ namespace session {
class SessionServiceMockIndex
{
public:
void reset_PlacementIndex (PPIdx const& alternativeIndex =PPIdx());
static void reset_PlacementIndex (PPIdx const& alternativeIndex =PPIdx());
};

View file

@ -29,6 +29,7 @@
#include "proc/mobject/placement.hpp"
#include "proc/mobject/placement-ref.hpp"
#include "proc/mobject/session/placement-index.hpp"
#include "proc/mobject/session/session-service-mock-index.hpp"
#include "proc/mobject/session/clip.hpp"
#include "proc/mobject/explicitplacement.hpp"
#include "proc/mobject/test-dummy-mobject.hpp"
@ -47,7 +48,7 @@ namespace test {
using lumiera::Time;
using session::Clip;
using session::reset_PlacementIndex;
using session::SessionServiceMockIndex;
/***************************************************************************
@ -91,7 +92,7 @@ namespace test {
typedef shared_ptr<PlacementIndex> PIdx;
PIdx index (PlacementIndex::create());
PMO& root = index->getRoot();
reset_PlacementIndex(index);
SessionServiceMockIndex::reset_PlacementIndex (index);
// Add the Clips to "session"
index->insert (pClip1, root);
@ -130,7 +131,7 @@ namespace test {
ASSERT (2 == pClip1.use_count());
ASSERT (2 == pClip2.use_count());
#endif ////////////////////////////////////////////////////////////////////////////////////////TODO lots of things unimplemented.....!!!!!
reset_PlacementIndex();
SessionServiceMockIndex::reset_PlacementIndex();
}

View file

@ -26,6 +26,7 @@
#include "proc/mobject/placement.hpp"
#include "proc/mobject/placement-ref.hpp"
#include "proc/mobject/session/placement-index.hpp"
#include "proc/mobject/session/session-service-mock-index.hpp"
#include "proc/mobject/explicitplacement.hpp"
#include "proc/mobject/test-dummy-mobject.hpp"
#include "lib/util.hpp"
@ -70,7 +71,7 @@ namespace test {
typedef shared_ptr<PlacementIndex> PIdx;
PIdx index (PlacementIndex::create());
PMO& root = index->getRoot();
reset_PlacementIndex(index);
SessionServiceMockIndex::reset_PlacementIndex(index);
index->insert (p1, root);
index->insert (p2, root);
@ -179,7 +180,7 @@ namespace test {
//consistency check; then reset PlacementRef index to default
ASSERT (0 == index->size());
reset_PlacementIndex();
SessionServiceMockIndex::reset_PlacementIndex();
}
};

View file

@ -22,6 +22,7 @@
#include "proc/mobject/session/test-scopes.hpp"
#include "proc/mobject/session/session-service-mock-index.hpp"
//#include "lib/util.hpp"
//#include <iostream>
@ -46,7 +47,7 @@ namespace test {
REQUIRE (testIdx);
testIdx->clear();
ASSERT (0 == testIdx->size());
reset_PlacementIndex(); // restore default Index from Session
SessionServiceMockIndex::reset_PlacementIndex(); // restore default Index from Session
delete testIdx;
}
@ -72,7 +73,7 @@ namespace test {
// Prepare an (test)Index backing the PlacementRefs
PPIdx index (PlacementIndex::create().get(), &remove_testIndex); // taking ownership
reset_PlacementIndex(index);
SessionServiceMockIndex::reset_PlacementIndex(index);
PMO& root = index->getRoot();
index->insert (p1, root);

View file

@ -62,7 +62,7 @@ namespace test {
*
* @see mobject::PlacementIndex
* @see session::SessManagerImpl::getCurrentIndex()
* @see mobject::reset_PlacementIndex
* @see mobject::session::SessionServiceMockIndex::reset_PlacementIndex
*/
PPIdx build_testScopes();