aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/scripts/ConditionScript.hpp
blob: 0e0942225da6c3c75b1c70088a2e152e6df82a41 (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
#pragma once

#include "openvic-simulation/scripts/Condition.hpp"
#include "openvic-simulation/scripts/Script.hpp"

namespace OpenVic {
   struct DefinitionManager;

   struct ConditionScript final : Script<DefinitionManager const&> {

   private:
      ConditionNode PROPERTY_REF(condition_root);
      scope_type_t PROPERTY(initial_scope);
      scope_type_t PROPERTY(this_scope);
      scope_type_t PROPERTY(from_scope);

   protected:
      bool _parse_script(ast::NodeCPtr root, DefinitionManager const& definition_manager) override;

   public:
      ConditionScript(scope_type_t new_initial_scope, scope_type_t new_this_scope, scope_type_t new_from_scope);

      bool execute(
         InstanceManager const& instance_manager,
         ConditionNode::scope_t const& initial_scope,
         ConditionNode::scope_t const& this_scope,
         ConditionNode::scope_t const& from_scope
      ) const;
   };
}