aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/dataloader/NodeTools.hpp
diff options
context:
space:
mode:
author hop311 <hop3114@gmail.com>2024-10-27 12:59:12 +0100
committer hop311 <hop3114@gmail.com>2024-10-31 21:05:51 +0100
commit84deeffe04d730064e89b4ceaf508f3f30113ea9 (patch)
treeead850e2e354fce996778423d6cadeb638322b02 /src/openvic-simulation/dataloader/NodeTools.hpp
parent9a5468ceb4361059fcefae1a383a7c29b4f4e7be (diff)
Finish ConditionalWeight base key parsing (including days/months/years)
Diffstat (limited to 'src/openvic-simulation/dataloader/NodeTools.hpp')
-rw-r--r--src/openvic-simulation/dataloader/NodeTools.hpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/openvic-simulation/dataloader/NodeTools.hpp b/src/openvic-simulation/dataloader/NodeTools.hpp
index 51e3e82..43c5092 100644
--- a/src/openvic-simulation/dataloader/NodeTools.hpp
+++ b/src/openvic-simulation/dataloader/NodeTools.hpp
@@ -287,11 +287,14 @@ namespace OpenVic {
ret &= add_key_map_entries(FWD(key_map), FWD(args)...);
return ret;
}
+
template<IsOrderedMap Map>
NodeCallback auto expect_dictionary_key_map_and_length_and_default(
Map&& key_map, LengthCallback auto&& length_callback, KeyValueCallback auto&& default_callback
) {
- return [length_callback = FWD(length_callback), default_callback = FWD(default_callback), key_map = MOV(key_map)](ast::NodeCPtr node) mutable -> bool {
+ return [length_callback = FWD(length_callback), default_callback = FWD(default_callback), key_map = MOV(key_map)](
+ ast::NodeCPtr node
+ ) mutable -> bool {
bool ret = expect_dictionary_and_length(
FWD(length_callback), dictionary_keys_callback(key_map, FWD(default_callback))
)(node);
@@ -335,6 +338,28 @@ namespace OpenVic {
return expect_dictionary_key_map_and_length_and_default(FWD(key_map), FWD(length_callback), FWD(default_callback));
}
+ template<IsOrderedMap Map, typename... Args>
+ NodeCallback auto expect_dictionary_key_map_and_length(
+ Map&& key_map, LengthCallback auto&& length_callback, Args&&... args
+ ) {
+ add_key_map_entries(FWD(key_map), FWD(args)...);
+ return expect_dictionary_key_map_and_length(FWD(key_map), FWD(length_callback));
+ }
+
+ template<IsOrderedMap Map, typename... Args>
+ NodeCallback auto expect_dictionary_key_map_and_default(
+ Map&& key_map, KeyValueCallback auto&& default_callback, Args&&... args
+ ) {
+ add_key_map_entries(FWD(key_map), FWD(args)...);
+ return expect_dictionary_key_map_and_default(FWD(key_map), FWD(default_callback));
+ }
+
+ template<IsOrderedMap Map, typename... Args>
+ NodeCallback auto expect_dictionary_key_map(Map&& key_map, Args&&... args) {
+ add_key_map_entries(FWD(key_map), FWD(args)...);
+ return expect_dictionary_key_map(FWD(key_map));
+ }
+
template<StringMapCase Case = StringMapCaseSensitive, typename... Args>
NodeCallback auto expect_dictionary_keys_and_length_and_default(
LengthCallback auto&& length_callback, KeyValueCallback auto&& default_callback, Args&&... args