aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/Modifier.hpp
diff options
context:
space:
mode:
author hop311 <hop3114@gmail.com>2023-10-13 23:04:12 +0200
committer hop311 <hop3114@gmail.com>2023-10-14 12:05:06 +0200
commitd26f9c2fb5a9666822a0f702d76b764600a390d7 (patch)
treec2a13a44d4c8553f6e87193f5f437052cf1d7067 /src/openvic-simulation/Modifier.hpp
parentce6e70d079f4ab18cdfa082032dc3580ab233b0e (diff)
Further CLI and modifier reading work
Diffstat (limited to 'src/openvic-simulation/Modifier.hpp')
-rw-r--r--src/openvic-simulation/Modifier.hpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/openvic-simulation/Modifier.hpp b/src/openvic-simulation/Modifier.hpp
index 663d359..0801aa5 100644
--- a/src/openvic-simulation/Modifier.hpp
+++ b/src/openvic-simulation/Modifier.hpp
@@ -1,5 +1,7 @@
#pragma once
+#include <set>
+
#include "openvic-simulation/types/IdentifierRegistry.hpp"
namespace OpenVic {
@@ -92,12 +94,20 @@ namespace OpenVic {
Date const& get_expiry_date() const;
};
+ template<typename Fn>
+ concept ModifierEffectValidator = std::predicate<Fn, ModifierEffect const&>;
+
struct ModifierManager {
private:
IdentifierRegistry<ModifierEffect> modifier_effects;
IdentifierRegistry<Modifier> modifiers;
+ /* effect_validator takes in ModifierEffect const& */
+ NodeTools::key_value_callback_t _modifier_effect_callback(ModifierValue& modifier,
+ NodeTools::key_value_callback_t default_callback,
+ ModifierEffectValidator auto effect_validator) const;
+
public:
ModifierManager();
@@ -109,9 +119,17 @@ namespace OpenVic {
bool setup_modifier_effects();
+ NodeTools::node_callback_t expect_validated_modifier_value_and_default(NodeTools::callback_t<ModifierValue&&> modifier_callback,
+ NodeTools::key_value_callback_t default_callback, ModifierEffectValidator auto effect_validator) const;
+ NodeTools::node_callback_t expect_validated_modifier_value(NodeTools::callback_t<ModifierValue&&> modifier_callback,
+ ModifierEffectValidator auto effect_validator) const;
+
NodeTools::node_callback_t expect_modifier_value_and_default(NodeTools::callback_t<ModifierValue&&> modifier_callback, NodeTools::key_value_callback_t default_callback) const;
NodeTools::node_callback_t expect_modifier_value(NodeTools::callback_t<ModifierValue&&> modifier_callback) const;
+ NodeTools::node_callback_t expect_whitelisted_modifier_value_and_default(NodeTools::callback_t<ModifierValue&&> modifier_callback, std::set<std::string, std::less<void>> const& whitelist, NodeTools::key_value_callback_t default_callback) const;
+ NodeTools::node_callback_t expect_whitelisted_modifier_value(NodeTools::callback_t<ModifierValue&&> modifier_callback, std::set<std::string, std::less<void>> const& whitelist) const;
+
NodeTools::node_callback_t expect_modifier_value_and_key_map_and_default(NodeTools::callback_t<ModifierValue&&> modifier_callback, NodeTools::key_value_callback_t default_callback, NodeTools::key_map_t&& key_map) const;
NodeTools::node_callback_t expect_modifier_value_and_key_map(NodeTools::callback_t<ModifierValue&&> modifier_callback, NodeTools::key_map_t&& key_map) const;