aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/dataloader
diff options
context:
space:
mode:
Diffstat (limited to 'src/openvic-simulation/dataloader')
-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