introduce pointer-to-PlacementIndex typedef

This commit is contained in:
Fischlurch 2009-10-17 21:29:16 +02:00
parent b03577ea3f
commit 2ca89010d1
7 changed files with 27 additions and 18 deletions

View file

@ -59,7 +59,6 @@ namespace mobject {
/* some type shorthands */
typedef shared_ptr<PlacementIndex> PIdx;
typedef PlacementIndex::PlacementMO PlacementMO;
typedef PlacementIndex::PRef PRef;
typedef PlacementIndex::ID ID;
@ -146,9 +145,9 @@ namespace mobject {
namespace { // implementation detail: default global placement index access
PIdx globalIndex;
PPIdx globalIndex;
PIdx const&
PPIdx const&
getGlobalIndex()
{
if (globalIndex)
@ -164,7 +163,7 @@ namespace mobject {
void
reset_PlacementIndex (PIdx const& alternativeIndex)
reset_PlacementIndex (PPIdx const& alternativeIndex)
{
globalIndex = alternativeIndex;
}

View file

@ -116,13 +116,16 @@ namespace mobject {
};
////////////////TODO currently just fleshing out the API; probably have to split off an impl.class; but for now a PImpl is sufficient...
typedef shared_ptr<PlacementIndex> PPIdx;
/** @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(shared_ptr<PlacementIndex> const&) ;
reset_PlacementIndex(PPIdx const&) ;
/** @internal restore the implicit PlacementIndex to its default implementation (=the session) */
void

View file

@ -69,7 +69,7 @@ namespace test {
run (Arg)
{
// Prepare an (test)Index backing the PlacementRefs
PIdx index = build_testScopes();
PPIdx index = build_testScopes();
UNIMPLEMENTED ("function test of placement scope interface");
verifyLookup (index);

View file

@ -61,7 +61,7 @@ namespace test {
{
// Prepare an (test)Index backing the PlacementRefs
PIdx index = build_testScopes();
PPIdx index = build_testScopes();
// PMO& root = index->getRoot();
UNIMPLEMENTED ("unit test to cover query focus management");

View file

@ -62,7 +62,7 @@ namespace test {
run (Arg)
{
// Prepare an (test)Index backing the PlacementRefs
PIdx index = build_testScopes();
PPIdx index = build_testScopes();
UNIMPLEMENTED ("unit test regarding placement scope handling");
}

View file

@ -57,17 +57,21 @@ namespace test {
* test PlacementIndex will be cleared automatically, and the
* default Index within the session will be re-activated.
*/
PIdx
PPIdx
build_testScopes()
{
PSub p1(*new TestSubMO21);
PSub p2(*new TestSubMO21);
PSub p3(*new TestSubMO21);
PSub p4(*new TestSubMO21);
PSub p5(*new TestSubMO21);
PDum p1(*new TestSubMO21);
PDum p2(*new TestSubMO21);
PDum p3(*new TestSubMO21);
PDum p4(*new TestSubMO21);
PDum p5(*new TestSubMO21);
PDum ps1(*new DummyMO);
PDum ps2(*new TestSubMO1);
PDum ps2(*new TestSubMO2);
// Prepare an (test)Index backing the PlacementRefs
PIdx index (PlacementIndex::create().get(), &remove_testIndex); // taking ownership
PPIdx index (PlacementIndex::create().get(), &remove_testIndex); // taking ownership
reset_PlacementIndex(index);
PMO& root = index->getRoot();
@ -77,6 +81,10 @@ namespace test {
index->insert (p4, p3 );
index->insert (p5, p4 );
index->insert (ps1,root);
index->insert (ps2,root);
index->insert (ps3,root);
return index;
}

View file

@ -50,8 +50,7 @@ namespace test {
using std::tr1::shared_ptr;
using namespace mobject::test;
typedef TestPlacement<TestSubMO21> PSub;
typedef shared_ptr<PlacementIndex> PIdx;
typedef TestPlacement<DummyMO> PDum;
@ -65,7 +64,7 @@ namespace test {
* @see session::SessManagerImpl::getCurrentIndex()
* @see mobject::reset_PlacementIndex
*/
PIdx build_testScopes();
PPIdx build_testScopes();
}}} // namespace mobject::session::test