diff --git a/src/lib/multifact-arg.hpp b/src/lib/multifact-arg.hpp index d47ddd6c4..c0c779c60 100644 --- a/src/lib/multifact-arg.hpp +++ b/src/lib/multifact-arg.hpp @@ -69,16 +69,19 @@ namespace lib { * creator function on invocation. * TODO type comment */ - template< typename SIG, + template< typename SIG , typename ID , template class Wrapper > class MultiFact, ID, Wrapper> : public MultiFact { - + typedef MultiFact _Base; typedef typename FabTraits::Argument ArgType; + typedef typename _Base::Product Product; + typedef typename _Base::Creator Creator; + public: Product operator() (ID const& id, ArgType arg) diff --git a/src/proc/mobject/placement-index.cpp b/src/proc/mobject/placement-index.cpp index ac6bbb279..dc84d0481 100644 --- a/src/proc/mobject/placement-index.cpp +++ b/src/proc/mobject/placement-index.cpp @@ -76,6 +76,13 @@ namespace mobject { PlacementIndex::~PlacementIndex() { } + bool + PlacementIndex::canHandleQuery (session::Goal::QueryID qID) const + { + UNIMPLEMENTED ("decide by hard-wired check if the given Query can be resolved by PlacementIndex"); + } + + PlacementMO& PlacementIndex::getRoot() const { diff --git a/src/proc/mobject/placement-index.hpp b/src/proc/mobject/placement-index.hpp index 98de15581..553419d32 100644 --- a/src/proc/mobject/placement-index.hpp +++ b/src/proc/mobject/placement-index.hpp @@ -99,6 +99,9 @@ namespace mobject { ///////////////////////////////////////////TODO: shouldn't t query (PlacementMO& scope) const; + bool canHandleQuery(session::Goal::QueryID) const; + + /* == mutating operations == */ ID insert (PlacementMO& newObj, PlacementMO& targetScope); diff --git a/src/proc/mobject/session/query-resolver.cpp b/src/proc/mobject/session/query-resolver.cpp index 3c5974b49..6cdd21894 100644 --- a/src/proc/mobject/session/query-resolver.cpp +++ b/src/proc/mobject/session/query-resolver.cpp @@ -38,7 +38,7 @@ namespace session { QueryResolver::~QueryResolver() { } - QueryResolver::Resolution::~Resolution() { } + Resolution::~Resolution() { } struct QueryDispatcher @@ -47,6 +47,11 @@ namespace session { }; + QueryResolver::QueryResolver () + : dispatcher_(new QueryDispatcher) + { } + + /** TODO??? */ PReso QueryResolver::issue (Goal& query) diff --git a/src/proc/mobject/session/query-resolver.hpp b/src/proc/mobject/session/query-resolver.hpp index 6d095323b..fcf13981c 100644 --- a/src/proc/mobject/session/query-resolver.hpp +++ b/src/proc/mobject/session/query-resolver.hpp @@ -46,12 +46,12 @@ namespace session { class Goal; + class Resolution; class QueryResolver; class QueryDispatcher; - class QueryResolver::Resolution; /** Allow for taking ownership of a result set */ - typedef std::tr1::shared_ptr PReso; + typedef std::tr1::shared_ptr PReso; @@ -106,7 +106,7 @@ namespace session { QueryID id_; Goal (QueryID qid) - : id_(quid) + : id_(qid) { } }; @@ -146,18 +146,48 @@ namespace session { RES& operator* () { return access(); } RES* operator->() { return & access(); } - void point_at(RES* r){ Goal::Result::pointAt(r);} + void point_at(RES* r){ Goal::Result::point_at(r);} }; - typedef lib::IterAdapter iterator; + typedef lib::IterAdapter iterator; iterator operator() (QueryResolver const& resolver); }; - + /** + * ABC denoting the result set + * of an individual query resolution + */ + class Resolution + { + typedef Goal::Result Result; + + public: + virtual ~Resolution(); + + static bool + hasNext (PReso&, Result& pos) ////TICKET #375 + { + return bool(pos); + } + + static void + iterNext (PReso& resultSet, Result& pos) + { + resultSet->nextResult(pos); + } + + virtual Result prepareResolution() =0; + + protected: + + virtual void nextResult(Result& pos) =0; + }; + + /** * TODO type comment */ @@ -169,35 +199,6 @@ namespace session { virtual ~QueryResolver() ; - /** - * ABC denoting the result set - * of an individual query resolution - */ - class Resolution - { - typedef Goal::Result Result; - - public: - virtual ~Resolution(); - - static bool - hasNext (PReso&, Result& pos) ////TICKET #375 - { - return bool(pos); - } - - static void - iterNext (PReso& resultSet, Result& pos) - { - resultSet->nextResult(pos); - } - - virtual Result prepareResolution() =0; - - protected: - - virtual void nextResult(Result& pos) =0; - }; /** issue a query to retrieve contents @@ -214,6 +215,7 @@ namespace session { protected: virtual bool canHandleQuery (Goal::QueryID qID) const =0; + QueryResolver(); }; ///////////////////////////TODO currently just fleshing the API @@ -223,7 +225,7 @@ namespace session { Query::operator() (QueryResolver const& resolver) { PReso resultSet = resolver.issue (*this); - Result first = prepareResolution(); + Result first = resultSet->prepareResolution(); return iterator (resultSet, first); } diff --git a/src/proc/mobject/session/scope-path.cpp b/src/proc/mobject/session/scope-path.cpp index e135467c4..5ecb64919 100644 --- a/src/proc/mobject/session/scope-path.cpp +++ b/src/proc/mobject/session/scope-path.cpp @@ -41,6 +41,22 @@ namespace session { } + Scope + ScopePath::getLeaf() const + { + UNIMPLEMENTED ("access end node of current path"); + } + + + /* == Mutations == */ + + void + ScopePath::clear() + { + UNIMPLEMENTED ("reset the current path to empty state"); + } + + diff --git a/src/proc/mobject/session/scope-path.hpp b/src/proc/mobject/session/scope-path.hpp index 5eb43f44a..054cdfe46 100644 --- a/src/proc/mobject/session/scope-path.hpp +++ b/src/proc/mobject/session/scope-path.hpp @@ -49,6 +49,11 @@ namespace session { public: ScopePath(); + + Scope getLeaf() const; + + void clear(); + }; ///////////////////////////TODO currently just fleshing the API diff --git a/src/proc/mobject/session/scope.cpp b/src/proc/mobject/session/scope.cpp index 930690a05..b73096d36 100644 --- a/src/proc/mobject/session/scope.cpp +++ b/src/proc/mobject/session/scope.cpp @@ -49,6 +49,20 @@ namespace session { } + Scope::Scope (Scope const& o) + : anchor_(o.anchor_) + { } + + + Scope& + Scope::operator= (Scope const& o) + { + anchor_ = o.anchor_; ////////////////////////////TODO verify correctness + return *this; + } + + + ScopeLocator::ScopeLocator() : focusStack_(new QueryFocusStack) { diff --git a/src/proc/mobject/session/scope.hpp b/src/proc/mobject/session/scope.hpp index 241d33b73..88d6300d2 100644 --- a/src/proc/mobject/session/scope.hpp +++ b/src/proc/mobject/session/scope.hpp @@ -65,6 +65,9 @@ namespace session { Scope (PlacementMO const& constitutingPlacement); Scope (); ///< unlocated NIL scope + Scope (Scope const&); + Scope& operator= (Scope const&); + static Scope const& containing (PlacementMO const& aPlacement); //////////////TODO really returning a const& here?? static Scope const& containing (RefPlacement const& refPlacement);