10 namespace traffic_manager {
17 this->
road_id = simple_waypoint->GetWaypoint()->GetRoadId();
18 this->
section_id = simple_waypoint->GetWaypoint()->GetSectionId();
19 this->
lane_id = simple_waypoint->GetWaypoint()->GetLaneId();
20 this->
s =
static_cast<float>(simple_waypoint->GetWaypoint()->GetDistance());
22 for (
auto &wp : simple_waypoint->GetNextWaypoint()) {
25 for (
auto &wp : simple_waypoint->GetPreviousWaypoint()) {
29 if (simple_waypoint->GetLeftWaypoint() !=
nullptr) {
32 if (simple_waypoint->GetRightWaypoint() !=
nullptr) {
37 this->
is_junction = simple_waypoint->CheckJunction();
38 this->
road_option =
static_cast<uint8_t
>(simple_waypoint->GetRoadOption());
46 WriteValue<uint32_t>(out_file, this->
road_id);
47 WriteValue<uint32_t>(out_file, this->
section_id);
48 WriteValue<int32_t>(out_file, this->
lane_id);
49 WriteValue<float>(out_file, this->
s);
52 uint16_t total_next =
static_cast<uint16_t
>(this->
next_waypoints.size());
53 WriteValue<uint16_t>(out_file, total_next);
55 WriteValue<uint64_t>(out_file, id);
60 WriteValue<uint16_t>(out_file, total_previous);
62 WriteValue<uint64_t>(out_file, id);
84 ReadValue<uint32_t>(in_file, this->
road_id);
85 ReadValue<uint32_t>(in_file, this->
section_id);
86 ReadValue<int32_t>(in_file, this->
lane_id);
87 ReadValue<float>(in_file, this->
s);
91 ReadValue<uint16_t>(in_file, total_next);
92 for (uint16_t i = 0; i < total_next; i++) {
94 ReadValue<uint64_t>(in_file, id);
99 uint16_t total_previous;
100 ReadValue<uint16_t>(in_file, total_previous);
101 for (uint16_t i = 0; i < total_previous; i++) {
103 ReadValue<uint64_t>(in_file, id);
122 ReadValue<uint64_t>(content, start, this->
waypoint_id);
125 ReadValue<uint32_t>(content, start, this->
road_id);
126 ReadValue<uint32_t>(content, start, this->
section_id);
127 ReadValue<int32_t>(content, start, this->
lane_id);
128 ReadValue<float>(content, start, this->
s);
132 ReadValue<uint16_t>(content, start, total_next);
133 for (uint16_t i = 0; i < total_next; i++) {
135 ReadValue<uint64_t>(content, start, id);
140 uint16_t total_previous;
141 ReadValue<uint16_t>(content, start, total_previous);
142 for (uint16_t i = 0; i < total_previous; i++) {
144 ReadValue<uint64_t>(content, start, id);
156 ReadValue<bool>(content, start, this->
is_junction);
159 ReadValue<uint8_t>(content, start, this->
road_option);
std::vector< uint64_t > next_waypoints
std::vector< uint64_t > previous_waypoints
This file contains definitions of common data structures used in traffic manager. ...
CachedSimpleWaypoint()=default
uint64_t next_right_waypoint
void Read(const std::vector< uint8_t > &content, unsigned long &start)
uint64_t next_left_waypoint
void Write(std::ofstream &out_file)
std::shared_ptr< SimpleWaypoint > SimpleWaypointPtr