Fennel: ExecStreamGraphEmbryo Class Reference (original) (raw)

ExecStreamGraphEmbryo encapsulates the "embryonic" state of an ExecStreamGraph as its constituent embryonic streams are built up. More...

#include <[ExecStreamGraphEmbryo.h](ExecStreamGraphEmbryo%5F8h-source.html)>

List of all members.

Public Member Functions
ExecStreamGraphEmbryo (SharedExecStreamGraph pGraph, SharedExecStreamScheduler pScheduler, SharedCache pCache, SharedSegmentFactory pSegmentFactory)
virtual ~ExecStreamGraphEmbryo ()
void initStreamParams (ExecStreamParams &params)
Initializes a stream's generic parameters.
ExecStreamGraph & getGraph ()
**Returns:**graph being built
SegmentAccessor & getScratchAccessor ()
**Returns:**accessor for graph's scratch segment
SharedExecStream addAdapterFor (const std::string &name, uint iOutput, ExecStreamBufProvision requiredDataFlow)
Ensures that a producer is capable of the specified buffer provisioning requirements.
void saveStreamEmbryo (ExecStreamEmbryo &embryo)
Registers a newly created, unprepared stream and adds it to the graph.
ExecStreamEmbryo & getStreamEmbryo (const std::string &name)
Looks up a registered stream.
void addDataflow (const std::string &source, const std::string &target, bool isImplicit=false)
Adds dataflow to graph, from one stream's output, after adapters, to another stream.
void prepareGraph (SharedTraceTarget pTraceTarget, std::string const &tracePrefix)
Prepares graph and all of its streams.
Private Types
typedef std::map< std::string, ExecStreamEmbryo > StreamMap
typedef StreamMap::const_iterator StreamMapConstIter
typedef StreamMap::iterator StreamMapIter
Private Member Functions
void initializeAdapter (ExecStreamEmbryo &embryo, std::string const &streamName, uint iOutput, std::string const &adapterName)
Initializes a new adapter stream.
Private Attributes
SharedExecStreamGraph pGraph
Unprepared graph.
SharedExecStreamScheduler pScheduler
Scheduler which will execute streams.
SharedCacheAccessor pCacheAccessor
Default cache accessor to be used by streams.
SegmentAccessor scratchAccessor
Default scratch segment accessor to be used by streams.
StreamMap allStreamEmbryos
Streams to be linked and prepared, mapped by name.

Detailed Description

ExecStreamGraphEmbryo encapsulates the "embryonic" state of an ExecStreamGraph as its constituent embryonic streams are built up.

Version:

Id

//open/dev/fennel/exec/ExecStreamGraphEmbryo.h#14

Definition at line 41 of file ExecStreamGraphEmbryo.h.


Member Typedef Documentation


Constructor & Destructor Documentation

| ExecStreamGraphEmbryo::~ExecStreamGraphEmbryo | ( | | ) | [virtual] | | ---------------------------------------------- | - | | - | ----------- |


Member Function Documentation

void ExecStreamGraphEmbryo::initializeAdapter ( ExecStreamEmbryo & embryo,
std::string const & streamName,
uint iOutput,
std::string const & adapterName
) [private]

Ensures that a producer is capable of the specified buffer provisioning requirements.

If producer is not capable, an adapter stream is appended to supply the required buffer provisioning.

The "producer" may be a single stream or may be a chain of streams. In either case, the adapter is appended to the end of the group under the name of the original stream. It is named according to the last stream: _lastName_#_iOutput_.provisioner

Parameters:

name name of original stream
iOutput ordinal of the output within the producer
requiredDataFlow buffer provisioning requirement

Returns:

adapted stream

Definition at line 58 of file ExecStreamGraphEmbryo.cpp.

References BUFPROV_CONSUMER, BUFPROV_NONE, BUFPROV_PRODUCER, ExecStreamEmbryo::getStream(), initializeAdapter(), pGraph, and pScheduler.

Referenced by addDataflow(), and ExecStreamBuilder::buildStreamGraph().

00062 { 00063
00064
00065
00066 00067
00068 SharedExecStream pLastStream = pGraph->findLastStream(name, iOutput); 00069 ExecStreamBufProvision availableDataflow = 00070 pLastStream->getOutputBufProvision(); 00071 assert(availableDataflow != BUFPROV_NONE); 00072 00073
00074 std::string adapterName; 00075 { 00076 int id = pGraph->getOutputCount(pLastStream->getStreamId()); 00077 std::ostringstream oss; 00078 oss << pLastStream->getName() << "#" << id << ".provisioner"; 00079 adapterName = oss.str(); 00080 } 00081 00082
00083 switch (requiredDataflow) { 00084 case BUFPROV_CONSUMER: 00085 if (availableDataflow == BUFPROV_PRODUCER) { 00086 ExecStreamEmbryo embryo; 00087 pScheduler->createCopyProvisionAdapter(embryo); 00088 initializeAdapter(embryo, name, iOutput, adapterName); 00089 return embryo.getStream(); 00090 } 00091 break; 00092 case BUFPROV_PRODUCER: 00093 if (availableDataflow == BUFPROV_CONSUMER) { 00094 ExecStreamEmbryo embryo; 00095 pScheduler->createBufferProvisionAdapter(embryo); 00096 initializeAdapter(embryo, name, iOutput, adapterName); 00097 return embryo.getStream(); 00098 } 00099 break; 00100 default: 00101 permAssert(false); 00102 } 00103 return pLastStream; 00104 }

ExecStreamEmbryo & ExecStreamGraphEmbryo::getStreamEmbryo ( const std::string & name )
void ExecStreamGraphEmbryo::addDataflow ( const std::string & source,
const std::string & target,
bool isImplicit = false
)

Adds dataflow to graph, from one stream's output, after adapters, to another stream.

Parameters:

source name of source stream
target name of target stream
isImplicit false (the default) if the edge represents direct dataflow; true if the edge represents an implicit dataflow dependency

Definition at line 133 of file ExecStreamGraphEmbryo.cpp.

References addAdapterFor(), BUFPROV_NONE, and pGraph.

Referenced by ExecStreamBuilder::buildStreamInputs(), and ExecStreamBuilder::buildStreamOutputs().

00137 { 00138 SharedExecStream pSourceStream = 00139 pGraph->findStream(source); 00140 SharedExecStream pTargetStream = 00141 pGraph->findStream(target); 00142 SharedExecStream pInput; 00143 if (isImplicit) { 00144 pInput = pSourceStream; 00145 } else { 00146 uint iOutput = pGraph->getOutputCount(pSourceStream->getStreamId()); 00147 ExecStreamBufProvision requiredConversion = 00148 pSourceStream->getOutputBufConversion(); 00149 if (requiredConversion != BUFPROV_NONE) { 00150 addAdapterFor(source, iOutput, requiredConversion); 00151 } 00152 ExecStreamBufProvision requiredDataflow = 00153 pTargetStream->getInputBufProvision(); 00154 addAdapterFor(source, iOutput, requiredDataflow); 00155 pInput = pGraph->findLastStream(source, iOutput); 00156 } 00157 pGraph->addDataflow( 00158 pInput->getStreamId(), 00159 pTargetStream->getStreamId(), 00160 isImplicit); 00161 }

void ExecStreamGraphEmbryo::prepareGraph ( SharedTraceTarget pTraceTarget,
std::string const & tracePrefix
)

Member Data Documentation


The documentation for this class was generated from the following files:


Generated on Mon Jun 22 04:00:30 2009 for Fennel by doxygen 1.5.1