-
Notifications
You must be signed in to change notification settings - Fork 0
/
Common.cpp
82 lines (68 loc) · 1.46 KB
/
Common.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
72
73
74
75
76
77
78
79
80
81
82
#include "Common.h"
std::string PermRotationHeader::get_name()
{
return "PermRotationHeader";
}
std::string TempRotationHeader::get_name()
{
return "TempRotationHeader";
}
std::string ResetRotationHeader::get_name()
{
return "ResetRotationHeader";
}
std::string SetHitRotationHeader::get_name()
{
return "SetHitRotationHeader";
}
std::string SetHitPosRotationHeader::get_name()
{
return "SetHitPosRotationHeader";
}
std::string SetHitDirRotationHeader::get_name()
{
return "SetHitDirRotationHeader";
}
const HitHeader& HitModel::get_header() const
{
return hit;
}
HitHeader&& HitModel::pop_header()
{
has_dir = false;
has_position = false;
return std::move(hit);
}
void HitModel::set_header(const HitHeader & hit)
{
has_dir = true;
has_position = true;
this->hit = hit;
}
void HitModel::set_position(const HitHeader & hit)
{
has_position = true;
this->hit.i = hit.i;
this->hit.j = hit.j;
this->hit.k = hit.k;
this->hit.index = hit.index;
}
void HitModel::set_dir(const HitHeader & hit)
{
has_dir = true;
this->hit.dir_vec = hit.dir_vec;
this->hit.dir = hit.dir;
}
void Observable::add_observer(Observer * observer)
{
observers.push_back(observer);
}
void Observable::notify()
{
for (auto &o : observers)
o->update();
}
std::string WholeRotationHeader::get_name()
{
return "WholeRotationHeader";
}