diff --git a/include/ion/graph.h b/include/ion/graph.h index ef7626fd..35efda6c 100644 --- a/include/ion/graph.h +++ b/include/ion/graph.h @@ -10,14 +10,13 @@ namespace ion { class Builder; class Graph { +public: struct Impl; -public: - Graph(); - Graph(Builder builder, const std::string& name = ""); + Graph(Builder & builder , const std::string& name = ""); Graph& operator+=(const Graph& rhs); diff --git a/src/graph.cc b/src/graph.cc index b3ddff04..9218db81 100644 --- a/src/graph.cc +++ b/src/graph.cc @@ -7,7 +7,7 @@ namespace ion { struct Graph::Impl { - Builder builder; + Builder & builder; std::string name; GraphID id; std::vector nodes; @@ -17,10 +17,8 @@ struct Graph::Impl { std::unique_ptr jit_ctx; Halide::JITUserContext* jit_ctx_ptr; std::vector args; - Impl() - : id(sole::uuid4().str()) - {} - Impl(Builder b, const std::string& n) + + Impl(Builder & b, const std::string& n) : id(sole::uuid4().str()), builder(b), name(n), jit_ctx(new Halide::JITUserContext), jit_ctx_ptr(jit_ctx.get()) { } @@ -30,7 +28,7 @@ Graph::Graph() { } -Graph::Graph(Builder builder, const std::string& name) +Graph::Graph(Builder & builder, const std::string& name) : impl_(new Impl(builder, name)) { } @@ -52,7 +50,6 @@ Graph operator+(const Graph& lhs, const Graph& rhs) Node Graph::add(const std::string& name) { auto n = impl_->builder.add(name,impl_->id); - impl_->nodes.push_back(n); return n; }