WIP fixes and stubbing to get at compiling the MultiFact

This commit is contained in:
Fischlurch 2009-10-29 04:32:00 +01:00
parent 3145064a21
commit 54aa7b4afe
9 changed files with 97 additions and 39 deletions

View file

@ -69,16 +69,19 @@ namespace lib {
* creator function on invocation.
* TODO type comment
*/
template< typename SIG,
template< typename SIG
, typename ID
, template<class> class Wrapper
>
class MultiFact<function<SIG>, ID, Wrapper>
: public MultiFact<SIG,ID,Wrapper>
{
typedef MultiFact<SIG,ID,Wrapper> _Base;
typedef typename FabTraits<SIG>::Argument ArgType;
typedef typename _Base::Product Product;
typedef typename _Base::Creator Creator;
public:
Product
operator() (ID const& id, ArgType arg)

View file

@ -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
{

View file

@ -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);

View file

@ -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)

View file

@ -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<QueryResolver::Resolution> PReso;
typedef std::tr1::shared_ptr<Resolution> 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>(); }
RES* operator->() { return & access<RES>(); }
void point_at(RES* r){ Goal::Result::pointAt(r);}
void point_at(RES* r){ Goal::Result::point_at(r);}
};
typedef lib::IterAdapter<Cursor,PResolution> iterator;
typedef lib::IterAdapter<Cursor,PReso> 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<RES>::operator() (QueryResolver const& resolver)
{
PReso resultSet = resolver.issue (*this);
Result first = prepareResolution();
Result first = resultSet->prepareResolution();
return iterator (resultSet, first);
}

View file

@ -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");
}

View file

@ -49,6 +49,11 @@ namespace session {
public:
ScopePath();
Scope getLeaf() const;
void clear();
};
///////////////////////////TODO currently just fleshing the API

View file

@ -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)
{

View file

@ -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);