2017-12-21 00:45:38 +01:00
|
|
|
/*
|
2023-07-20 05:54:03 +00:00
|
|
|
* Copyright (C) 2018-2023 Intel Corporation
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
2018-09-18 09:11:08 +02:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
#include <string>
|
|
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
namespace NEO {
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2023-08-20 04:31:48 +00:00
|
|
|
enum class DebugVarPrefix : uint8_t;
|
|
|
|
|
|
2017-12-21 00:45:38 +01:00
|
|
|
class SettingsReader {
|
|
|
|
|
public:
|
2022-05-17 19:04:23 +00:00
|
|
|
virtual ~SettingsReader() = default;
|
2019-09-02 12:04:22 +02:00
|
|
|
static SettingsReader *create(const std::string ®Key) {
|
2017-12-21 00:45:38 +01:00
|
|
|
SettingsReader *readerImpl = createFileReader();
|
|
|
|
|
if (readerImpl != nullptr)
|
|
|
|
|
return readerImpl;
|
|
|
|
|
|
2019-09-02 12:04:22 +02:00
|
|
|
return createOsReader(false, regKey);
|
2017-12-21 00:45:38 +01:00
|
|
|
}
|
2019-09-02 12:04:22 +02:00
|
|
|
static SettingsReader *createOsReader(bool userScope, const std::string ®Key);
|
2017-12-21 00:45:38 +01:00
|
|
|
static SettingsReader *createFileReader();
|
2023-08-20 04:31:48 +00:00
|
|
|
virtual int32_t getSetting(const char *settingName, int32_t defaultValue, DebugVarPrefix &type) = 0;
|
2017-12-21 00:45:38 +01:00
|
|
|
virtual int32_t getSetting(const char *settingName, int32_t defaultValue) = 0;
|
2023-08-20 04:31:48 +00:00
|
|
|
virtual int64_t getSetting(const char *settingName, int64_t defaultValue, DebugVarPrefix &type) = 0;
|
2020-03-27 07:47:16 +01:00
|
|
|
virtual int64_t getSetting(const char *settingName, int64_t defaultValue) = 0;
|
2023-08-20 04:31:48 +00:00
|
|
|
virtual bool getSetting(const char *settingName, bool defaultValue, DebugVarPrefix &type) = 0;
|
2017-12-21 00:45:38 +01:00
|
|
|
virtual bool getSetting(const char *settingName, bool defaultValue) = 0;
|
2023-08-20 04:31:48 +00:00
|
|
|
virtual std::string getSetting(const char *settingName, const std::string &value, DebugVarPrefix &type) = 0;
|
2017-12-21 00:45:38 +01:00
|
|
|
virtual std::string getSetting(const char *settingName, const std::string &value) = 0;
|
2018-10-10 16:02:19 +02:00
|
|
|
virtual const char *appSpecificLocation(const std::string &name) = 0;
|
2017-12-21 00:45:38 +01:00
|
|
|
static const char *settingsFileName;
|
2023-08-20 04:31:48 +00:00
|
|
|
static const char *neoSettingsFileName;
|
2020-08-24 01:55:47 +02:00
|
|
|
MOCKABLE_VIRTUAL char *getenv(const char *settingName);
|
2017-12-21 00:45:38 +01:00
|
|
|
};
|
2019-03-26 11:59:46 +01:00
|
|
|
}; // namespace NEO
|