-
Notifications
You must be signed in to change notification settings - Fork 0
/
ood.h
65 lines (52 loc) · 1.36 KB
/
ood.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#pragma once
#include "typedefs.h"
#include <vector>
#include <random>
class Object
{
std::vector<Data_t> m_Data = {};
public:
Object() = default;
~Object() = default;
void AddData()
{
Data_t data =
{
.id = rand() % 1024,
.intVal = rand() % 99999,
.doubleVal = 0.5 * double(rand() % 8888)
};
m_Data.emplace_back(data);
}
void UpdateValues(const int idx, const Data_t& vals)
{
m_Data[idx] = vals;
}
const int NumDataSets() const
{
return m_Data.size();
}
};
class OOD
{
std::vector<Object> m_Objects = {};
public:
OOD() = default;
~OOD() = default;
void CreateObject(const unsigned int numDataSets)
{
m_Objects.emplace_back(Object());
const int numObjects = m_Objects.size() - 1;
for (size_t i = 0; i < numDataSets; ++i)
m_Objects[numObjects].AddData();
}
const int ObjectsNum() const
{
return m_Objects.size();
}
void UpdateObject(const int idx, const Data_t& data)
{
for (size_t i = 0; i < m_Objects[idx].NumDataSets(); ++i)
m_Objects[idx].UpdateValues(i, data);
}
};