CARLA
Loading...
Searching...
No Matches
FAsyncDataStreamTmpl< T > Class Template Reference

A streaming channel for sending sensor data to clients, supports sending data asynchronously. More...

#include <AsyncDataStream.h>

Public Types

using StreamType = T

Public Member Functions

 FAsyncDataStreamTmpl (FAsyncDataStreamTmpl &&)=default
double GetSensorTimestamp ()
 return the timestamp of the sensor
FTransform GetSensorTransform ()
 return the transform of the sensor
uint64_t GetSensorType ()
 return the type of sensor of this stream
auto GetToken () const
 Return the token that allows subscribing to this stream.
carla::Buffer PopBufferFromPool ()
 Pop a Buffer from the pool.
template<typename SensorT, typename... ArgsT>
void Send (SensorT &Sensor, ArgsT &&... Args)
 Send some data down the stream.
template<typename SensorT, typename... ArgsT>
void SerializeAndSend (SensorT &Sensor, ArgsT &&... Args)
void SetFrameNumber (uint64_t FrameNumber)
 allow to change the frame number of the header
void SetTimestamp (double Timestamp)
 allow to change the timestamp of the header
void SetTransform (carla::rpc::Transform Transform)
 allow to change the transform of the header

Private Member Functions

template<typename SensorT>
 FAsyncDataStreamTmpl (const SensorT &InSensor, double Timestamp, StreamType InStream)

Private Attributes

carla::Buffer Header
StreamType Stream

Friends

class FDataStreamTmpl< T >

Detailed Description

template<typename T>
class FAsyncDataStreamTmpl< T >

A streaming channel for sending sensor data to clients, supports sending data asynchronously.

Data sent by the "Send" functions is passed to the serializer registered with the sensor at carla::sensor:SensorRegistry before being sent down the stream.

Warning
This is a single-use object, a new one needs to be created for each new message.

FAsyncDataStream also has a pool of carla::Buffer that allows reusing the allocated memory, use it whenever possible.

Definition at line 37 of file AsyncDataStream.h.

Member Typedef Documentation

◆ StreamType

template<typename T>
using FAsyncDataStreamTmpl< T >::StreamType = T

Definition at line 41 of file AsyncDataStream.h.

Constructor & Destructor Documentation

◆ FAsyncDataStreamTmpl() [1/2]

template<typename T>
FAsyncDataStreamTmpl< T >::FAsyncDataStreamTmpl ( FAsyncDataStreamTmpl< T > && )
default

◆ FAsyncDataStreamTmpl() [2/2]

template<typename T>
template<typename SensorT>
FAsyncDataStreamTmpl< T >::FAsyncDataStreamTmpl ( const SensorT & InSensor,
double Timestamp,
StreamType InStream )
inlineexplicitprivate
Precondition
This functions needs to be called in the game-thread.

Definition at line 18 of file AsyncDataStreamImpl.h.

References FCarlaEngine::GetFrameCounter(), Header, and Stream.

Member Function Documentation

◆ GetSensorTimestamp()

template<typename T>
double FAsyncDataStreamTmpl< T >::GetSensorTimestamp ( )
inline

return the timestamp of the sensor

Definition at line 136 of file AsyncDataStream.h.

◆ GetSensorTransform()

template<typename T>
FTransform FAsyncDataStreamTmpl< T >::GetSensorTransform ( )
inline

return the transform of the sensor

Definition at line 124 of file AsyncDataStream.h.

◆ GetSensorType()

template<typename T>
uint64_t FAsyncDataStreamTmpl< T >::GetSensorType ( )
inline

return the type of sensor of this stream

Definition at line 112 of file AsyncDataStream.h.

◆ GetToken()

template<typename T>
auto FAsyncDataStreamTmpl< T >::GetToken ( ) const
inline

Return the token that allows subscribing to this stream.

Definition at line 46 of file AsyncDataStream.h.

◆ PopBufferFromPool()

template<typename T>
carla::Buffer FAsyncDataStreamTmpl< T >::PopBufferFromPool ( )
inline

Pop a Buffer from the pool.

Buffers in the pool can reuse the memory allocated by previous messages, significantly improving performance for big messages.

Definition at line 54 of file AsyncDataStream.h.

◆ Send()

template<typename T>
template<typename SensorT, typename... ArgsT>
void FAsyncDataStreamTmpl< T >::Send ( SensorT & Sensor,
ArgsT &&... Args )
inline

Send some data down the stream.

Definition at line 192 of file AsyncDataStream.h.

References carla::BufferView::CreateFrom(), Header, Stream, and carla::streaming::detail::Stream< StreamStateT >::Write().

◆ SerializeAndSend()

template<typename T>
template<typename SensorT, typename... ArgsT>
void FAsyncDataStreamTmpl< T >::SerializeAndSend ( SensorT & Sensor,
ArgsT &&... Args )
inline

Definition at line 177 of file AsyncDataStream.h.

References carla::BufferView::CreateFrom(), Header, carla::sensor::CompositeSerializer< std::pair< ACollisionSensor *, s11n::CollisionEventSerializer >, std::pair< ADepthCamera *, s11n::ImageSerializer >, std::pair< ANormalsCamera *, s11n::NormalsImageSerializer >, std::pair< ADVSCamera *, s11n::DVSEventArraySerializer >, std::pair< AGnssSensor *, s11n::GnssSerializer >, std::pair< AInertialMeasurementUnit *, s11n::IMUSerializer >, std::pair< ALaneInvasionSensor *, s11n::NoopSerializer >, std::pair< AObstacleDetectionSensor *, s11n::ObstacleDetectionEventSerializer >, std::pair< AOpticalFlowCamera *, s11n::OpticalFlowImageSerializer >, std::pair< ARadar *, s11n::RadarSerializer >, std::pair< ARayCastSemanticLidar *, s11n::SemanticLidarSerializer >, std::pair< ARayCastLidar *, s11n::LidarSerializer >, std::pair< ARssSensor *, s11n::NoopSerializer >, std::pair< ASceneCaptureCamera *, s11n::ImageSerializer >, std::pair< ASceneCaptureCamera_RayTracedLens *, s11n::ImageSerializer >, std::pair< ASemanticSegmentationCamera *, s11n::ImageSerializer >, std::pair< AInstanceSegmentationCamera *, s11n::ImageSerializer >, std::pair< FWorldObserver *, s11n::EpisodeStateSerializer >, std::pair< ASceneCaptureCamera_WideAngleLens *, s11n::ImageSerializer >, std::pair< ADepthCamera_WideAngleLens *, s11n::ImageSerializer >, std::pair< AInstanceSegmentationCamera_WideAngleLens *, s11n::ImageSerializer >, std::pair< ASemanticSegmentationCamera_WideAngleLens *, s11n::ImageSerializer >, std::pair< FCameraGBufferUint8 *, s11n::GBufferUint8Serializer >, std::pair< FCameraGBufferFloat *, s11n::GBufferFloatSerializer >, std::pair< AHSSLidar *, s11n::LidarSerializer >, std::pair< AV2XSensor *, s11n::CAMDataSerializer >, std::pair< ACustomV2XSensor *, s11n::CustomV2XDataSerializer >, std::pair< AVehicleStatusSensor *, s11n::VehicleStatusSerializer >, std::pair< AAutowareGnssSensor *, s11n::GnssSerializer >, std::pair< ASceneCaptureCamera_RayTracedLensDistance *, s11n::DistanceImageSerializer >, std::pair< ASceneCaptureCamera_RayTracedLensInstance *, s11n::ImageSerializer > >::Serialize(), Stream, and carla::streaming::detail::Stream< StreamStateT >::Write().

Referenced by ACollisionSensor::OnCollisionEvent().

◆ SetFrameNumber()

template<typename T>
void FAsyncDataStreamTmpl< T >::SetFrameNumber ( uint64_t FrameNumber)
inline

allow to change the frame number of the header

Definition at line 67 of file AsyncDataStream.h.

◆ SetTimestamp()

template<typename T>
void FAsyncDataStreamTmpl< T >::SetTimestamp ( double Timestamp)
inline

allow to change the timestamp of the header

Definition at line 82 of file AsyncDataStream.h.

◆ SetTransform()

template<typename T>
void FAsyncDataStreamTmpl< T >::SetTransform ( carla::rpc::Transform Transform)
inline

allow to change the transform of the header

Definition at line 97 of file AsyncDataStream.h.

◆ FDataStreamTmpl< T >

template<typename T>
friend class FDataStreamTmpl< T >
friend

Definition at line 136 of file AsyncDataStream.h.

Member Data Documentation

◆ Header

template<typename T>
carla::Buffer FAsyncDataStreamTmpl< T >::Header
private

Definition at line 160 of file AsyncDataStream.h.

Referenced by FAsyncDataStreamTmpl(), Send(), and SerializeAndSend().

◆ Stream

template<typename T>
StreamType FAsyncDataStreamTmpl< T >::Stream
private

Definition at line 158 of file AsyncDataStream.h.

Referenced by FAsyncDataStreamTmpl(), Send(), and SerializeAndSend().


The documentation for this class was generated from the following files: