blob: fcab0a6723fa6371db6f71c577e48274dc40c8fd (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#pragma once
#include <variant>
#include <vector>
#include "openvic-simulation/dataloader/NodeTools.hpp"
#include "openvic-simulation/scripts/ConditionScript.hpp"
#include "openvic-simulation/types/fixed_point/FixedPoint.hpp"
namespace OpenVic {
struct ConditionalWeight {
using condition_weight_t = std::pair<fixed_point_t, ConditionScript>;
using condition_weight_group_t = std::vector<condition_weight_t>;
using condition_weight_item_t = std::variant<condition_weight_t, condition_weight_group_t>;
enum class base_key_t : uint8_t {
BASE, FACTOR, TIME
};
using enum base_key_t;
private:
fixed_point_t PROPERTY(base);
std::vector<condition_weight_item_t> PROPERTY(condition_weight_items);
scope_type_t PROPERTY(initial_scope);
scope_type_t PROPERTY(this_scope);
scope_type_t PROPERTY(from_scope);
struct parse_scripts_visitor_t;
public:
ConditionalWeight(scope_type_t new_initial_scope, scope_type_t new_this_scope, scope_type_t new_from_scope);
ConditionalWeight(ConditionalWeight&&) = default;
NodeTools::node_callback_t expect_conditional_weight(base_key_t base_key);
bool parse_scripts(DefinitionManager const& definition_manager);
};
}
|