10namespace 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());
23 for (
auto &wp : simple_waypoint->GetNextWaypoint()) {
28 for (
auto &wp : simple_waypoint->GetPreviousWaypoint()) {
33 if (simple_waypoint->GetLeftWaypoint() !=
nullptr) {
37 if (simple_waypoint->GetRightWaypoint() !=
nullptr) {
42 this->
is_junction = simple_waypoint->CheckJunction();
43 this->
road_option =
static_cast<uint8_t
>(simple_waypoint->GetRoadOption());
51 WriteValue<uint32_t>(out_file, this->
road_id);
52 WriteValue<uint32_t>(out_file, this->
section_id);
53 WriteValue<int32_t>(out_file, this->
lane_id);
54 WriteValue<float>(out_file, this->
s);
57 uint16_t total_next =
static_cast<uint16_t
>(this->
next_waypoints.size());
58 WriteValue<uint16_t>(out_file, total_next);
60 WriteValue<uint64_t>(out_file,
id);
65 WriteValue<uint16_t>(out_file, total_previous);
67 WriteValue<uint64_t>(out_file,
id);
89 ReadValue<uint32_t>(in_file, this->
road_id);
90 ReadValue<uint32_t>(in_file, this->
section_id);
91 ReadValue<int32_t>(in_file, this->
lane_id);
92 ReadValue<float>(in_file, this->
s);
96 ReadValue<uint16_t>(in_file, total_next);
97 for (uint16_t i = 0; i < total_next; i++) {
99 ReadValue<uint64_t>(in_file,
id);
104 uint16_t total_previous;
105 ReadValue<uint16_t>(in_file, total_previous);
106 for (uint16_t i = 0; i < total_previous; i++) {
108 ReadValue<uint64_t>(in_file,
id);
126 ReadValue<uint64_t>(content, start, this->
waypoint_id);
129 ReadValue<uint32_t>(content, start, this->
road_id);
130 ReadValue<uint32_t>(content, start, this->
section_id);
131 ReadValue<int32_t>(content, start, this->
lane_id);
132 ReadValue<float>(content, start, this->
s);
136 ReadValue<uint16_t>(content, start, total_next);
137 for (uint16_t i = 0; i < total_next; i++) {
139 ReadValue<uint64_t>(content, start,
id);
144 uint16_t total_previous;
145 ReadValue<uint16_t>(content, start, total_previous);
146 for (uint16_t i = 0; i < total_previous; i++) {
148 ReadValue<uint64_t>(content, start,
id);
160 ReadValue<bool>(content, start, this->
is_junction);
163 ReadValue<uint8_t>(content, start, this->
road_option);
uint64_t next_right_waypoint
void Read(const std::vector< uint8_t > &content, unsigned long &start)
void Write(std::ofstream &out_file)
std::vector< uint64_t > next_waypoints
std::vector< uint64_t > previous_waypoints
uint64_t next_left_waypoint
CachedSimpleWaypoint()=default
std::shared_ptr< SimpleWaypoint > SimpleWaypointPtr