get it through the compiler again...
This commit is contained in:
parent
5fd2a85400
commit
6c187224eb
9 changed files with 50 additions and 37 deletions
|
|
@ -43,6 +43,7 @@ namespace session {
|
|||
typedef Goal::QueryID QueryID;
|
||||
typedef QueryID const& QID;
|
||||
|
||||
typedef PlacementIndex& PIdx;
|
||||
typedef PlacementIndex::iterator PIter;
|
||||
|
||||
/** @note all of this search implementation works on Placement<MObject> refs.
|
||||
|
|
@ -109,7 +110,7 @@ namespace session {
|
|||
class DeepExplorer
|
||||
: public Explorer
|
||||
{
|
||||
PPIdx index_;
|
||||
PIdx index_;
|
||||
std::stack<PIter> scopes_;
|
||||
|
||||
bool
|
||||
|
|
@ -126,12 +127,12 @@ namespace session {
|
|||
REQUIRE (!scopes_.empty() && scopes_.top());
|
||||
Pla& pos = *scopes_.top();
|
||||
++scopes_.top();
|
||||
scopes_.push(index_->getReferrers(pos.getID()));
|
||||
scopes_.push(index_.getReferrers(pos.getID()));
|
||||
return pos;
|
||||
}
|
||||
|
||||
public:
|
||||
DeepExplorer(PIter start, PPIdx idx)
|
||||
DeepExplorer(PIter start, PIdx idx)
|
||||
: index_(idx)
|
||||
{
|
||||
scopes_.push(start);
|
||||
|
|
@ -146,7 +147,7 @@ namespace session {
|
|||
class UpExplorer
|
||||
: public Explorer
|
||||
{
|
||||
PPIdx index_;
|
||||
PIdx index_;
|
||||
Pla* tip_;
|
||||
|
||||
bool
|
||||
|
|
@ -160,14 +161,14 @@ namespace session {
|
|||
{
|
||||
REQUIRE (tip_);
|
||||
Pla& pos = *tip_;
|
||||
tip_ = &index_->getScope(*tip_);
|
||||
tip_ = &index_.getScope(*tip_);
|
||||
if (tip_ == &pos)
|
||||
tip_ = 0;
|
||||
return pos;
|
||||
}
|
||||
|
||||
public:
|
||||
UpExplorer(Pla& start, PPIdx idx)
|
||||
UpExplorer(Pla& start, PIdx idx)
|
||||
: index_(idx)
|
||||
, tip_(&start)
|
||||
{ }
|
||||
|
|
@ -277,7 +278,7 @@ namespace session {
|
|||
|
||||
|
||||
|
||||
PlacementIndexQueryResolver::PlacementIndexQueryResolver (PPIdx theIndex)
|
||||
PlacementIndexQueryResolver::PlacementIndexQueryResolver (PIdx theIndex)
|
||||
: index_(theIndex)
|
||||
{
|
||||
defineHandling<MObject>();
|
||||
|
|
@ -346,10 +347,10 @@ namespace session {
|
|||
{
|
||||
switch (direction)
|
||||
{
|
||||
case CONTENTS: return new DeepExplorer(index_->getReferrers(startID), index_);
|
||||
case CHILDREN: return new ChildExplorer(index_->getReferrers(startID));
|
||||
case PARENTS: return new UpExplorer(index_->getScope(startID),index_);
|
||||
case PATH: return new UpExplorer(index_->find(startID),index_);
|
||||
case CONTENTS: return new DeepExplorer(index_.getReferrers(startID), index_);
|
||||
case CHILDREN: return new ChildExplorer(index_.getReferrers(startID));
|
||||
case PARENTS: return new UpExplorer(index_.getScope(startID),index_);
|
||||
case PATH: return new UpExplorer(index_.find(startID),index_);
|
||||
|
||||
default:
|
||||
throw lumiera::error::Invalid("unknown query direction"); //////TICKET #197
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
/** @file placement-index-query-resolver.hpp
|
||||
** Implementing resolution of "discover contents"-queries based on PlacementIndex.
|
||||
** This wrapper adds a service to resolve queries for exploring the contents or
|
||||
** the parent path of a given scope; the actual implementation is based on the
|
||||
** the parent path of a given scope; the actual implementation relies on the
|
||||
** basic operations provided by the PlacementIndex; usually this wrapper is
|
||||
** instantiated as one of the SessionServices for use by Proc-Layer internals.
|
||||
** The PlacementIndex to use for the implementation is handed in to the ctor.
|
||||
|
|
@ -33,7 +33,7 @@
|
|||
** decoupled from the querying client code, which retrieves the query results
|
||||
** through an iterator. Parametrisation is transmitted to the resolver using a
|
||||
** special subclass of Goal, a ScopeQuery. Especially, besides a filter to apply
|
||||
** on the results to retrieve, the direction and way* to search can be parametrised:
|
||||
** on the results to retrieve, the direction and way to search can be parametrised:
|
||||
** - ascending to the parents of the start scope
|
||||
** - enumerating the immediate child elements of the scope
|
||||
** - exhaustive depth-first search to get any content of the scope
|
||||
|
|
@ -42,7 +42,7 @@
|
|||
** On initialisation, a table with preconfigured resolution functions is built,
|
||||
** in order to re-gain the fully typed context when receiving a query. From within
|
||||
** this context, the concrete Query instance can be investigated to define a
|
||||
** constructor function for the actual result set, to determine the way how further
|
||||
** constructor function for the actual result set, determining the way how further
|
||||
** results will be searched and extracted. The further exploration is driven by the
|
||||
** client pulling values from the iterator until exhaustion.
|
||||
**
|
||||
|
|
@ -84,7 +84,9 @@ namespace session {
|
|||
class PlacementIndexQueryResolver
|
||||
: public session::QueryResolver
|
||||
{
|
||||
PPIdx index_;
|
||||
typedef PlacementIndex& PIdx;
|
||||
|
||||
PIdx index_;
|
||||
|
||||
|
||||
virtual bool canHandleQuery(Goal::QueryID const&) const;
|
||||
|
|
@ -102,7 +104,7 @@ namespace session {
|
|||
|
||||
|
||||
public:
|
||||
PlacementIndexQueryResolver (PPIdx theIndex);
|
||||
PlacementIndexQueryResolver (PIdx theIndex);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -257,10 +257,6 @@ namespace session {
|
|||
|
||||
|
||||
|
||||
/** @internal Factory for creating a new placement index.
|
||||
* For use by the Session and for unit tests.
|
||||
*/
|
||||
PlacementIndex::Factory PlacementIndex::create;
|
||||
|
||||
PlacementIndex::PlacementIndex()
|
||||
: pTab_(new Table)
|
||||
|
|
@ -276,6 +272,15 @@ namespace session {
|
|||
}
|
||||
|
||||
|
||||
/** validity self-check, used for sanity checks
|
||||
* and the session self-check. */
|
||||
bool
|
||||
PlacementIndex::isValid() const
|
||||
{
|
||||
UNIMPLEMENTED ("PlacementIndex validity self-check");
|
||||
}
|
||||
|
||||
|
||||
size_t
|
||||
PlacementIndex::size() const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -28,14 +28,15 @@
|
|||
namespace mobject {
|
||||
namespace session {
|
||||
|
||||
/////////////////////////////////////////TODO temporary hack
|
||||
/////////////////////////////////////////TODO temporary hack: use Meyer's singleton
|
||||
namespace {
|
||||
DefsManager&
|
||||
getDummyDefaultsManager()
|
||||
{
|
||||
static scoped_ptr<DefsManager> dummyDefaultsManagerInstance(new DefsManager);
|
||||
static scoped_ptr<DefsManager> dummyInstance(0);
|
||||
if (!dummyInstance) dummyInstance.reset (new DefsManager);
|
||||
|
||||
return *dummyDefaultsManagerInstance;
|
||||
return *dummyInstance;
|
||||
}
|
||||
}
|
||||
/////////////////////////////////////////TODO temporary hack
|
||||
|
|
@ -51,7 +52,7 @@ namespace session {
|
|||
focusEDL_(0),
|
||||
edls(1),
|
||||
fixture(new Fixture),
|
||||
pIdx_(PlacementIndex::create())
|
||||
pIdx_() /////////////////////////////////////////////TODO
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -123,13 +123,13 @@ namespace session {
|
|||
bool
|
||||
isRegisteredID (PMO::ID const& placementID)
|
||||
{
|
||||
return IMPL::getPlacementIndex()->contains (placementID); //never throws
|
||||
return IMPL::getPlacementIndex().contains (placementID); //never throws
|
||||
}
|
||||
|
||||
PMO&
|
||||
resolveID (PMO::ID const& placementID)
|
||||
{
|
||||
return IMPL::getPlacementIndex()->find (placementID); //may throw
|
||||
return IMPL::getPlacementIndex().find (placementID); //may throw
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -148,7 +148,7 @@ namespace session {
|
|||
PlacementMO&
|
||||
getScopeRoot()
|
||||
{
|
||||
return IMPL::getPlacementIndex()->getRoot();
|
||||
return IMPL::getPlacementIndex().getRoot();
|
||||
}
|
||||
|
||||
protected:
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ namespace session {
|
|||
ENSURE (mockIndex->isValid());
|
||||
ENSURE (1 == mockIndex.use_count());
|
||||
|
||||
SessionImplAPI::current->reset_PlacementIndex (*mockIndex);
|
||||
SessionImplAPI::current->reset_PlacementIndex (mockIndex.get());
|
||||
return mockIndex;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ namespace test {
|
|||
// Prepare an (test)Index (dummy "session")
|
||||
PPIdx index = build_testScopes();
|
||||
PlacementMO& root = index->getRoot();
|
||||
PlacementIndexQueryResolver resolver(index);
|
||||
PlacementIndexQueryResolver resolver(*index);
|
||||
|
||||
discover (ContentsQuery<MObject> (resolver,root));
|
||||
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ namespace test {
|
|||
run (Arg)
|
||||
{
|
||||
PlacementIndex index;
|
||||
ASSERT (index);
|
||||
ASSERT (index.isValid());
|
||||
|
||||
checkSimpleInsertRemove (index);
|
||||
has_size (0, index);
|
||||
|
|
@ -121,12 +121,14 @@ namespace test {
|
|||
PMO& elm = index.find(elmID);
|
||||
ASSERT (elmID == elm.getID());
|
||||
ASSERT (!isSameObject (elm,testObj)); // note: placements are registered as copy
|
||||
ASSERT (elm == testObj); // they are semantically equivalent
|
||||
// ///////////////////////////////////////////////////////////////////////////////TICKET #119
|
||||
// ASSERT (elm == testObj); // they are semantically equivalent
|
||||
ASSERT (elmID != testObj.getID()); // but have a distinct identity
|
||||
|
||||
PMO::ID elmID2 = index.insert(testObj, root);
|
||||
ASSERT (elmID != elmID); // ...and each insert creates a new instance
|
||||
ASSERT (testObj == index.find(elmID2));
|
||||
// ///////////////////////////////////////////////////////////////////////////////TICKET #119
|
||||
// ASSERT (testObj == index.find(elmID2));
|
||||
ASSERT (!isSameObject (elm, index.find(elmID2)));
|
||||
ASSERT ( isSameObject (elm, index.find(elmID )));
|
||||
|
||||
|
|
@ -151,7 +153,8 @@ namespace test {
|
|||
ID e133 = index.insert (testObj, e13);
|
||||
ID e1331 = index.insert (testObj, e133);
|
||||
|
||||
ASSERT (root == index.getScope(e1));
|
||||
// ///////////////////////////////////////////////////////////////////////////////TICKET #119
|
||||
// ASSERT (root == index.getScope(e1));
|
||||
ASSERT (e1 == index.getScope(e11).getID());
|
||||
ASSERT (e1 == index.getScope(e12).getID());
|
||||
ASSERT (e1 == index.getScope(e13).getID());
|
||||
|
|
@ -162,8 +165,9 @@ namespace test {
|
|||
ASSERT (e1 != e13);
|
||||
ASSERT (e13 != e133);
|
||||
|
||||
ASSERT (index.getScope(e11) == index.getScope(index.find(e11)));
|
||||
ASSERT (index.getScope(e131) == index.getScope(index.find(e131)));
|
||||
// ///////////////////////////////////////////////////////////////////////////////TICKET #119
|
||||
// ASSERT (index.getScope(e11) == index.getScope(index.find(e11)));
|
||||
// ASSERT (index.getScope(e131) == index.getScope(index.find(e131)));
|
||||
|
||||
VERIFY_ERROR(NONEMPTY_SCOPE, index.remove(e13) ); // can't remove a scope-constituting element
|
||||
VERIFY_ERROR(NONEMPTY_SCOPE, index.remove(e133) );
|
||||
|
|
|
|||
|
|
@ -37,11 +37,11 @@ namespace mobject {
|
|||
namespace session {
|
||||
namespace test {
|
||||
|
||||
using std::tr1::shared_ptr;
|
||||
|
||||
using namespace mobject::test;
|
||||
typedef TestPlacement<DummyMO> PDum;
|
||||
|
||||
typedef std::tr1::shared_ptr<PlacementIndex> PPIdx;
|
||||
|
||||
|
||||
|
||||
/** helper for tests: create a pseudo-session (actually just a PlacementIndex),
|
||||
|
|
|
|||
Loading…
Reference in a new issue