finish OutputDesignation definition and outline. (closes #312)

This commit is contained in:
Fischlurch 2010-11-19 19:10:24 +01:00
parent 9473fd3d67
commit 272f3d75ff
2 changed files with 67 additions and 6 deletions

View file

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

View file

@ -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<PID,lumiera_uid,uint>::List>::value
};
typedef lib::OpaqueHolder<TargetSpec, SPEC_SIZ> SpecBuff;
/** Storage to hold the Target Spec inline */
SpecBuff spec_;
};