From 272f3d75ff0b6315ca1f2babc20c9232bf6ad70f Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Fri, 19 Nov 2010 19:10:24 +0100 Subject: [PATCH] finish OutputDesignation definition and outline. (closes #312) --- src/proc/mobject/output-designation.cpp | 59 +++++++++++++++++++++++-- src/proc/mobject/output-designation.hpp | 14 ++++-- 2 files changed, 67 insertions(+), 6 deletions(-) diff --git a/src/proc/mobject/output-designation.cpp b/src/proc/mobject/output-designation.cpp index 1789d8436..b35c5799e 100644 --- a/src/proc/mobject/output-designation.cpp +++ b/src/proc/mobject/output-designation.cpp @@ -22,6 +22,7 @@ #include "lib/error.hpp" +#include "proc/mobject/mobject.hpp" #include "proc/mobject/placement-ref.hpp" #include "proc/mobject/output-designation.hpp" @@ -29,13 +30,65 @@ namespace mobject { typedef OutputDesignation::PPipe PPipe; typedef OutputDesignation::PID PID; + typedef OutputDesignation::TargetSpec TargetSpec; + + + struct AbsoluteSpec + : TargetSpec + { + PID target_; + + AbsoluteSpec (PID explicitTarget) + : target_(explicitTarget) + { } + + PID resolve (PPipe) { return target_; } + }; + + struct IndirectSpec + : TargetSpec + { + RefPlacement mediator_; + + IndirectSpec (RefPlacement const& indirectTarget) + : mediator_(indirectTarget) + { } + + PID + resolve (PPipe) + { + REQUIRE (mediator_); + UNIMPLEMENTED ("how to query a placement for output designation"); + } + }; + + struct RelativeSpec + : TargetSpec + { + uint busNr_; + + RelativeSpec (uint relative_busNr) + : busNr_(relative_busNr) + { } + + PID + resolve (PPipe) + { + UNIMPLEMENTED ("how the hell can we get a grip on the target to resolve the bus??"); + } + }; + + + + + OutputDesignation::TargetSpec::~TargetSpec() { } /** create an output designation by directly * specifying the target to connect */ OutputDesignation::OutputDesignation (PID explicitTarget) - : spec_() //////////TODO + : spec_(AbsoluteSpec (explicitTarget)) { } @@ -44,7 +97,7 @@ namespace mobject { * to the given reference scope / mediator. */ OutputDesignation::OutputDesignation (RefPlacement const& indirectTarget) - : spec_() //////////TODO + : spec_(IndirectSpec (indirectTarget)) { } @@ -58,7 +111,7 @@ namespace mobject { * "connect me to the first bus suitable for my stream type" */ OutputDesignation::OutputDesignation (uint relative_busNr) - : spec_() //////////TODO + : spec_(RelativeSpec (relative_busNr)) { } diff --git a/src/proc/mobject/output-designation.hpp b/src/proc/mobject/output-designation.hpp index 4b7769e10..1635b3810 100644 --- a/src/proc/mobject/output-designation.hpp +++ b/src/proc/mobject/output-designation.hpp @@ -26,7 +26,11 @@ #include "proc/asset/pipe.hpp" #include "lib/opaque-holder.hpp" +#include "lib/meta/typelist-util.hpp" +extern "C" { +#include "lib/luid.h" +} namespace mobject { @@ -67,7 +71,6 @@ namespace mobject { // using default copying - private: class TargetSpec { @@ -76,12 +79,17 @@ namespace mobject { PID resolve (PPipe origin); }; - enum{ SPEC_SIZ = sizeof(PID) }; + private: + enum { + SPEC_SIZ = lumiera::typelist::maxSize< + lumiera::typelist::Types::List>::value + }; typedef lib::OpaqueHolder SpecBuff; + /** Storage to hold the Target Spec inline */ SpecBuff spec_; - + };