main.cpp 1.08 KB
Newer Older
1
// Headers are available because we added the pls target
2 3
#include <string>
#include <cstdio>
4
#include <tuple>
5

6
#include <pls/pls.h>
7
#include <pls/dataflow/graph.h>
8
#include <pls/dataflow/internal/token.h>
9

10
int main() {
11
  using namespace pls::dataflow;
12

13 14 15
  graph<inputs<int, int>, outputs<int, int>, 2> graph2;
  graph2.input<0>() >> graph2.output<1>();
  graph2.input<1>() >> graph2.output<0>();
16

17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
  graph<inputs<int, int>, outputs<int, int>, 2> graph1;
  graph1.input<0>() >> graph2.external_input<0>();
  graph1.input<1>() >> graph2.external_input<1>();
  graph2.external_output<0>() >> graph1.output<0>();
  graph2.external_output<1>() >> graph1.output<1>();

  graph1.push_input(1, 2);
  graph1.push_input(3, 4);

  auto result1 = graph1.get_output();
  std::cout << std::get<0>(result1) << ", " << std::get<1>(result1) << std::endl;

  graph1.push_input(5, 6);

  auto result2 = graph1.get_output();
  std::cout << std::get<0>(result2) << ", " << std::get<1>(result2) << std::endl;

  auto result3 = graph1.get_output();
  std::cout << std::get<0>(result3) << ", " << std::get<1>(result3) << std::endl;
36
}