Antares Simulator
Power System Simulator
Loading...
Searching...
No Matches
context.h
1/*
2** Copyright 2007-2024, 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
33namespace Antares
34{
35namespace Action
36{
38{
39public:
40 using Ptr = std::shared_ptr<Context>;
42 using Properties = std::map<Yuni::String, Yuni::String>;
44 using LocalView = std::map<Yuni::CString<50, false>, IAction::Ptr>;
45 using Views = std::map<Yuni::CString<50, false>, LocalView>;
46
48 using AreaNameMappingForceCreate = std::map<Data::AreaName, bool>;
49 using PlantNameMappingForceCreate = std::map<Data::AreaName, bool>;
50 using ConstraintMappingForceCreate = std::map<Data::ConstraintName, bool>;
51
52public:
54
55 explicit Context(Data::Study::Ptr targetStudy, const size_t layer = 0);
57 ~Context() = default;
59
63 void reset();
64
65public:
67 Data::Study::Ptr study;
69 Data::Study::Ptr extStudy;
70
71 // The current Layer
72 const size_t layerID;
73
83 std::shared_ptr<Data::BindingConstraint> constraint;
84
86 Views view;
89
92 Data::Area::NameMapping areaLowerNameMapping;
95 PlantNameMappingForceCreate clusterForceCreate;
96 ConstraintMappingForceCreate constraintForceCreate;
97
99 Yuni::String message;
101 Yuni::Bind<void(const Yuni::String&)> updateMessageUI;
102
104
105
106 Data::Area::Vector autoselectAreas;
112
113}; // class Context
114
115} // namespace Action
116} // namespace Antares
117
118#endif // __ANTARES_LIBS_STUDY_ACTION_CONTEXT_H__
Definition context.h:38
Data::AreaLink::Vector autoselectLinks
List of links to select after the paste.
Definition context.h:108
Data::AreaLink * link
The current Link.
Definition context.h:79
Data::Study::Ptr extStudy
An optional external study, which will be destroyed with this class.
Definition context.h:69
Data::Area::NameMapping areaNameMapping
Area name mapping.
Definition context.h:91
void reset()
Reset internal data.
Definition context.cpp:42
~Context()=default
Destructor.
Data::ThermalCluster * originalPlant
The original cluster name.
Definition context.h:81
Views view
Views.
Definition context.h:86
std::map< Data::AreaName, bool > AreaNameMappingForceCreate
Area name mapping.
Definition context.h:48
Yuni::Bind< void(const Yuni::String &)> updateMessageUI
Delegate to update the interface.
Definition context.h:101
std::shared_ptr< Data::BindingConstraint > constraint
The current constraint.
Definition context.h:83
std::map< Yuni::CString< 50, false >, IAction::Ptr > LocalView
Local view.
Definition context.h:44
AreaNameMappingForceCreate areaForceCreate
Area name mapping, force creation.
Definition context.h:94
Yuni::String message
Temporary string for message formatting.
Definition context.h:99
std::map< Yuni::String, Yuni::String > Properties
Map of properties.
Definition context.h:42
Data::BindingConstraintsRepository::Vector autoselectConstraints
List of binding constraints to select after the paste.
Definition context.h:110
Data::Area::Vector autoselectAreas
List of areas to select after the paste.
Definition context.h:106
Data::Study::Ptr study
The target study.
Definition context.h:67
Data::Area * area
The current Area.
Definition context.h:75
Properties property
All properties.
Definition context.h:88
Data::ThermalCluster * cluster
The current Thermal cluster.
Definition context.h:77
AncestorType::Ptr Ptr
The most suitable smart ptr for the class.
Definition action.h:43
Definition for a single area.
Definition area.h:52
std::map< AreaName, AreaName > NameMapping
Name mapping -> must be replaced by AreaNameMapping.
Definition area.h:63
std::vector< std::shared_ptr< BindingConstraint > > Vector
Vector of binding constraints.
Definition BindingConstraintsRepository.h:39
A single thermal cluster.
Definition cluster.h:78