Antares Simulator
Power System Simulator
context.h
1 /*
2  * Copyright 2007-2025, RTE (https://www.rte-france.com)
3  * See AUTHORS.txt
4  * SPDX-License-Identifier: MPL-2.0
5  * This file is part of Antares-Simulator,
6  * Adequacy and Performance assessment for interconnected energy networks.
7  *
8  * Antares_Simulator is free software: you can redistribute it and/or modify
9  * it under the terms of the Mozilla Public Licence 2.0 as published by
10  * the Mozilla Foundation, either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * Antares_Simulator is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * Mozilla Public Licence 2.0 for more details.
17  *
18  * You should have received a copy of the Mozilla Public Licence 2.0
19  * along with Antares_Simulator. If not, see <https://opensource.org/license/mpl-2-0/>.
20  */
21 #ifndef __ANTARES_LIBS_STUDY_ACTION_CONTEXT_H__
22 #define __ANTARES_LIBS_STUDY_ACTION_CONTEXT_H__
23 
24 #include <yuni/yuni.h>
25 #include <antares/study/study.h>
26 #include <map>
27 #include <yuni/core/string.h>
28 #include <yuni/core/bind.h>
29 #include <memory>
30 #include "action.h"
31 #include <antares/study/binding_constraint/BindingConstraintsRepository.h>
32 
33 namespace Antares::Action
34 {
35 class Context
36 {
37 public:
38  using Ptr = std::shared_ptr<Context>;
40  using Properties = std::map<Yuni::String, Yuni::String>;
42  using LocalView = std::map<Yuni::CString<50, false>, IAction::Ptr>;
43  using Views = std::map<Yuni::CString<50, false>, LocalView>;
44 
46  using AreaNameMappingForceCreate = std::map<Data::AreaName, bool>;
47  using PlantNameMappingForceCreate = std::map<Data::AreaName, bool>;
48  using ConstraintMappingForceCreate = std::map<Data::ConstraintName, bool>;
49 
50 public:
52 
53  explicit Context(Data::Study::Ptr targetStudy, const size_t layer = 0);
55  ~Context() = default;
57 
61  void reset();
62 
63 public:
65  Data::Study::Ptr study;
67  Data::Study::Ptr extStudy;
68 
69  // The current Layer
70  const size_t layerID;
71 
81  std::shared_ptr<Data::BindingConstraint> constraint;
82 
84  Views view;
87 
90  Data::Area::NameMapping areaLowerNameMapping;
93  PlantNameMappingForceCreate clusterForceCreate;
94  ConstraintMappingForceCreate constraintForceCreate;
95 
97  Yuni::String message;
99  Yuni::Bind<void(const Yuni::String&)> updateMessageUI;
100 
102 
103  Data::Area::Vector autoselectAreas;
110 
111 }; // class Context
112 
113 } // namespace Antares::Action
114 
115 #endif // __ANTARES_LIBS_STUDY_ACTION_CONTEXT_H__
Definition: context.h:36
Data::AreaLink::Vector autoselectLinks
List of links to select after the paste.
Definition: context.h:106
Data::AreaLink * link
The current Link.
Definition: context.h:77
Data::Study::Ptr extStudy
An optional external study, which will be destroyed with this class.
Definition: context.h:67
Data::Area::NameMapping areaNameMapping
Area name mapping.
Definition: context.h:89
void reset()
Reset internal data.
Definition: context.cpp:40
~Context()=default
Destructor.
Data::ThermalCluster * originalPlant
The original cluster name.
Definition: context.h:79
Views view
Views.
Definition: context.h:84
std::map< Data::AreaName, bool > AreaNameMappingForceCreate
Area name mapping.
Definition: context.h:46
Yuni::Bind< void(const Yuni::String &)> updateMessageUI
Delegate to update the interface.
Definition: context.h:99
std::shared_ptr< Data::BindingConstraint > constraint
The current constraint.
Definition: context.h:81
std::map< Yuni::CString< 50, false >, IAction::Ptr > LocalView
Local view.
Definition: context.h:42
AreaNameMappingForceCreate areaForceCreate
Area name mapping, force creation.
Definition: context.h:92
Yuni::String message
Temporary string for message formatting.
Definition: context.h:97
std::map< Yuni::String, Yuni::String > Properties
Map of properties.
Definition: context.h:40
Data::BindingConstraintsRepository::Vector autoselectConstraints
List of binding constraints to select after the paste.
Definition: context.h:108
Data::Area::Vector autoselectAreas
List of areas to select after the paste.
Definition: context.h:104
Data::Study::Ptr study
The target study.
Definition: context.h:65
Data::Area * area
The current Area.
Definition: context.h:73
Properties property
All properties.
Definition: context.h:86
Data::ThermalCluster * cluster
The current Thermal cluster.
Definition: context.h:75
AncestorType::Ptr Ptr
The most suitable smart ptr for the class.
Definition: action.h:41
Definition for a single area.
Definition: area.h:51
std::map< AreaName, AreaName > NameMapping
Name mapping -> must be replaced by AreaNameMapping.
Definition: area.h:62
std::vector< std::shared_ptr< BindingConstraint > > Vector
Vector of binding constraints.
Definition: BindingConstraintsRepository.h:39
A single thermal cluster.
Definition: cluster.h:76