From 71c7fd62f8b5257b82cf32b0f747fcf313fcc617 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Fri, 6 Nov 2020 18:20:34 +0100 Subject: Prepare Token/Node handling --- flowgraph/node.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'flowgraph/node.cpp') diff --git a/flowgraph/node.cpp b/flowgraph/node.cpp index fc55ef6..f81a7e1 100644 --- a/flowgraph/node.cpp +++ b/flowgraph/node.cpp @@ -2,8 +2,25 @@ #include "data.h" +#include + using namespace FlowGraph; -Data FlowGraph::MakeLocalPointer(const std::string& name) { return Data(DataType::Pointer, std::make_shared(name)); } -Data FlowGraph::MakeLocalSize(const std::string& name) { return Data(DataType::Size, std::make_shared(name)); } +// 4 byte for now +Data FlowGraph::MakeConstantInt(int i) +{ + std::vector value(size_t(4)); + *(reinterpret_cast(value.data())) = boost::endian::native_to_little(static_cast(i)); + return Data(DataType::Int, std::make_shared(value)); +} + +Data FlowGraph::MakeLocalPointer(const std::string& name) +{ + return Data(DataType::Pointer, std::make_shared(name)); +} + +Data FlowGraph::MakeLocalSize(const std::string& name) +{ + return Data(DataType::Size, std::make_shared(name)); +} -- cgit v1.2.3