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."));
A very simple atomic shared ptr with release-acquire memory order.
std::shared_ptr< T > load() const noexcept
Provides access to the Simulator during a given episode.
friend class EpisodeProxyImpl
EpisodeProxyPointerType::Shared SharedPtrType
SharedPtrType TryLock() const noexcept
SharedPtrType Lock() const
Same as TryLock but never return nullptr.
static EpisodeProxyPointerType::Shared Load(EpisodeProxyPointerType::Strong ptr)
This file contains definitions of common data structures used in traffic manager.
void throw_exception(const std::exception &e)
std::shared_ptr< Simulator > Shared
std::weak_ptr< Simulator > Weak