CARLA
 
载入中...
搜索中...
未找到
SensorHeaderSerializer.cpp
浏览该文件的文档.
1// Copyright (c) 2017 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
9#include "carla/BufferPool.h"
10
11namespace carla {
12namespace sensor {
13namespace s11n {
14
15 static_assert(
16 SensorHeaderSerializer::header_offset == 3u * 8u + 6u * 4u,
17 "Header size missmatch");
18
20 static auto pool = std::make_shared<BufferPool>();
21 return pool->Pop();
22 }
23
25 const uint64_t index,
26 const uint64_t frame,
27 double timestamp,
28 const rpc::Transform transform) {
29 Header h;
30 h.sensor_type = index;
31 h.frame = frame;
32 h.timestamp = timestamp;
33 h.sensor_transform = transform;
34 auto buffer = PopBufferFromPool();
35 buffer.copy_from(reinterpret_cast<const unsigned char *>(&h), sizeof(h));
36 return buffer;
37 }
38
39} // namespace s11n
40} // namespace sensor
41} // namespace carla
A piece of raw data.
static Buffer Serialize(uint64_t index, uint64_t frame, double timestamp, rpc::Transform transform)
This file contains definitions of common data structures used in traffic manager.
Definition Carla.cpp:133