This repository has been archived by the owner on Mar 1, 2023. It is now read-only.
forked from openvinotoolkit/openvino
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenv_util.hpp
37 lines (32 loc) · 1.56 KB
/
env_util.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright (C) 2018-2022 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#pragma once
#include <cstdint>
#include <ngraph/ngraph_visibility.hpp>
#include <string>
namespace ngraph {
/// \brief Get the names environment variable as a string.
/// \param env_var The string name of the environment variable to get.
/// \return Returns string by value or an empty string if the environment
/// variable is not set.
NGRAPH_API
std::string getenv_string(const char* env_var);
/// \brief Get the names environment variable as an integer. If the value is not a
/// valid integer then an exception is thrown.
/// \param env_var The string name of the environment variable to get.
/// \param default_value The value to return if the environment variable is not set.
/// \return Returns value or default_value if the environment variable is not set.
NGRAPH_API
int32_t getenv_int(const char* env_var, int32_t default_value = -1);
/// \brief Get the names environment variable as a boolean. If the value is not a
/// valid boolean then an exception is thrown. Valid booleans are one of
/// 1, 0, on, off, true, false
/// All values are case insensitive.
/// If the environment variable is not set the default_value is returned.
/// \param env_var The string name of the environment variable to get.
/// \param default_value The value to return if the environment variable is not set.
/// \return Returns the boolean value of the environment variable.
NGRAPH_API
bool getenv_bool(const char* env_var, bool default_value = false);
} // namespace ngraph