CARLA
 
载入中...
搜索中...
未找到
CarlaRecorderTraficLightTime.cpp
浏览该文件的文档.
1// Copyright (c) 2020 Computer Vision Center (CVC) at the Universitat Autonoma
2// de Barcelona (UAB).
3//
4// This work is licensed under the terms of the MIT license.
5// For a copy, see <https://opensource.org/licenses/MIT>.
6
8#include "CarlaRecorder.h"
10
11
12void CarlaRecorderTrafficLightTime::Write(std::ostream &OutFile)
13{
14 WriteValue<uint32_t>(OutFile, this->DatabaseId);
15 WriteValue(OutFile, this->GreenTime);
16 WriteValue(OutFile, this->YellowTime);
17 WriteValue(OutFile, this->RedTime);
18}
19
20void CarlaRecorderTrafficLightTime::Read(std::istream &InFile)
21{
22 ReadValue<uint32_t>(InFile, this->DatabaseId);
23 ReadValue(InFile, this->GreenTime);
24 ReadValue(InFile, this->YellowTime);
25 ReadValue(InFile, this->RedTime);
26}
27
28// ---------------------------------------------
29
34
39
40void CarlaRecorderTrafficLightTimes::Write(std::ostream &OutFile)
41{
42 if (TrafficLightTimes.size() == 0)
43 {
44 return;
45 }
46 // write the packet id
47 WriteValue<char>(OutFile, static_cast<char>(CarlaRecorderPacketId::TrafficLightTime));
48
49 uint32_t Total = sizeof(uint16_t) + TrafficLightTimes.size() * sizeof(CarlaRecorderTrafficLightTime);
50 WriteValue<uint32_t>(OutFile, Total);
51
52 Total = TrafficLightTimes.size();
53 WriteValue<uint16_t>(OutFile, Total);
54
56 {
57 TrafficLightTime.Write(OutFile);
58 }
59}
void WriteValue(std::ostream &OutFile, const T &InObj)
void ReadValue(std::istream &InFile, T &OutObj)
void Add(const CarlaRecorderTrafficLightTime &InObj)
std::vector< CarlaRecorderTrafficLightTime > TrafficLightTimes