summaryrefslogtreecommitdiffhomepage
path: root/flowgraph/graph.h
blob: 15c6aef154d0ffcb451cc9491f36270d197e3b34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#pragma once

#include "node.h"

#include <deque>
#include <exception>
#include <memory>
#include <stdexcept>

namespace FlowGraph {

 class Graph: public std::deque<std::shared_ptr<Node>>
 {
 public:
  Graph();
  Graph(const std::deque<std::shared_ptr<Node>>& nodes);
  Graph(const Graph& other) = default;
  ~Graph();

  Graph& operator= (const Graph&) = default;

  // returns the outermost scope inside this graph
  LocalScope& scope() const;

  // append other graph by joining the respective outermost scopes
  void append(const Graph& other);
  
  void append(std::shared_ptr<Node> node);

  std::shared_ptr<Node> lastOp() const;
 };

}