diff options
author | Roland Reichwein <mail@reichwein.it> | 2020-11-09 09:50:58 +0100 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2020-11-09 09:50:58 +0100 |
commit | 1ac8ab06e9aad3b6d22685255459d71cb49e1f28 (patch) | |
tree | 95e4ca7de492180aef9d459ee40663b1bf134b66 /flowgraph/node.h | |
parent | db0654fa48ddc07e6bcaaaeddfa301a32806dadc (diff) |
First program: Can add 2 integers and return result via exit code
Diffstat (limited to 'flowgraph/node.h')
-rw-r--r-- | flowgraph/node.h | 11 |
1 files changed, 7 insertions, 4 deletions
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<Data> operands): mOperands(operands) {} + std::vector<Data>& operands() { return mOperands; } virtual ~Node() {}; // force class to be polymorphic (e.g. in a container) + private: + std::vector<Data> 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<Data>({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 |