aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/dataloader/NodeTools.hpp
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2024-10-31 21:20:11 +0100
committer GitHub <noreply@github.com>2024-10-31 21:20:11 +0100
commit968c60580997d26035496cc675138e580354332f (patch)
treea0340ae5e92e219c5e0f5ddc825e28465f22a29e /src/openvic-simulation/dataloader/NodeTools.hpp
parentc6f7c8047abbe0a91b2a88365eee2259d8a91a65 (diff)
parent84deeffe04d730064e89b4ceaf508f3f30113ea9 (diff)
Merge pull request #218 from OpenVicProject/condition-scripts-prep-work
Condition scripts prep work
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