forked from smistad/OpenCLUtilityLibrary
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DeviceCriteria.cpp
71 lines (57 loc) · 1.88 KB
/
DeviceCriteria.cpp
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include "DeviceCriteria.hpp"
using namespace oul;
const std::vector<DeviceCapability>& DeviceCriteria::getCapabilityCriteria() const {
return capabilityCriteria;
}
DevicePlatform DeviceCriteria::getPlatformCriteria() const {
return platformCriteria;
}
void oul::DeviceCriteria::setDeviceCountCriteria(unsigned int count) {
this->deviceCountMin = count;
this->deviceCountMax = count;
}
void oul::DeviceCriteria::setDeviceCountCriteria(unsigned int min, unsigned int max) {
this->deviceCountMin = min;
this->deviceCountMax = max;
}
DeviceType DeviceCriteria::getTypeCriteria() const {
return typeCriteria;
}
oul::DeviceCriteria::DeviceCriteria() {
typeCriteria = DEVICE_TYPE_ANY;
deviceCountMin = 0;
deviceCountMax = 100;
platformCriteria = DEVICE_PLATFORM_ANY;
devicePreference = DEVICE_PREFERENCE_NONE;
}
void oul::DeviceCriteria::setPlatformCriteria(DevicePlatform platform) {
platformCriteria = platform;
}
void oul::DeviceCriteria::setCapabilityCriteria(DeviceCapability capability) {
capabilityCriteria.push_back(capability);
}
void oul::DeviceCriteria::setTypeCriteria(DeviceType typeCriteria) {
this->typeCriteria = typeCriteria;
}
unsigned int oul::DeviceCriteria::getDeviceCountMinCriteria() const {
return deviceCountMin;
}
void oul::DeviceCriteria::setDevicePreference(DevicePreference preference) {
this->devicePreference = preference;
}
DevicePreference oul::DeviceCriteria::getDevicePreference() const {
return devicePreference;
}
unsigned int oul::DeviceCriteria::getDeviceCountMaxCriteria() const {
return deviceCountMax;
}
bool oul::DeviceCriteria::hasCapabilityCriteria(DeviceCapability capability) const {
bool found = false;
for(int i = 0; i < capabilityCriteria.size(); i++) {
if(capabilityCriteria[i] == capability) {
found = true;
break;
}
}
return found;
}