|
CARLA
|
Secondary-side map from a primary sensor actor to its local stream, exposed to clients only through an alias of the primary's stream id. More...
#include <sensorStreamRegistry.h>
Classes | |
| struct | Entry |
Public Types | |
| using | actor_id_type = uint32_t |
| using | epoch_type = uint64_t |
| using | stream_id_type = carla::streaming::detail::stream_id_type |
| using | token_type = carla::streaming::detail::token_type |
Public Member Functions | |
| epoch_type | BeginEpisodeChange (carla::streaming::Server &server) |
| The primary switched episode: forgets every actor and returns the epoch the secondary must pass to OpenEpisode() once it runs the new episode. | |
| std::optional< carla::streaming::Stream > | Bind (carla::streaming::Server &server, actor_id_type actor_id, stream_id_type sensor_stream_id, bool can_adopt) |
| Returns the stream reserved for actor_id if can_adopt (the sensor has never ticked) and the sensor must adopt it; otherwise the alias is retargeted to sensor_stream_id. | |
| void | CloseEpisode () |
| bool | IsEpisodeOpen () |
| Whether Bind()/Unbind() are accepted, i.e. | |
| void | OpenEpisode (epoch_type epoch) |
| Accepts binding if epoch is the latest one BeginEpisodeChange() issued. | |
| std::optional< token_type > | Resolve (carla::streaming::Server &server, actor_id_type actor_id, stream_id_type primary_stream_id) |
| Token that serves primary actor actor_id under primary_stream_id, reserving a local stream if the sensor has not spawned here yet. | |
| void | Unbind (carla::streaming::Server &server, actor_id_type actor_id) |
| Forgets actor_id, closing its reserved stream if no sensor adopted it. | |
Static Private Member Functions | |
| static void | Forget (carla::streaming::Server &server, const Entry &entry) |
Private Attributes | |
| bool | _bindable = false |
| std::unordered_map< actor_id_type, Entry > | _entries |
| epoch_type | _epoch = 0u |
| std::mutex | _mutex |
Secondary-side map from a primary sensor actor to its local stream, exposed to clients only through an alias of the primary's stream id.
Entries are per primary episode. Resolve() and BeginEpisodeChange() run on the multi-GPU command thread, the rest on the game thread.
Definition at line 24 of file sensorStreamRegistry.h.
| using carla::multigpu::SensorStreamRegistry::actor_id_type = uint32_t |
Definition at line 26 of file sensorStreamRegistry.h.
| using carla::multigpu::SensorStreamRegistry::epoch_type = uint64_t |
Definition at line 27 of file sensorStreamRegistry.h.
| using carla::multigpu::SensorStreamRegistry::stream_id_type = carla::streaming::detail::stream_id_type |
Definition at line 28 of file sensorStreamRegistry.h.
Definition at line 29 of file sensorStreamRegistry.h.
| SensorStreamRegistry::epoch_type carla::multigpu::SensorStreamRegistry::BeginEpisodeChange | ( | carla::streaming::Server & | server | ) |
The primary switched episode: forgets every actor and returns the epoch the secondary must pass to OpenEpisode() once it runs the new episode.
Definition at line 112 of file sensorStreamRegistry.cpp.
References _bindable, _entries, _epoch, _mutex, and Forget().
Referenced by FCarlaEngine::NotifyInitGame().
| std::optional< carla::streaming::Stream > carla::multigpu::SensorStreamRegistry::Bind | ( | carla::streaming::Server & | server, |
| actor_id_type | actor_id, | ||
| stream_id_type | sensor_stream_id, | ||
| bool | can_adopt | ||
| ) |
Returns the stream reserved for actor_id if can_adopt (the sensor has never ticked) and the sensor must adopt it; otherwise the alias is retargeted to sensor_stream_id.
A stream bound to another actor is refused.
Definition at line 54 of file sensorStreamRegistry.cpp.
References _bindable, _entries, _mutex, carla::streaming::Server::CloseStream(), carla::log_warning(), and carla::streaming::Server::SetStreamAlias().
Referenced by FCarlaEngine::BindReplayedSensor().
| void carla::multigpu::SensorStreamRegistry::CloseEpisode | ( | ) |
Definition at line 127 of file sensorStreamRegistry.cpp.
References _bindable, and _mutex.
Referenced by FCarlaEngine::NotifyEndEpisode().
|
staticprivate |
Definition at line 137 of file sensorStreamRegistry.cpp.
References carla::streaming::Server::CloseStream(), carla::multigpu::SensorStreamRegistry::Entry::primary_stream_id, carla::streaming::Server::RemoveStreamAlias(), carla::multigpu::SensorStreamRegistry::Entry::reserved, and carla::multigpu::SensorStreamRegistry::Entry::stream_id.
Referenced by BeginEpisodeChange(), Resolve(), and Unbind().
| bool carla::multigpu::SensorStreamRegistry::IsEpisodeOpen | ( | ) |
Whether Bind()/Unbind() are accepted, i.e.
the episode of the latest BeginEpisodeChange() is open.
Definition at line 132 of file sensorStreamRegistry.cpp.
References _bindable, and _mutex.
Referenced by FCarlaEngine::BindReplayedSensor(), and FCarlaEngine::OnBeginFrame().
| void carla::multigpu::SensorStreamRegistry::OpenEpisode | ( | epoch_type | epoch | ) |
Accepts binding if epoch is the latest one BeginEpisodeChange() issued.
Definition at line 122 of file sensorStreamRegistry.cpp.
References _bindable, _epoch, and _mutex.
Referenced by FCarlaEngine::NotifyBeginEpisode().
| std::optional< SensorStreamRegistry::token_type > carla::multigpu::SensorStreamRegistry::Resolve | ( | carla::streaming::Server & | server, |
| actor_id_type | actor_id, | ||
| stream_id_type | primary_stream_id | ||
| ) |
Token that serves primary actor actor_id under primary_stream_id, reserving a local stream if the sensor has not spawned here yet.
Definition at line 14 of file sensorStreamRegistry.cpp.
References _entries, _mutex, carla::streaming::Server::FindToken(), first, Forget(), carla::streaming::detail::token_type::get_stream_id(), carla::log_info(), carla::log_warning(), carla::streaming::Server::MakeStream(), carla::streaming::Server::RemoveStreamAlias(), and carla::streaming::Server::SetStreamAlias().
Referenced by FCarlaEngine::NotifyInitGame().
| void carla::multigpu::SensorStreamRegistry::Unbind | ( | carla::streaming::Server & | server, |
| actor_id_type | actor_id | ||
| ) |
Forgets actor_id, closing its reserved stream if no sensor adopted it.
Definition at line 97 of file sensorStreamRegistry.cpp.
References _bindable, _entries, _mutex, and Forget().
Referenced by FCarlaEngine::PlayPrimaryFrame().
|
private |
Definition at line 78 of file sensorStreamRegistry.h.
Referenced by BeginEpisodeChange(), Bind(), CloseEpisode(), IsEpisodeOpen(), OpenEpisode(), and Unbind().
|
private |
Definition at line 79 of file sensorStreamRegistry.h.
Referenced by BeginEpisodeChange(), Bind(), Resolve(), and Unbind().
|
private |
Definition at line 77 of file sensorStreamRegistry.h.
Referenced by BeginEpisodeChange(), and OpenEpisode().
|
private |
Definition at line 76 of file sensorStreamRegistry.h.
Referenced by BeginEpisodeChange(), Bind(), CloseEpisode(), IsEpisodeOpen(), OpenEpisode(), Resolve(), and Unbind().