-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathutils_impl.tcc
47 lines (41 loc) · 1.24 KB
/
utils_impl.tcc
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
/*
Testbed for empirical evaluation of KP-ABE schemes, according to Crampton, Pinto (CSF2014).
Code by: Alexandre Miranda Pinto
This file holds the implementation of the template functions declared in utils.h
*/
template<typename T>
int contains(const vector<T> &set, const T element){
for (unsigned int i = 0; i < set.size(); i++){
if (element == set[i]) {
return i;
}
}
return -1;
}
template<typename T>
void addVector(std::vector<T> &storage, const std::vector<T> &data){
for (unsigned int i = 0; i < data.size(); i++) {
storage.push_back(data[i]);
}
}
template<typename T>
void debugVector(std::string text, std::vector<T> list) {
for (unsigned int i = 0; i < list.size(); i++) {
DEBUG(text << "[" << i << "]: " << list[i]);
}
}
template<typename T>
void debugVectorObj(std::string text, std::vector<T> list) {
if (list.size() == 0) {
DEBUG(text << ": no elements");
}
for (unsigned int i = 0; i < list.size(); i++) {
DEBUG(text << "[" << i << "]: " << list[i].to_string());
}
}
template<typename T>
void outVector(std::vector<T> list, std::string text) {
for (unsigned int i = 0; i < list.size(); i++) {
OUT(text << "[" << i << "]: " << list[i]);
}
}