aboutsummaryrefslogtreecommitdiff
path: root/core/src/Model/Workflow/ValueInternals.hpp
diff options
context:
space:
mode:
authorrtk0c <[email protected]>2021-06-03 10:06:55 -0700
committerrtk0c <[email protected]>2021-06-03 10:06:55 -0700
commit7a325e1b3be04bc54941431458903022da1643ac (patch)
treeaa76ab5b243fb351693645bfe2d2841019a45c5a /core/src/Model/Workflow/ValueInternals.hpp
parent016d58996db755630f8b41ddbef67516fe0c13b2 (diff)
Create template inheritance hierarchy, object value RTTI system
Diffstat (limited to 'core/src/Model/Workflow/ValueInternals.hpp')
-rw-r--r--core/src/Model/Workflow/ValueInternals.hpp21
1 files changed, 21 insertions, 0 deletions
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 <utility>
+
+#define CHECK_VALUE_TYPE(Type, value) \
+ if (!is_a<Type>(value)) { \
+ return false; \
+ }
+
+#define CHECK_VALUE_TYPE_AND_MOVE(Type, dest, value) \
+ if (auto ptr = dyn_cast<Type>(value)) { \
+ dest = std::move(*ptr); \
+ } else { \
+ return false; \
+ }