Antares Simulator
Power System Simulator
Loading...
Searching...
No Matches
header.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_HEADER_H__
22
#define __ANTARES_LIBS_STUDY_HEADER_H__
23
24
#include <ctime>
25
#include <filesystem>
26
27
#include <yuni/yuni.h>
28
#include <yuni/core/string.h>
29
30
#include <antares/inifile/inifile.h>
31
32
#include "version.h"
33
35
#define STUDYHEADER_DEFAULT_AUTHOR "Unknown"
37
#define STUDYHEADER_DEFAULT_CAPTION "No title"
38
39
namespace
Antares
40
{
41
namespace
Data
42
{
47
class
StudyHeader
final
48
{
49
public
:
56
static
bool
readVersionFromFile
(
const
std::filesystem::path& filename, std::string&
version
);
57
59
60
63
StudyHeader
()
64
{
65
reset
();
66
}
67
71
~StudyHeader
() =
default
;
73
77
void
reset
();
78
86
bool
loadFromFile
(
const
std::filesystem::path& filename,
bool
warnings =
true
);
87
97
bool
saveToFile
(
const
AnyString& filename,
bool
upgradeVersion =
true
);
98
100
void
CopySettingsToIni
(
IniFile
& ini,
bool
upgradeVersion);
101
109
static
StudyVersion
tryToFindTheVersion
(
const
std::string& folder);
110
111
bool
validateVersion();
112
114
Yuni::String
caption
;
115
117
StudyVersion
version
;
118
120
time_t
dateCreated
;
122
time_t
dateLastSave
;
123
125
Yuni::String
author
;
126
127
private
:
129
bool
internalLoadFromINIFile(
const
IniFile
& ini,
bool
warnings);
130
132
static
bool
internalFindVersionFromFile(
const
IniFile
& ini, std::string&
version
);
133
134
};
// class StudyHeader;
135
136
}
// namespace Data
137
}
// namespace Antares
138
139
#endif
/* __ANTARES_LIBS_STUDY_HEADER_H__ */
Antares::Data::StudyHeader
Header of a study.
Definition
header.h:48
Antares::Data::StudyHeader::StudyHeader
StudyHeader()
Default constructor.
Definition
header.h:63
Antares::Data::StudyHeader::author
Yuni::String author
Author.
Definition
header.h:125
Antares::Data::StudyHeader::caption
Yuni::String caption
Caption of the study.
Definition
header.h:114
Antares::Data::StudyHeader::CopySettingsToIni
void CopySettingsToIni(IniFile &ini, bool upgradeVersion)
Copy the internal settings into an INI structure.
Definition
header.cpp:60
Antares::Data::StudyHeader::loadFromFile
bool loadFromFile(const std::filesystem::path &filename, bool warnings=true)
Load a study header from a file.
Definition
header.cpp:182
Antares::Data::StudyHeader::readVersionFromFile
static bool readVersionFromFile(const std::filesystem::path &filename, std::string &version)
Get the version of a header.
Definition
header.cpp:230
Antares::Data::StudyHeader::dateCreated
time_t dateCreated
Date: Creation (timestamp)
Definition
header.h:120
Antares::Data::StudyHeader::~StudyHeader
~StudyHeader()=default
Destructor.
Antares::Data::StudyHeader::saveToFile
bool saveToFile(const AnyString &filename, bool upgradeVersion=true)
Save a study header into a file.
Definition
header.cpp:192
Antares::Data::StudyHeader::dateLastSave
time_t dateLastSave
Date: Last save (timestamp)
Definition
header.h:122
Antares::Data::StudyHeader::reset
void reset()
Reset the values.
Definition
header.cpp:47
Antares::Data::StudyHeader::version
StudyVersion version
Format version.
Definition
header.h:117
Antares::Data::StudyHeader::tryToFindTheVersion
static StudyVersion tryToFindTheVersion(const std::string &folder)
Try to determine the version of a study.
Definition
header.cpp:199
Antares::Data::StudyVersion
Version of a study.
Definition
version.h:36
Antares::IniFile
Data for an INI file.
Definition
inifile.h:34
src
libs
antares
study
include
antares
study
header.h
Generated by
1.12.0