mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-26 07:00:17 +08:00
Reorganization directory structure [3/n]
Change-Id: If3dfa3f6007f8810a6a1ae1a4f0c7da38544648d
This commit is contained in:
46
shared/source/os_interface/linux/debug_env_reader.cpp
Normal file
46
shared/source/os_interface/linux/debug_env_reader.cpp
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "os_interface/linux/debug_env_reader.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
SettingsReader *SettingsReader::createOsReader(bool userScope, const std::string ®Key) {
|
||||
return new EnvironmentVariableReader;
|
||||
}
|
||||
|
||||
const char *EnvironmentVariableReader::appSpecificLocation(const std::string &name) {
|
||||
return name.c_str();
|
||||
}
|
||||
|
||||
bool EnvironmentVariableReader::getSetting(const char *settingName, bool defaultValue) {
|
||||
return getSetting(settingName, static_cast<int32_t>(defaultValue)) ? true : false;
|
||||
}
|
||||
|
||||
int32_t EnvironmentVariableReader::getSetting(const char *settingName, int32_t defaultValue) {
|
||||
int32_t value = defaultValue;
|
||||
char *envValue;
|
||||
|
||||
envValue = getenv(settingName);
|
||||
if (envValue) {
|
||||
value = atoi(envValue);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
std::string EnvironmentVariableReader::getSetting(const char *settingName, const std::string &value) {
|
||||
char *envValue;
|
||||
std::string keyValue;
|
||||
keyValue.assign(value);
|
||||
|
||||
envValue = getenv(settingName);
|
||||
if (envValue) {
|
||||
keyValue.assign(envValue);
|
||||
}
|
||||
return keyValue;
|
||||
}
|
||||
} // namespace NEO
|
||||
Reference in New Issue
Block a user