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
原子加载当前指针值
在给定情节期间提供对模拟器的访问。 情节结束后,对模拟器的任何访问都会引发 std::runtime_error。
friend class EpisodeProxyImpl
EpisodeProxyPointerType::Shared SharedPtrType
SharedPtrType TryLock() const noexcept
SharedPtrType Lock() const
与 TryLock 相同,但永远不会返回 nullptr。
static EpisodeProxyPointerType::Shared Load(EpisodeProxyPointerType::Strong ptr)
void throw_exception(const std::exception &e)
std::shared_ptr< Simulator > Shared
std::weak_ptr< Simulator > Weak