CARLA
Public Types | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
FActorRegistry Class Reference

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

#include <ActorRegistry.h>

+ Collaboration diagram for FActorRegistry:

Public Types

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

Public Member Functions

Actor registry functions
FCarlaActorRegister (AActor &Actor, FActorDescription Description, IdType DesiredId=0)
 Register the Actor in the database. More...
 
void Deregister (IdType Id)
 
void Deregister (AActor *Actor)
 
Look up functions
int32 Num () const
 
bool IsEmpty () const
 
bool Contains (uint32 Id) const
 
FCarlaActorFindCarlaActor (IdType Id)
 
const FCarlaActorFindCarlaActor (IdType Id) const
 
FCarlaActorFindCarlaActor (const AActor *Actor)
 
const FCarlaActorFindCarlaActor (const AActor *Actor) const
 
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< FCarlaActorMakeCarlaActor (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 *, IdTypeIds
 

Static Private Attributes

static IdType ID_COUNTER = 0u
 

Detailed Description

A registry of all the Carla actors.

Definition at line 20 of file ActorRegistry.h.

Member Typedef Documentation

◆ DatabaseType

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

Definition at line 30 of file ActorRegistry.h.

◆ IdType

Definition at line 24 of file ActorRegistry.h.

◆ ValueType

Definition at line 25 of file ActorRegistry.h.

Member Function Documentation

◆ begin()

auto FActorRegistry::begin ( ) const
inlinenoexcept

Definition at line 106 of file ActorRegistry.h.

References ActorDatabase.

Referenced by FCarlaServer::FPimpl::BindActions(), CarlaReplayerHelper::FindTrafficLightAt(), FFrameData::FindTrafficLightAt(), FFrameData::GetFrameData(), and ACarlaRecorder::Ticking().

+ Here is the caller graph for this function:

◆ Contains()

bool FActorRegistry::Contains ( uint32  Id) const
inline

Definition at line 64 of file ActorRegistry.h.

References ActorDatabase.

Referenced by FFrameData::CreateOrReuseActor(), and CarlaReplayerHelper::TryToCreateReplayerActor().

+ Here is the caller graph for this function:

◆ Deregister() [1/2]

void FActorRegistry::Deregister ( IdType  Id)

Definition at line 118 of file ActorRegistry.cpp.

References ActorDatabase, Actors, FindCarlaActor(), FCarlaActor::GetActor(), Ids, and FCarlaActor::TheActor.

Referenced by Deregister(), UActorDispatcher::DestroyActor(), and UActorDispatcher::OnActorDestroyed().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Deregister() [2/2]

void FActorRegistry::Deregister ( AActor Actor)

Definition at line 135 of file ActorRegistry.cpp.

References Deregister(), FindCarlaActor(), FCarlaActor::GetActor(), and FCarlaActor::GetActorId().

+ Here is the call graph for this function:

◆ end()

auto FActorRegistry::end ( ) const
inlinenoexcept

Definition at line 111 of file ActorRegistry.h.

References ActorDatabase, MakeCarlaActor(), and MakeFakeActor().

Referenced by FCarlaServer::FPimpl::BindActions(), CarlaReplayerHelper::FindTrafficLightAt(), FFrameData::FindTrafficLightAt(), FFrameData::GetFrameData(), and ACarlaRecorder::Ticking().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FindCarlaActor() [1/4]

FCarlaActor* FActorRegistry::FindCarlaActor ( IdType  Id)
inline

◆ FindCarlaActor() [2/4]

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

Definition at line 75 of file ActorRegistry.h.

References ActorDatabase.

◆ FindCarlaActor() [3/4]

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

Definition at line 81 of file ActorRegistry.h.

References FindCarlaActor(), and Ids.

+ Here is the call graph for this function:

◆ FindCarlaActor() [4/4]

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

Definition at line 87 of file ActorRegistry.h.

References FindCarlaActor(), GetDescriptionFromStream(), Ids, PutActorToSleep(), and WakeActorUp().

+ Here is the call graph for this function:

◆ GetDescriptionFromStream()

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

Definition at line 240 of file ActorRegistry.cpp.

References ActorDatabase, FActorInfo::Description, ASensor::GetToken(), and FActorDescription::Id.

Referenced by FindCarlaActor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsEmpty()

bool FActorRegistry::IsEmpty ( ) const
inline

Definition at line 59 of file ActorRegistry.h.

References Num().

+ Here is the call graph for this function:

◆ MakeCarlaActor()

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

Definition at line 143 of file ActorRegistry.cpp.

References CarlaGetRelevantTagAsString(), FCarlaActor::ConstructCarlaActor(), FActorRegistry_GetActorType(), UBoundingBoxCalculator::GetActorBoundingBox(), and ATagger::GetTagsOfTaggedActor().

Referenced by end(), and Register().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MakeFakeActor()

FCarlaActor FActorRegistry::MakeFakeActor ( AActor Actor) const
private

Referenced by end().

+ Here is the caller graph for this function:

◆ Num()

int32 FActorRegistry::Num ( ) const
inline

Definition at line 54 of file ActorRegistry.h.

References Actors.

Referenced by FWorldObserver_Serialize(), and IsEmpty().

+ Here is the caller graph for this function:

◆ PutActorToSleep()

void FActorRegistry::PutActorToSleep ( FCarlaActor::IdType  Id,
UCarlaEpisode CarlaEpisode 
)

Definition at line 186 of file ActorRegistry.cpp.

References Actors, FindCarlaActor(), FCarlaActor::GetActor(), FCarlaActor::GetChildren(), Ids, and FCarlaActor::PutActorToSleep().

Referenced by FindCarlaActor(), and UActorDispatcher::PutActorToSleep().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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 72 of file ActorRegistry.cpp.

References ActorDatabase, Actors, FindCarlaActor(), ID_COUNTER, Ids, FCarlaActor::IsDormant(), MakeCarlaActor(), and FCarlaActor::TheActor.

Referenced by UActorDispatcher::RegisterActor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ WakeActorUp()

void FActorRegistry::WakeActorUp ( FCarlaActor::IdType  Id,
UCarlaEpisode CarlaEpisode 
)

Definition at line 206 of file ActorRegistry.cpp.

References Actors, UCarlaEpisode::AttachActors(), FindCarlaActor(), FCarlaActor::GetActor(), FCarlaActor::GetAttachmentType(), FCarlaActor::GetChildren(), FCarlaActor::GetParent(), Ids, FCarlaActor::IsDormant(), and FCarlaActor::WakeActorUp().

Referenced by FindCarlaActor(), and UActorDispatcher::WakeActorUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ ActorDatabase

DatabaseType FActorRegistry::ActorDatabase
private

◆ Actors

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

Definition at line 128 of file ActorRegistry.h.

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

◆ ID_COUNTER

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

Definition at line 134 of file ActorRegistry.h.

Referenced by Register().

◆ Ids

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

Definition at line 130 of file ActorRegistry.h.

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


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