CARLA
 
载入中...
搜索中...
未找到
V2XSerializer.h
浏览该文件的文档.
1// Copyright (c) 2024 Institut fuer Technik der Informationsverarbeitung (ITIV) at the
2// Karlsruhe Institute of Technology
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/Memory.h"
12
13#include <cstdint>
14#include <cstring>
15class CAMContainer;
16namespace carla
17{
18 namespace sensor
19 {
20
21 class SensorData;
22
23 namespace s11n
24 {
25
26 // ===========================================================================
27 // -- V2XSerializer --------------------------------------------------------
28 // ===========================================================================
29
30 /// Serializes the data generated by V2X sensors.
31 // CAM
33 {
34 public:
35 template <typename Sensor>
36 static Buffer Serialize(
37 const Sensor &sensor,
38 const data::CAMDataS &data,
39 Buffer &&output);
40
42 };
43
44 template <typename Sensor>
46 const Sensor &,
47 const data::CAMDataS &data,
48 Buffer &&output)
49 {
50 output.copy_from(data.MessageList);
51 return std::move(output);
52 }
53
54 // Custom message
56 {
57 public:
58 template <typename Sensor>
59 static Buffer Serialize(
60 const Sensor &sensor,
61 const data::CustomV2XDataS &data,
62 Buffer &&output);
63
65 };
66
67 template <typename Sensor>
69 const Sensor &,
70 const data::CustomV2XDataS &data,
71 Buffer &&output)
72 {
73 output.copy_from(data.MessageList);
74 return std::move(output);
75 }
76
77 } // namespace s11n
78 } // namespace sensor
79} // namespace carla
A piece of raw data.
void copy_from(const T &source)
Copy source into this buffer. Allocates memory if necessary.
Wrapper around the raw data generated by a sensor plus some useful meta-information.
Definition RawData.h:21
std::vector< CAMData > MessageList
Definition V2XData.h:67
std::vector< CustomV2XData > MessageList
Definition V2XData.h:99
Serializes the data generated by V2X sensors.
static Buffer Serialize(const Sensor &sensor, const data::CAMDataS &data, Buffer &&output)
static SharedPtr< SensorData > Deserialize(RawData &&data)
static Buffer Serialize(const Sensor &sensor, const data::CustomV2XDataS &data, Buffer &&output)
static SharedPtr< SensorData > Deserialize(RawData &&data)
This file contains definitions of common data structures used in traffic manager.
Definition Carla.cpp:133
boost::shared_ptr< T > SharedPtr
Use this SharedPtr (boost::shared_ptr) to keep compatibility with boost::python, but it would be nice...
Definition Memory.h:20