libpromeki 1.0.0-alpha
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
memdomain.h
Go to the documentation of this file.
1
8#pragma once
9
10
11#include <promeki/config.h>
12#if PROMEKI_ENABLE_CORE
13#include <promeki/namespace.h>
14#include <promeki/string.h>
15#include <promeki/list.h>
16
17PROMEKI_NAMESPACE_BEGIN
18
43class MemDomain {
44 public:
52 enum ID {
53 Host = 0,
54 CudaDevice = 1,
55 FpgaDevice = 2,
68 Dmabuf = 3,
69 Default = Host,
70 UserDefined = 1024
71 };
72
74 using IDList = ::promeki::List<ID>;
75
83 struct Data {
84 ID id;
85 String name;
86 };
87
92 static ID registerType();
93
102 static void registerData(Data &&data);
103
108 static IDList registeredIDs();
109
114 inline MemDomain(ID id = Default);
115
117 const String &name() const { return d->name; }
118
120 ID id() const { return d->id; }
121
123 bool operator==(const MemDomain &o) const { return d == o.d; }
124
126 bool operator!=(const MemDomain &o) const { return d != o.d; }
127
128 private:
129 const Data *d = nullptr;
130 static const Data *lookup(ID id);
131};
132
133inline MemDomain::MemDomain(ID id) : d(lookup(id)) {}
134
135PROMEKI_NAMESPACE_END
136
137#endif // PROMEKI_ENABLE_CORE