aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/dataloader/NodeTools.hpp
diff options
context:
space:
mode:
author George L. Albany <Megacake1234@gmail.com>2023-10-20 10:42:00 +0200
committer GitHub <noreply@github.com>2023-10-20 10:42:00 +0200
commit910d6cd73d7b1857ff481e1af060e780ec27d800 (patch)
tree3a3c32d8f631fefda101ec3b47147da3bb81e297 /src/openvic-simulation/dataloader/NodeTools.hpp
parent1484dd3aa73489cc66572f1c431e08c610e201af (diff)
parentd2e91829abc8dd46fa4685d1cab89ef6fe907471 (diff)
Merge pull request #62 from OpenVicProject/cleanup
Diffstat (limited to 'src/openvic-simulation/dataloader/NodeTools.hpp')
-rw-r--r--src/openvic-simulation/dataloader/NodeTools.hpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/openvic-simulation/dataloader/NodeTools.hpp b/src/openvic-simulation/dataloader/NodeTools.hpp
index f06a85f..66b614a 100644
--- a/src/openvic-simulation/dataloader/NodeTools.hpp
+++ b/src/openvic-simulation/dataloader/NodeTools.hpp
@@ -4,6 +4,7 @@
#include <cstdint>
#include <functional>
#include <map>
+#include <set>
#include <type_traits>
#include <openvic-dataloader/v2script/AbstractSyntaxTree.hpp>
@@ -16,10 +17,13 @@ namespace OpenVic {
namespace ast = ovdl::v2script::ast;
/* Template for map from strings to Ts, in which string_views can be
- * searched for without needing to be copied into a string, */
+ * searched for without needing to be copied into a string */
template<typename T>
using string_map_t = std::map<std::string, T, std::less<void>>;
+ /* String set type supporting heterogeneous key lookup */
+ using string_set_t = std::set<std::string, std::less<void>>;
+
namespace NodeTools {
template<typename Fn, typename Return = void, typename ...Args>
@@ -93,9 +97,11 @@ namespace OpenVic {
});
}
+ callback_t<std::string_view> expect_fixed_point_str(callback_t<fixed_point_t> callback);
node_callback_t expect_fixed_point(callback_t<fixed_point_t> callback);
node_callback_t expect_colour(callback_t<colour_t> callback);
+ callback_t<std::string_view> expect_date_str(callback_t<Date> callback);
node_callback_t expect_date(callback_t<Date> callback);
node_callback_t expect_years(callback_t<Timespan> callback);
node_callback_t expect_months(callback_t<Timespan> callback);