From 7a325e1b3be04bc54941431458903022da1643ac Mon Sep 17 00:00:00 2001 From: rtk0c Date: Thu, 3 Jun 2021 10:06:55 -0700 Subject: Create template inheritance hierarchy, object value RTTI system --- core/src/Model/Workflow/ValueInternals.hpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 core/src/Model/Workflow/ValueInternals.hpp (limited to 'core/src/Model/Workflow/ValueInternals.hpp') diff --git a/core/src/Model/Workflow/ValueInternals.hpp b/core/src/Model/Workflow/ValueInternals.hpp new file mode 100644 index 0000000..49981f0 --- /dev/null +++ b/core/src/Model/Workflow/ValueInternals.hpp @@ -0,0 +1,21 @@ +// This file contains utility classes and macros for implementing values +// As consumers, you should not include this header as it contains unnecessary symbols and can pollute your files +// for this reason, classes here aren't forward-declared in fwd.hpp either. + +#pragma once + +#include "Utils/RTTI.hpp" + +#include + +#define CHECK_VALUE_TYPE(Type, value) \ + if (!is_a(value)) { \ + return false; \ + } + +#define CHECK_VALUE_TYPE_AND_MOVE(Type, dest, value) \ + if (auto ptr = dyn_cast(value)) { \ + dest = std::move(*ptr); \ + } else { \ + return false; \ + } -- cgit v1.2.3-70-g09d2