Fennel: /home/pub/open/dev/fennel/exec/ExecStreamGraph.h Source File (original) (raw)
00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 #ifndef Fennel_ExecStreamGraph_Included 00025 #define Fennel_ExecStreamGraph_Included 00026 00027 #include "fennel/common/ClosableObject.h" 00028 #include 00029 #include <boost/utility.hpp> 00030 00031 FENNEL_BEGIN_NAMESPACE 00032 00037 typedef uint ExecStreamId; 00038 00039 class ExecStreamGraphImpl; 00040 class ExecStreamScheduler; 00041 00059 class FENNEL_EXEC_EXPORT ExecStreamGraph 00060 : public boost::noncopyable, 00061 public ClosableObject 00062 { 00063 friend class ExecStreamScheduler; 00064 00065 protected: 00073 ExecStreamScheduler *pScheduler; 00074 00078 SharedDynamicParamManager pDynamicParamManager; 00079 00080 explicit ExecStreamGraph(); 00081 00082 public: 00088 static SharedExecStreamGraph newExecStreamGraph(); 00089 00090 virtual ~ExecStreamGraph(); 00091 00095 inline ExecStreamScheduler *getScheduler() const; 00096 00100 inline SharedDynamicParamManager getDynamicParamManager(); 00101 00108 virtual void setTxn( 00109 SharedLogicalTxn pTxn) = 0; 00110 00117 virtual void setErrorTarget( 00118 SharedErrorTarget pErrorTarget) = 0; 00119 00126 virtual void setScratchSegment( 00127 SharedSegment pScratchSegment) = 0; 00128 00134 virtual void setResourceGovernor( 00135 SharedExecStreamGovernor pResourceGovernor) = 0; 00136 00140 virtual SharedLogicalTxn getTxn() = 0; 00141 00145 virtual TxnId getTxnId() = 0; 00146 00157 virtual void enableDummyTxnId(bool enabled) = 0; 00158 00162 virtual SharedExecStreamGovernor getResourceGovernor() = 0; 00163 00169 virtual void addStream( 00170 SharedExecStream pStream) = 0; 00171 00177 virtual void removeStream(ExecStreamId) = 0; 00178 00190 virtual void addDataflow( 00191 ExecStreamId producerId, 00192 ExecStreamId consumerId, 00193 bool isImplicit = false) = 0; 00194 00200 virtual void addOutputDataflow( 00201 ExecStreamId producerId) = 0; 00202 00208 virtual void addInputDataflow( 00209 ExecStreamId consumerId) = 0; 00210 00217 virtual void mergeFrom(ExecStreamGraph& src) = 0; 00218 00226 virtual void mergeFrom( 00227 ExecStreamGraph& src, 00228 std::vector const& nodes) = 0; 00229 00237 virtual SharedExecStream findStream( 00238 std::string name) = 0; 00239 00249 virtual SharedExecStream findLastStream( 00250 std::string name, 00251 uint iOutput) = 0; 00252 00264 virtual void interposeStream( 00265 std::string name, 00266 uint iOutput, 00267 ExecStreamId interposedId) = 0; 00268 00275 virtual void prepare(ExecStreamScheduler &scheduler) = 0; 00276 00281 virtual void open() = 0; 00282 00290 virtual SharedExecStream getStream(ExecStreamId id) = 0; 00291 00299 virtual uint getInputCount( 00300 ExecStreamId streamId) = 0; 00301 00309 virtual uint getOutputCount( 00310 ExecStreamId streamId) = 0; 00311 00321 virtual SharedExecStream getStreamInput( 00322 ExecStreamId streamId, 00323 uint iInput) = 0; 00324 00334 virtual SharedExecStreamBufAccessor getStreamInputAccessor( 00335 ExecStreamId streamId, 00336 uint iInput) = 0; 00337 00347 virtual SharedExecStream getStreamOutput( 00348 ExecStreamId streamId, 00349 uint iOutput) = 0; 00350 00360 virtual SharedExecStreamBufAccessor getStreamOutputAccessor( 00361 ExecStreamId streamId, 00362 uint iOutput) = 0; 00363 00369 virtual std::vector getSortedStreams() = 0; 00370 00375 virtual int getStreamCount() = 0; 00376 00381 virtual int getDataflowCount() = 0; 00382 00389 virtual void renderGraphviz(std::ostream &dotStream) = 0; 00390 00394 virtual bool isAcyclic() = 0; 00395 00401 virtual void closeProducers(ExecStreamId streamId) = 0; 00402 00409 virtual void declareDynamicParamWriter( 00410 ExecStreamId streamId, 00411 DynamicParamId dynamicParamId) = 0; 00412 00419 virtual void declareDynamicParamReader( 00420 ExecStreamId streamId, 00421 DynamicParamId dynamicParamId) = 0; 00422 00429 virtual const std::vector &getDynamicParamWriters( 00430 DynamicParamId dynamicParamId) = 0; 00431 00432 00439 virtual const std::vector &getDynamicParamReaders( 00440 DynamicParamId dynamicParamId) = 0; 00441 00442 }; 00443 00444 inline ExecStreamScheduler *ExecStreamGraph::getScheduler() const 00445 { 00446 return pScheduler; 00447 } 00448 00449 inline SharedDynamicParamManager ExecStreamGraph::getDynamicParamManager() 00450 { 00451 return pDynamicParamManager; 00452 } 00453 00454 FENNEL_END_NAMESPACE 00455 00456 #endif 00457 00458