-
Notifications
You must be signed in to change notification settings - Fork 1
/
DataTypes.h
43 lines (34 loc) · 920 Bytes
/
DataTypes.h
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
38
39
40
41
42
43
#ifndef DEVICE_DATA_TYPES_H
#define DEVICE_DATA_TYPES_H
#include <cstddef>
#include <limits>
#if REAL_SIZE == 8
using real = double;
#elif REAL_SIZE == 4
using real = float;
#else
#error REAL_SIZE not supported.
#endif
namespace device {
struct DeviceGraphHandle {
static const size_t invalidId{std::numeric_limits<size_t>::max()};
public:
explicit DeviceGraphHandle() : graphId(invalidId) {}
explicit DeviceGraphHandle(size_t id) : graphId(id) {}
DeviceGraphHandle(const DeviceGraphHandle& other) = default;
DeviceGraphHandle& operator=(const DeviceGraphHandle& other) = default;
bool isInitialized() const {
return graphId != invalidId;
}
operator bool() const {
return isInitialized();
}
bool operator!() const {
return !isInitialized();
}
size_t getGraphId() { return graphId; }
private:
size_t graphId{invalidId};
};
} // namespace device
#endif // DEVICE_DATA_TYPES_H