28 : _episode_id(simulator != nullptr ? simulator->GetCurrentEpisodeId() : 0u),
29 _simulator(
std::move(simulator)) {}
33 auto ptr =
Load(_simulator);
34 const bool is_valid = (ptr !=
nullptr) && (_episode_id == ptr->GetCurrentEpisodeId());
35 return is_valid ? ptr :
nullptr;
40 auto ptr =
Load(_simulator);
43 "trying to operate on a destroyed actor; an actor's function " 44 "was called, but the actor is already destroyed."));
std::shared_ptr< T > load() const noexcept
void throw_exception(const std::exception &e)
This file contains definitions of common data structures used in traffic manager. ...
EpisodeProxyPointerType::Shared SharedPtrType
static EpisodeProxyPointerType::Shared Load(EpisodeProxyPointerType::Strong ptr)
std::shared_ptr< Simulator > Shared
std::weak_ptr< Simulator > Weak
static EpisodeProxyPointerType::Shared Load(EpisodeProxyPointerType::Weak ptr)
A very simple atomic shared ptr with release-acquire memory order.
Provides access to the Simulator during a given episode.
EpisodeProxyImpl()=default