CARLA
LibCarla
source
carla
sensor
s11n
SensorHeaderSerializer.cpp
Go to the documentation of this file.
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
7
#include "
carla/sensor/s11n/SensorHeaderSerializer.h
"
8
9
#include "
carla/BufferPool.h
"
10
11
namespace
carla
{
12
namespace
sensor {
13
namespace
s11n {
14
15
static_assert(
16
SensorHeaderSerializer::header_offset
== 3u * 8u + 6u * 4u,
17
"Header size missmatch"
);
18
19
static
Buffer
PopBufferFromPool
() {
20
static
auto
pool = std::make_shared<BufferPool>();
21
return
pool->Pop();
22
}
23
24
Buffer
SensorHeaderSerializer::Serialize
(
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
carla::sensor::s11n::SensorHeaderSerializer::Serialize
static Buffer Serialize(uint64_t index, uint64_t frame, double timestamp, rpc::Transform transform)
Definition:
SensorHeaderSerializer.cpp:24
carla::sensor::s11n::SensorHeaderSerializer::Header::timestamp
double timestamp
Definition:
SensorHeaderSerializer.h:24
carla::sensor::s11n::SensorHeaderSerializer::Header::sensor_transform
rpc::Transform sensor_transform
Definition:
SensorHeaderSerializer.h:25
BufferPool.h
carla::sensor::s11n::SensorHeaderSerializer::Header::sensor_type
uint64_t sensor_type
Definition:
SensorHeaderSerializer.h:22
carla
This file contains definitions of common data structures used in traffic manager. ...
Definition:
Carla.cpp:133
carla::sensor::s11n::SensorHeaderSerializer::header_offset
static constexpr auto header_offset
Definition:
SensorHeaderSerializer.h:29
carla::sensor::s11n::PopBufferFromPool
static Buffer PopBufferFromPool()
Definition:
SensorHeaderSerializer.cpp:19
carla::sensor::s11n::SensorHeaderSerializer::Header
Definition:
SensorHeaderSerializer.h:21
carla::Buffer
A piece of raw data.
Definition:
carla/Buffer.h:42
SensorHeaderSerializer.h
carla::geom::Transform
Definition:
geom/Transform.h:23
carla::sensor::s11n::SensorHeaderSerializer::Header::frame
uint64_t frame
Definition:
SensorHeaderSerializer.h:23
Generated by
1.8.13