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 More... | |
FTransform | GetSensorTransform () |
return the transform of the sensor More... | |
uint64_t | GetSensorType () |
return the type of sensor of this stream More... | |
auto | GetToken () const |
Return the token that allows subscribing to this stream. More... | |
carla::Buffer | PopBufferFromPool () |
Pop a Buffer from the pool. More... | |
template<typename SensorT , typename... ArgsT> | |
void | Send (SensorT &Sensor, ArgsT &&... Args) |
Send some data down the stream. More... | |
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 More... | |
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 > |
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.
FAsyncDataStream also has a pool of carla::Buffer that allows reusing the allocated memory, use it whenever possible.
Definition at line 35 of file AsyncDataStream.h.
using FAsyncDataStreamTmpl< T >::StreamType = T |
Definition at line 39 of file AsyncDataStream.h.
|
default |
|
inlineexplicitprivate |
Definition at line 18 of file AsyncDataStreamImpl.h.
References FCarlaEngine::GetFrameCounter().
|
inline |
return the timestamp of the sensor
Definition at line 104 of file AsyncDataStream.h.
References carla::Buffer::data(), FAsyncDataStreamTmpl< T >::Header, and carla::sensor::s11n::SensorHeaderSerializer::Header::timestamp.
|
inline |
return the transform of the sensor
Definition at line 92 of file AsyncDataStream.h.
References carla::Buffer::data(), FAsyncDataStreamTmpl< T >::Header, and carla::sensor::s11n::SensorHeaderSerializer::Header::sensor_transform.
|
inline |
return the type of sensor of this stream
Definition at line 80 of file AsyncDataStream.h.
References carla::Buffer::data(), FAsyncDataStreamTmpl< T >::Header, and carla::sensor::s11n::SensorHeaderSerializer::Header::sensor_type.
|
inline |
Return the token that allows subscribing to this stream.
Definition at line 44 of file AsyncDataStream.h.
References FAsyncDataStreamTmpl< T >::Stream.
|
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 52 of file AsyncDataStream.h.
References FAsyncDataStreamTmpl< T >::Send(), FAsyncDataStreamTmpl< T >::SerializeAndSend(), and FAsyncDataStreamTmpl< T >::Stream.
|
inline |
Send some data down the stream.
Definition at line 160 of file AsyncDataStream.h.
References carla::BufferView::CreateFrom(), FAsyncDataStreamTmpl< T >::Header, and FAsyncDataStreamTmpl< T >::Stream.
Referenced by FAsyncDataStreamTmpl< T >::PopBufferFromPool().
|
inline |
Definition at line 145 of file AsyncDataStream.h.
References carla::BufferView::CreateFrom(), FAsyncDataStreamTmpl< T >::Header, carla::sensor::CompositeSerializer< Items >::Serialize(), and FAsyncDataStreamTmpl< T >::Stream.
Referenced by ACollisionSensor::OnCollisionEvent(), and FAsyncDataStreamTmpl< T >::PopBufferFromPool().
|
inline |
allow to change the frame number of the header
Definition at line 65 of file AsyncDataStream.h.
References carla::Buffer::data(), carla::sensor::s11n::SensorHeaderSerializer::Header::frame, FAsyncDataStreamTmpl< T >::Header, carla::log_info(), and carla::sensor::s11n::SensorHeaderSerializer::Header::sensor_type.
|
friend |
Definition at line 117 of file AsyncDataStream.h.
|
private |
Definition at line 128 of file AsyncDataStream.h.
Referenced by FAsyncDataStreamTmpl< T >::GetSensorTimestamp(), FAsyncDataStreamTmpl< T >::GetSensorTransform(), FAsyncDataStreamTmpl< T >::GetSensorType(), FAsyncDataStreamTmpl< T >::Send(), FAsyncDataStreamTmpl< T >::SerializeAndSend(), and FAsyncDataStreamTmpl< T >::SetFrameNumber().
|
private |
Definition at line 126 of file AsyncDataStream.h.
Referenced by FAsyncDataStreamTmpl< T >::GetToken(), FAsyncDataStreamTmpl< T >::PopBufferFromPool(), FAsyncDataStreamTmpl< T >::Send(), and FAsyncDataStreamTmpl< T >::SerializeAndSend().