OutputMapping: interface refactorings to yield a cleaner structure
This commit is contained in:
parent
56c1387cd5
commit
c3d29d1eb3
3 changed files with 33 additions and 12 deletions
|
|
@ -45,8 +45,19 @@ namespace lumiera {
|
|||
|
||||
|
||||
/**
|
||||
* Generic query interface for retrieving objects matching
|
||||
* some capability query
|
||||
* Generic query interface for retrieving objects
|
||||
* matching the given capability query
|
||||
* @note until really integrating a rules based system
|
||||
* this is a dummy placeholder implementation
|
||||
* based on a dressed-up std::string
|
||||
* @warning in this preliminary implementation, the
|
||||
* given query-string is used as-is, without any
|
||||
* normalisation. Moreover, as espeically the
|
||||
* fake-configrules match by string comparision,
|
||||
* this may led to unexpected mis-matches.
|
||||
* @todo the »real thing« should be based on a
|
||||
* normalised syntax tree representation
|
||||
* of the atoms in the query.
|
||||
*/
|
||||
template<class OBJ>
|
||||
class Query : public std::string
|
||||
|
|
|
|||
|
|
@ -26,8 +26,11 @@
|
|||
|
||||
#include "proc/mobject/output-designation.hpp"
|
||||
#include "lib/meta/function.hpp"
|
||||
#include "lib/bool-checkable.hpp"
|
||||
#include "lib/query.hpp"
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
|
||||
|
||||
namespace mobject {
|
||||
|
|
@ -104,14 +107,20 @@ namespace mobject {
|
|||
}
|
||||
|
||||
class Resolver
|
||||
: public lib::BoolCheckable<Resolver
|
||||
, boost::noncopyable>
|
||||
{
|
||||
public:
|
||||
Resolver () { }
|
||||
Resolver (PId newId2map)
|
||||
|
||||
void
|
||||
operator= (PId newId2map)
|
||||
{
|
||||
UNIMPLEMENTED ("store new fixed mapping");
|
||||
}
|
||||
Resolver (PPipe newPipe2map)
|
||||
|
||||
void
|
||||
operator= (PPipe newPipe2map)
|
||||
{
|
||||
UNIMPLEMENTED ("store new fixed mapping");
|
||||
}
|
||||
|
|
@ -122,7 +131,7 @@ namespace mobject {
|
|||
}
|
||||
|
||||
bool
|
||||
isDefined() const
|
||||
isValid() const
|
||||
{
|
||||
UNIMPLEMENTED ("is this a NULL object, or a valid stored mapping?");
|
||||
}
|
||||
|
|
@ -136,20 +145,20 @@ namespace mobject {
|
|||
////TODO: better use boost::operators
|
||||
};
|
||||
|
||||
Resolver
|
||||
Resolver&
|
||||
operator[] (PId)
|
||||
{
|
||||
UNIMPLEMENTED ("standard lookup");
|
||||
}
|
||||
|
||||
Resolver
|
||||
Resolver&
|
||||
operator[] (PPipe const& pipe)
|
||||
{
|
||||
REQUIRE (pipe);
|
||||
return (*this) [pipe->getID()];
|
||||
}
|
||||
|
||||
Resolver
|
||||
Resolver&
|
||||
operator[] (Query<asset::Pipe> const& query4pipe)
|
||||
{
|
||||
UNIMPLEMENTED ("lookup by extended query");
|
||||
|
|
|
|||
|
|
@ -101,10 +101,11 @@ namespace test {
|
|||
CHECK (!isnil (map));
|
||||
CHECK (1 == map.size());
|
||||
CHECK (map[p1] == "furry");
|
||||
CHECK (map[p1].isDefined());
|
||||
CHECK (map[p1].isValid());
|
||||
CHECK (map[p1]);
|
||||
|
||||
CHECK (!map[pX].isDefined());
|
||||
CHECK (!map[p2].isDefined());
|
||||
CHECK (!map[pX]);
|
||||
CHECK (!map[p2]);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -136,7 +137,7 @@ namespace test {
|
|||
CHECK (isnil(m1));
|
||||
CHECK (!isnil(m2));
|
||||
CHECK (m2[p1] == "furry");
|
||||
CHECK (!m1[p1].isDefined());
|
||||
CHECK (!m1[p1].isValid());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue