From 56c1387cd565e81add19165a3ef49878cb5c6f1d Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Thu, 25 Nov 2010 05:35:50 +0100 Subject: [PATCH] OutputMapping: finish interface draft (stubbed) --- src/proc/mobject/output-mapping.hpp | 84 ++++++++++++++++++- .../proc/mobject/output-mapping-test.cpp | 1 - 2 files changed, 81 insertions(+), 4 deletions(-) diff --git a/src/proc/mobject/output-mapping.hpp b/src/proc/mobject/output-mapping.hpp index d0495ddc2..b05ff3c2b 100644 --- a/src/proc/mobject/output-mapping.hpp +++ b/src/proc/mobject/output-mapping.hpp @@ -26,11 +26,12 @@ #include "proc/mobject/output-designation.hpp" #include "lib/meta/function.hpp" +#include "lib/query.hpp" namespace mobject { - + namespace { // Helper to extract and rebind definition types using std::tr1::function; @@ -54,11 +55,14 @@ namespace mobject { public: typedef typename Rebinder::Res Target; - typedef function OutputMappingFunc; + typedef function OutputMappingFunc; + }; } + using lumiera::Query; + /** * OutputMapping is a facility to resolve output designations. @@ -75,11 +79,85 @@ namespace mobject { { typedef _def Setup; + typedef asset::ID PId; + typedef asset::PPipe PPipe; + public: - typedef typename Setup::Target Target; + typedef typename Setup::Target Target; + + size_t + size() const + { + UNIMPLEMENTED ("size of mapping table"); + } + + bool + empty() const + { + return 0 == size(); + } + + void + clear() + { + UNIMPLEMENTED ("purge mapping table"); + } + + class Resolver + { + public: + Resolver () { } + Resolver (PId newId2map) + { + UNIMPLEMENTED ("store new fixed mapping"); + } + Resolver (PPipe newPipe2map) + { + UNIMPLEMENTED ("store new fixed mapping"); + } + + operator Target() + { + UNIMPLEMENTED ("invoke output mapping functor, maybe issue defaults query"); + } + + bool + isDefined() const + { + UNIMPLEMENTED ("is this a NULL object, or a valid stored mapping?"); + } + + bool + operator== (Target const& oval) + { + UNIMPLEMENTED ("compare this resolution to given other target value"); + } + + ////TODO: better use boost::operators + }; + + Resolver + operator[] (PId) + { + UNIMPLEMENTED ("standard lookup"); + } + + Resolver + operator[] (PPipe const& pipe) + { + REQUIRE (pipe); + return (*this) [pipe->getID()]; + } + + Resolver + operator[] (Query const& query4pipe) + { + UNIMPLEMENTED ("lookup by extended query"); + } }; + } // namespace mobject #endif diff --git a/tests/components/proc/mobject/output-mapping-test.cpp b/tests/components/proc/mobject/output-mapping-test.cpp index 1c3bd397e..d0710648b 100644 --- a/tests/components/proc/mobject/output-mapping-test.cpp +++ b/tests/components/proc/mobject/output-mapping-test.cpp @@ -105,7 +105,6 @@ namespace test { CHECK (!map[pX].isDefined()); CHECK (!map[p2].isDefined()); - VERIFY_ERROR (UNKNOWN_MAPPING, map[pX] ); }