Classes | Functions
test_pipegraph.cxx File Reference
#include "WireCellPgraph/Graph.h"
#include <iostream>
#include <sstream>

Go to the source code of this file.

Classes

class  IdNode
 
class  Source< OutputType >
 
class  Sink< InputType >
 
class  Njoin
 
class  SplitQueueBuffer
 
class  Nfan
 
class  Func
 

Functions

int main ()
 

Function Documentation

int main ( void  )

Definition at line 189 of file test_pipegraph.cxx.

189  {
190  using Pgraph::Node;
191  using Pgraph::Graph;
192 
193  int count = 0;
194  auto src1 = new Source(count++, 0,4);
195  auto src2 = new Source(count++, 10,14);
196  auto dst1 = new Sink(count++);
197  auto dst2 = new Sink(count++);
198  auto fun1 = new Func(count++);
199  auto fun2 = new Func(count++);
200  auto fun3 = new Func(count++);
201  auto fan1 = new Nfan(count++, 2);
202  auto joi1 = new Njoin(count++, 2);
203  auto sqb1 = new SplitQueueBuffer(count++);
204 
205 
206  Graph g;
207  g.connect(src1,fun1);
208  g.connect(fun1,fan1);
209  g.connect(fan1,dst1);
210  g.connect(fan1,fun2,1);
211  g.connect(fun2,joi1);
212  g.connect(src2,fun3);
213  g.connect(fun3,joi1,0,1);
214  g.connect(joi1,sqb1);
215  g.connect(sqb1,dst2);
216 
217  auto sorted = g.sort_kahn();
218  cout << "Sorted to " << sorted.size() << " nodes\n";
219 
220  for (size_t ind=0; ind<sorted.size(); ++ind) {
221  IdNode* idn = dynamic_cast<IdNode*>(sorted[ind]);
222  idn->msg("at index ") << ind << endl;
223  }
224  cout << "Executing:\n";
225 
226  g.execute();
227 
228 }
QMapNodeBase Node
Definition: qmap.cpp:41
static const double g
Definition: Units.h:145
boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, VertexData, boost::property< boost::edge_weight_t, double, EdgeData > > Graph
define the boost-graph
std::ostream & msg(const std::string s)
QTextStream & endl(QTextStream &s)