CARLA
EpisodeStateSerializer.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/Debug.h"
11 #include "carla/Memory.h"
12 #include "carla/geom/Transform.h"
13 #include "carla/geom/Vector3DInt.h"
14 #include "carla/sensor/RawData.h"
16 
17 #include <cstdint>
18 
19 namespace carla {
20 namespace sensor {
21 
22  class SensorData;
23 
24 namespace s11n {
25 
26  /// Serializes the current state of the whole episode.
28  public:
29 
31  None = (0x0 << 0),
32  MapChange = (0x1 << 0),
33  PendingLightUpdate = (0x1 << 1)
34  };
35 
36 #pragma pack(push, 1)
37  struct Header {
38  uint64_t episode_id;
42  SimulationState simulation_state = SimulationState::None;
43  };
44 #pragma pack(pop)
45 
46  constexpr static auto header_offset = sizeof(Header);
47 
48  static const Header &DeserializeHeader(const RawData &message) {
49  return *reinterpret_cast<const Header *>(message.begin());
50  }
51 
52  template <typename SensorT>
53  static Buffer Serialize(const SensorT &, Buffer &&buffer) {
54  return std::move(buffer);
55  }
56 
58  };
59 
60 } // namespace s11n
61 } // namespace sensor
62 } // namespace carla
Serializes the current state of the whole episode.
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
This file contains definitions of common data structures used in traffic manager. ...
Definition: Carla.cpp:133
auto begin() noexcept
Begin iterator to the data generated by the sensor.
Definition: RawData.h:52
static Buffer Serialize(const SensorT &, Buffer &&buffer)
static SharedPtr< SensorData > Deserialize(RawData &&data)
static const Header & DeserializeHeader(const RawData &message)
A piece of raw data.
Definition: carla/Buffer.h:42
Wrapper around the raw data generated by a sensor plus some useful meta-information.
Definition: RawData.h:21