env.hpp 769 Bytes
Newer Older
Paul's avatar
Paul committed
1
2
3
4
5
6
7
8
9
#ifndef MIGRAPH_GUARD_RTGLIB_ENV_HPP
#define MIGRAPH_GUARD_RTGLIB_ENV_HPP

#include <vector>
#include <string>

namespace migraph {

// Declare a cached environment variable
Paul's avatar
Paul committed
10
11
12
13
14
15
16
17
#define MIGRAPH_DECLARE_ENV_VAR(x)                \
    struct x                                      \
    {                                             \
        static const char* value() { return #x; } \
    }; // NOLINT

bool enabled(const char* name);
bool disabled(const char* name);
Paul's avatar
Paul committed
18
19
std::vector<std::string> env(const char* name);

Paul's avatar
Paul committed
20
template <class T>
Paul's avatar
Paul committed
21
22
23
24
25
26
bool enabled(T)
{
    static const bool result = enabled(T::value());
    return result;
}

Paul's avatar
Paul committed
27
template <class T>
Paul's avatar
Paul committed
28
29
30
31
32
33
34
35
36
bool disabled(T)
{
    static const bool result = disabled(T::value());
    return result;
}

} // namespace migraph

#endif