Antares Simulator
Power System Simulator
Loading...
Searching...
No Matches
policy.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_ADMIN_POLICY_H__
22#define __ANTARES_LIBS_ADMIN_POLICY_H__
23
24#include <yuni/yuni.h>
25#include <yuni/core/singleton.h>
26#include <yuni/core/string.h>
27
31namespace LocalPolicy
32{
34using PolicyKey = Yuni::ShortString64;
35
44bool Open(bool expandEntries = true);
45
49void Close();
50
54void CheckRootPrefix(const char* argv0);
55
62bool Read(YString& out, const PolicyKey& key);
63
70bool ReadAsBool(const PolicyKey& key, bool defval = false);
71
75void DumpToLogs();
76
80void DumpToString(Yuni::Clob& out);
81
82} // namespace LocalPolicy
83
84#endif // __ANTARES_LIBS_ADMIN_POLICY_H__
Local policy settings.
Definition policy.h:32
bool ReadAsBool(const PolicyKey &key, bool defval=false)
Read the content of a single entry as a bool.
Definition policy.cpp:296
bool Read(YString &out, const PolicyKey &key)
Read the content of a single entry.
void DumpToLogs()
Dump the entries to the logs.
Definition policy.cpp:354
void DumpToString(Yuni::Clob &out)
Dump to string.
void CheckRootPrefix(const char *argv0)
Check the root prefix, and throws a FatalError if fails.
Definition policy.cpp:375
Yuni::ShortString64 PolicyKey
A key entry.
Definition policy.h:34
void Close()
Close all resources related to the local policies.
Definition policy.cpp:262
bool Open(bool expandEntries=true)
Open the local policies.
Definition policy.cpp:179