From 1ac8ab06e9aad3b6d22685255459d71cb49e1f28 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Mon, 9 Nov 2020 09:50:58 +0100 Subject: First program: Can add 2 integers and return result via exit code --- flowgraph/node.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'flowgraph/node.h') diff --git a/flowgraph/node.h b/flowgraph/node.h index 89f6088..853b017 100644 --- a/flowgraph/node.h +++ b/flowgraph/node.h @@ -17,7 +17,12 @@ namespace FlowGraph { class Node { public: + Node(){} + Node(std::vector operands): mOperands(operands) {} + std::vector& operands() { return mOperands; } virtual ~Node() {}; // force class to be polymorphic (e.g. in a container) + private: + std::vector mOperands; }; // Memory on Heap: new and delete @@ -146,13 +151,11 @@ namespace FlowGraph { { public: BinaryOperation(BinaryOperationType type, Data& destination, Data& source0, Data& source1): - m_type(type), m_destination(destination), m_source0(source0), m_source1(source1) + Node(std::vector({destination, source0, source1})), m_type(type) {} + BinaryOperationType type() {return m_type;} private: BinaryOperationType m_type; - Data m_destination; - Data m_source0; - Data m_source1; }; } // namespace FlowGraph -- cgit v1.2.3