CARLA
Loading...
Searching...
No Matches
FActorRegistry Class Reference

A registry of all the Carla actors. More...

#include <ActorRegistry.h>

Public Types

using IdType = FCarlaActor::IdType
using ValueType = TSharedPtr<FCarlaActor>

Public Member Functions

Actor registry functions
FCarlaActor * Register (AActor &Actor, FActorDescription Description, IdType DesiredId=0)
 Register the Actor in the database.
void Deregister (IdType Id)
void Deregister (AActor *Actor)
Look up functions
int32 Num () const
bool IsEmpty () const
bool Contains (uint32 Id) const
FCarlaActor * FindCarlaActor (IdType Id)
const FCarlaActor * FindCarlaActor (IdType Id) const
FCarlaActor * FindCarlaActor (const AActor *Actor)
const FCarlaActor * FindCarlaActor (const AActor *Actor) const
FCarlaActor * FindCarlaActorFromStream (carla::streaming::detail::stream_id_type Id)
 Returns the sensor whose data stream has id Id, or nullptr.
FString GetDescriptionFromStream (carla::streaming::detail::stream_id_type Id)
void PutActorToSleep (IdType Id, UCarlaEpisode *CarlaEpisode)
void WakeActorUp (IdType Id, UCarlaEpisode *CarlaEpisode)
Range iteration support
auto begin () const noexcept
auto end () const noexcept

Private Types

using DatabaseType = TMap<IdType, TSharedPtr<FCarlaActor>>

Private Member Functions

TSharedPtr< FCarlaActor > MakeCarlaActor (IdType Id, AActor &Actor, FActorDescription Description, carla::rpc::ActorState InState) const
FCarlaActor MakeFakeActor (AActor &Actor) const

Private Attributes

DatabaseType ActorDatabase
TMap< IdType, AActor * > Actors
TMap< AActor *, IdType > Ids

Static Private Attributes

static IdType ID_COUNTER = 0u

Detailed Description

A registry of all the Carla actors.

Definition at line 18 of file ActorRegistry.h.

Member Typedef Documentation

◆ DatabaseType

using FActorRegistry::DatabaseType = TMap<IdType, TSharedPtr<FCarlaActor>>
private

Definition at line 28 of file ActorRegistry.h.

◆ IdType

Definition at line 22 of file ActorRegistry.h.

◆ ValueType

Definition at line 23 of file ActorRegistry.h.

Member Function Documentation

◆ begin()

◆ Contains()

bool FActorRegistry::Contains ( uint32 Id) const
inline

Definition at line 62 of file ActorRegistry.h.

References ActorDatabase.

Referenced by FFrameData::GetFrameData().

◆ Deregister() [1/2]

void FActorRegistry::Deregister ( AActor * Actor)

◆ Deregister() [2/2]

◆ end()

auto FActorRegistry::end ( ) const
inlinenoexcept

◆ FindCarlaActor() [1/4]

FCarlaActor * FActorRegistry::FindCarlaActor ( const AActor * Actor)
inline

Definition at line 79 of file ActorRegistry.h.

References FindCarlaActor(), and Ids.

◆ FindCarlaActor() [2/4]

const FCarlaActor * FActorRegistry::FindCarlaActor ( const AActor * Actor) const
inline

Definition at line 85 of file ActorRegistry.h.

References FindCarlaActor(), and Ids.

◆ FindCarlaActor() [3/4]

◆ FindCarlaActor() [4/4]

const FCarlaActor * FActorRegistry::FindCarlaActor ( IdType Id) const
inline

Definition at line 73 of file ActorRegistry.h.

References ActorDatabase.

◆ FindCarlaActorFromStream()

FCarlaActor * FActorRegistry::FindCarlaActorFromStream ( carla::streaming::detail::stream_id_type Id)

Returns the sensor whose data stream has id Id, or nullptr.

Definition at line 270 of file ActorRegistry.cpp.

References ActorDatabase, carla::streaming::detail::token_type::get_stream_id(), and ASensor::GetToken().

Referenced by GetDescriptionFromStream().

◆ GetDescriptionFromStream()

FString FActorRegistry::GetDescriptionFromStream ( carla::streaming::detail::stream_id_type Id)

◆ IsEmpty()

bool FActorRegistry::IsEmpty ( ) const
inline

Definition at line 57 of file ActorRegistry.h.

References Num().

◆ MakeCarlaActor()

TSharedPtr< FCarlaActor > FActorRegistry::MakeCarlaActor ( IdType Id,
AActor & Actor,
FActorDescription Description,
carla::rpc::ActorState InState ) const
private

◆ MakeFakeActor()

FCarlaActor FActorRegistry::MakeFakeActor ( AActor & Actor) const
private

◆ Num()

int32 FActorRegistry::Num ( ) const
inline

Definition at line 52 of file ActorRegistry.h.

References Actors.

Referenced by FWorldObserver_Serialize(), FFrameData::GetFrameData(), and IsEmpty().

◆ PutActorToSleep()

◆ Register()

FCarlaActor * FActorRegistry::Register ( AActor & Actor,
FActorDescription Description,
IdType DesiredId = 0 )

Register the Actor in the database.

A new ID will be assign to this actor.

Warning
Undefined if an actor is registered more than once.

Definition at line 71 of file ActorRegistry.cpp.

References carla::rpc::Active, ActorDatabase, Actors, FindCarlaActor(), ID_COUNTER, Ids, FCarlaActor::IsDormant(), MakeCarlaActor(), FCarlaActor::TheActor, FActorAttribute::Value, and FActorDescription::Variations.

Referenced by UActorDispatcher::RegisterActor().

◆ WakeActorUp()

Member Data Documentation

◆ ActorDatabase

DatabaseType FActorRegistry::ActorDatabase
private

◆ Actors

TMap<IdType, AActor *> FActorRegistry::Actors
private

Definition at line 129 of file ActorRegistry.h.

Referenced by Deregister(), Num(), PutActorToSleep(), Register(), and WakeActorUp().

◆ ID_COUNTER

FActorRegistry::IdType FActorRegistry::ID_COUNTER = 0u
staticprivate

Definition at line 135 of file ActorRegistry.h.

Referenced by Register().

◆ Ids

TMap<AActor *, IdType> FActorRegistry::Ids
private

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