-
Notifications
You must be signed in to change notification settings - Fork 0
/
ZoneData.cpp
executable file
·82 lines (56 loc) · 1.41 KB
/
ZoneData.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 "ZoneData.h"
SharedZone::SharedZone()
{
}
SharedZone::SharedZone(SharedZoneRaw& data)
{
precedenceVec_ = data.precedenceVec_;
zoneBorderMap_ = data.zoneBorderMap_;
}
SharedZone& SharedZone::addRobot(int robotId, int priority, int enterIndex, int exitIndex)
{
zoneBorderMap_.insert( pair<int, pair<int,int>>(
robotId, pair<int,int>(enterIndex, exitIndex) ) );
precedenceVec_.push_back(priority);
return *this;
}
int SharedZone::getNbRobots() const
{
return static_cast<int> (precedenceVec_.size());
}
const vector<int>& SharedZone::getPrecedenceVec() const
{
return precedenceVec_;
}
int SharedZone::getZoneEnterancePoint(int robotId) const
{
return ( zoneBorderMap_.find(robotId) )-> second.first;
}
int SharedZone::getZoneExitPoint(int robotId) const
{
return (zoneBorderMap_.find(robotId))->second.second;
}
PreservedZone::PreservedZone(int robotId, int startPoint, int endPoint)
{
robotId_ = robotId;
startPoint_ = startPoint;
endPoint_ = endPoint;
}
PreservedZone::PreservedZone(PreservedZoneRaw& data)
{
robotId_ = data.robotId_;
startPoint_ = data.startPoint_;
endPoint_ = data.endPoint_;
}
int PreservedZone::getRobotId() const
{
return robotId_;
}
int PreservedZone::getStartPoint() const
{
return startPoint_;
}
int PreservedZone::getEndPoint() const
{
return endPoint_;
}