Pass sensor data by r-value reference

This commit is contained in:
nsubiron 2019-06-17 14:36:18 +02:00
parent 5656cc89e4
commit 10c5f6a482
10 changed files with 10 additions and 10 deletions

View File

@ -11,7 +11,7 @@ namespace carla {
namespace sensor { namespace sensor {
namespace s11n { namespace s11n {
SharedPtr<SensorData> CollisionEventSerializer::Deserialize(RawData data) { SharedPtr<SensorData> CollisionEventSerializer::Deserialize(RawData &&data) {
return SharedPtr<SensorData>(new data::CollisionEvent(std::move(data))); return SharedPtr<SensorData>(new data::CollisionEvent(std::move(data)));
} }

View File

@ -50,7 +50,7 @@ namespace s11n {
return MsgPack::Pack(Data{self_actor, other_actor, normal_impulse}); return MsgPack::Pack(Data{self_actor, other_actor, normal_impulse});
} }
static SharedPtr<SensorData> Deserialize(RawData data); static SharedPtr<SensorData> Deserialize(RawData &&data);
}; };
} // namespace s11n } // namespace s11n

View File

@ -12,7 +12,7 @@ namespace carla {
namespace sensor { namespace sensor {
namespace s11n { namespace s11n {
SharedPtr<SensorData> EpisodeStateSerializer::Deserialize(RawData data) { SharedPtr<SensorData> EpisodeStateSerializer::Deserialize(RawData &&data) {
return SharedPtr<data::RawEpisodeState>(new data::RawEpisodeState{std::move(data)}); return SharedPtr<data::RawEpisodeState>(new data::RawEpisodeState{std::move(data)});
} }

View File

@ -46,7 +46,7 @@ namespace s11n {
return std::move(buffer); return std::move(buffer);
} }
static SharedPtr<SensorData> Deserialize(RawData data); static SharedPtr<SensorData> Deserialize(RawData &&data);
}; };
} // namespace s11n } // namespace s11n

View File

@ -12,7 +12,7 @@ namespace carla {
namespace sensor { namespace sensor {
namespace s11n { namespace s11n {
SharedPtr<SensorData> ImageSerializer::Deserialize(RawData data) { SharedPtr<SensorData> ImageSerializer::Deserialize(RawData &&data) {
auto image = SharedPtr<data::Image>(new data::Image{std::move(data)}); auto image = SharedPtr<data::Image>(new data::Image{std::move(data)});
// Set alpha of each pixel in the buffer to max to make it 100% opaque // Set alpha of each pixel in the buffer to max to make it 100% opaque
for (auto &pixel : *image) { for (auto &pixel : *image) {

View File

@ -40,7 +40,7 @@ namespace s11n {
template <typename Sensor> template <typename Sensor>
static Buffer Serialize(const Sensor &sensor, Buffer &&bitmap); static Buffer Serialize(const Sensor &sensor, Buffer &&bitmap);
static SharedPtr<SensorData> Deserialize(RawData data); static SharedPtr<SensorData> Deserialize(RawData &&data);
}; };
template <typename Sensor> template <typename Sensor>

View File

@ -12,7 +12,7 @@ namespace carla {
namespace sensor { namespace sensor {
namespace s11n { namespace s11n {
SharedPtr<SensorData> LidarSerializer::Deserialize(RawData data) { SharedPtr<SensorData> LidarSerializer::Deserialize(RawData &&data) {
return SharedPtr<data::LidarMeasurement>( return SharedPtr<data::LidarMeasurement>(
new data::LidarMeasurement{std::move(data)}); new data::LidarMeasurement{std::move(data)});
} }

View File

@ -74,7 +74,7 @@ namespace s11n {
const LidarMeasurement &measurement, const LidarMeasurement &measurement,
Buffer &&bitmap); Buffer &&bitmap);
static SharedPtr<SensorData> Deserialize(RawData data); static SharedPtr<SensorData> Deserialize(RawData &&data);
}; };
// =========================================================================== // ===========================================================================

View File

@ -11,7 +11,7 @@ namespace carla {
namespace sensor { namespace sensor {
namespace s11n { namespace s11n {
SharedPtr<SensorData> ObstacleDetectionEventSerializer::Deserialize(RawData data) { SharedPtr<SensorData> ObstacleDetectionEventSerializer::Deserialize(RawData &&data) {
return SharedPtr<SensorData>(new data::ObstacleDetectionEvent(std::move(data))); return SharedPtr<SensorData>(new data::ObstacleDetectionEvent(std::move(data)));
} }

View File

@ -49,7 +49,7 @@ namespace s11n {
return MsgPack::Pack(Data{self_actor, other_actor, distance}); return MsgPack::Pack(Data{self_actor, other_actor, distance});
} }
static SharedPtr<SensorData> Deserialize(RawData data); static SharedPtr<SensorData> Deserialize(RawData &&data);
}; };
} // namespace s11n } // namespace s11n