CARLA
Public Member Functions | Private Attributes | List of all members
carla::client::detail::CachedActorList Class Reference

Keeps a list of actor descriptions to avoid requesting each time the descriptions to the server. More...

#include <CachedActorList.h>

+ Inheritance diagram for carla::client::detail::CachedActorList:
+ Collaboration diagram for carla::client::detail::CachedActorList:

Public Member Functions

void Clear ()
 
boost::optional< rpc::ActorGetActorById (ActorId id) const
 Retrieve the actor matching id, or empty optional if actor is not cached. More...
 
template<typename RangeT >
std::vector< rpc::ActorGetActorsById (const RangeT &range) const
 Retrieve the actors matching the ids in range. More...
 
template<typename RangeT >
std::vector< ActorIdGetMissingIds (const RangeT &range) const
 Return the actor ids present in range that haven't been added to this list. More...
 
void Insert (rpc::Actor actor)
 Inserts an actor into the list. More...
 
template<typename RangeT >
void InsertRange (RangeT range)
 Inserts a range containing actors. More...
 

Private Attributes

std::unordered_map< ActorId, rpc::Actor_actors
 
std::mutex _mutex
 

Additional Inherited Members

- Private Member Functions inherited from carla::MovableNonCopyable
 MovableNonCopyable ()=default
 
 MovableNonCopyable (const MovableNonCopyable &)=delete
 
 MovableNonCopyable (MovableNonCopyable &&)=default
 
MovableNonCopyableoperator= (const MovableNonCopyable &)=delete
 
MovableNonCopyableoperator= (MovableNonCopyable &&)=default
 

Detailed Description

Keeps a list of actor descriptions to avoid requesting each time the descriptions to the server.

Todo:
Dead actors are never removed from the list.

Definition at line 30 of file CachedActorList.h.

Member Function Documentation

◆ Clear()

void carla::client::detail::CachedActorList::Clear ( void  )
inline

Definition at line 119 of file CachedActorList.h.

References _actors, and _mutex.

Referenced by carla::client::detail::Episode::OnEpisodeStarted().

+ Here is the caller graph for this function:

◆ GetActorById()

boost::optional< rpc::Actor > carla::client::detail::CachedActorList::GetActorById ( ActorId  id) const
inline

Retrieve the actor matching id, or empty optional if actor is not cached.

Definition at line 96 of file CachedActorList.h.

References _actors, and _mutex.

Referenced by carla::client::detail::Episode::GetActorById().

+ Here is the caller graph for this function:

◆ GetActorsById()

template<typename RangeT >
std::vector< rpc::Actor > carla::client::detail::CachedActorList::GetActorsById ( const RangeT &  range) const
inline

Retrieve the actors matching the ids in range.

Definition at line 106 of file CachedActorList.h.

References _actors, and _mutex.

Referenced by carla::client::detail::GetActorsById_Impl().

+ Here is the caller graph for this function:

◆ GetMissingIds()

template<typename RangeT >
std::vector< ActorId > carla::client::detail::CachedActorList::GetMissingIds ( const RangeT &  range) const
inline

Return the actor ids present in range that haven't been added to this list.

Definition at line 86 of file CachedActorList.h.

References _actors, and _mutex.

Referenced by carla::client::detail::GetActorsById_Impl().

+ Here is the caller graph for this function:

◆ Insert()

void carla::client::detail::CachedActorList::Insert ( rpc::Actor  actor)
inline

Inserts an actor into the list.

Definition at line 66 of file CachedActorList.h.

References _actors, _mutex, and carla::rpc::Actor::id.

Referenced by carla::client::detail::Episode::GetActorById(), and carla::client::detail::Episode::RegisterActor().

+ Here is the caller graph for this function:

◆ InsertRange()

template<typename RangeT >
void carla::client::detail::CachedActorList::InsertRange ( RangeT  range)
inline

Inserts a range containing actors.

Definition at line 73 of file CachedActorList.h.

References _actors, and _mutex.

Referenced by carla::client::detail::GetActorsById_Impl().

+ Here is the caller graph for this function:

Member Data Documentation

◆ _actors

std::unordered_map<ActorId, rpc::Actor> carla::client::detail::CachedActorList::_actors
private

Definition at line 59 of file CachedActorList.h.

Referenced by Clear(), GetActorById(), GetActorsById(), GetMissingIds(), Insert(), and InsertRange().

◆ _mutex

std::mutex carla::client::detail::CachedActorList::_mutex
mutableprivate

Definition at line 57 of file CachedActorList.h.

Referenced by Clear(), GetActorById(), GetActorsById(), GetMissingIds(), Insert(), and InsertRange().


The documentation for this class was generated from the following file: