CARLA
LibCarla
source
carla
sensor
s11n
SensorHeaderSerializer.h
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
#pragma once
8
9
#include "
carla/Buffer.h
"
10
#include "
carla/rpc/Transform.h
"
11
12
namespace
carla
{
13
namespace
sensor {
14
namespace
s11n {
15
16
/// Serializes the meta-information (header) sent with all the sensor data.
17
class
SensorHeaderSerializer
{
18
public
:
19
20
#pragma pack(push, 1)
21
struct
Header
{
22
uint64_t
sensor_type
;
23
uint64_t
frame
;
24
double
timestamp
;
25
rpc::Transform
sensor_transform
;
26
};
27
#pragma pack(pop)
28
29
constexpr
static
auto
header_offset
=
sizeof
(
Header
);
30
31
static
Buffer
Serialize
(
32
uint64_t index,
33
uint64_t
frame
,
34
double
timestamp
,
35
rpc::Transform
transform);
36
37
static
const
Header
&
Deserialize
(
const
Buffer
&message) {
38
return
*
reinterpret_cast<
const
Header
*
>
(message.
data
());
39
}
40
};
41
42
}
// namespace s11n
43
}
// namespace sensor
44
}
// 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::Buffer::data
const value_type * data() const noexcept
Direct access to the allocated memory or nullptr if no memory is allocated.
Definition:
carla/Buffer.h:156
carla::sensor::s11n::SensorHeaderSerializer
Serializes the meta-information (header) sent with all the sensor data.
Definition:
SensorHeaderSerializer.h:17
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
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
Buffer.h
carla::sensor::s11n::SensorHeaderSerializer::header_offset
static constexpr auto header_offset
Definition:
SensorHeaderSerializer.h:29
carla::sensor::s11n::SensorHeaderSerializer::Header
Definition:
SensorHeaderSerializer.h:21
carla::sensor::s11n::SensorHeaderSerializer::Deserialize
static const Header & Deserialize(const Buffer &message)
Definition:
SensorHeaderSerializer.h:37
carla::Buffer
A piece of raw data.
Definition:
carla/Buffer.h:42
carla::geom::Transform
Definition:
geom/Transform.h:23
carla::sensor::s11n::SensorHeaderSerializer::Header::frame
uint64_t frame
Definition:
SensorHeaderSerializer.h:23
Transform.h
Generated by
1.8.13