env.hpp 647 Bytes
Newer Older
Paul's avatar
Paul committed
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
#ifndef MIGRAPH_GUARD_RTGLIB_ENV_HPP
#define MIGRAPH_GUARD_RTGLIB_ENV_HPP

#include <vector>
#include <string>

namespace migraph {

// Declare a cached environment variable
#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);
std::vector<std::string> env(const char* name);

template<class T>
bool enabled(T)
{
    static const bool result = enabled(T::value());
    return result;
}

template<class T>
bool disabled(T)
{
    static const bool result = disabled(T::value());
    return result;
}

} // namespace migraph

#endif