summaryrefslogtreecommitdiffhomepage
path: root/flowgraph/graph.h
blob: c0ab847ac075f1e1c842a7558c6ea7a60df258be (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
  std::shared_ptr<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;
 };

}