aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/dataloader/NodeTools.hpp
diff options
context:
space:
mode:
author zaaarf <me@zaaarf.foo>2024-05-15 10:57:21 +0200
committer Spartan322 <Megacake1234@gmail.com>2024-07-07 01:11:10 +0200
commit71b846dc5dd1ac49626c8b479571050224a4cca1 (patch)
treed38d333b55e6ec42c28adf4554153aad378159fc /src/openvic-simulation/dataloader/NodeTools.hpp
parent8c8b9349e26b4f606e18810a201ff378eaac19b2 (diff)
Update OpenVicProject/OpenVic-Dataloader@4a49007dryad
Update .clang-format categories Move type_name and SelfType functioanlity to utility/Getters
Diffstat (limited to 'src/openvic-simulation/dataloader/NodeTools.hpp')
-rw-r--r--src/openvic-simulation/dataloader/NodeTools.hpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/openvic-simulation/dataloader/NodeTools.hpp b/src/openvic-simulation/dataloader/NodeTools.hpp
index 92682e7..b0bb723 100644
--- a/src/openvic-simulation/dataloader/NodeTools.hpp
+++ b/src/openvic-simulation/dataloader/NodeTools.hpp
@@ -14,10 +14,32 @@
#include "openvic-simulation/types/HasIdentifier.hpp"
#include "openvic-simulation/types/OrderedContainers.hpp"
#include "openvic-simulation/types/Vector.hpp"
+#include "openvic-simulation/utility/Getters.hpp"
#include "openvic-simulation/utility/TslHelper.hpp"
namespace OpenVic {
- namespace ast = ovdl::v2script::ast;
+ namespace ast {
+ using namespace ovdl::v2script::ast;
+ using NodeCPtr = const Node*;
+
+ constexpr std::string_view get_type_name(NodeKind kind) {
+#define NODE_CASE(Node) \
+ case Node: return OpenVic::utility::type_name<ast::Node>();
+ switch (kind) {
+ using enum NodeKind;
+ NODE_CASE(FileTree);
+ NODE_CASE(IdentifierValue);
+ NODE_CASE(StringValue);
+ NODE_CASE(ListValue);
+ NODE_CASE(NullValue);
+ NODE_CASE(EventStatement);
+ NODE_CASE(AssignStatement);
+ NODE_CASE(ValueStatement);
+ default: ovdl::detail::unreachable();
+ }
+ }
+#undef NODE_CASE
+ }
using name_list_t = std::vector<std::string>;
std::ostream& operator<<(std::ostream& stream, name_list_t const& name_list);