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
 
void PutActorToSleep (FCarlaActor::IdType Id, UCarlaEpisode *CarlaEpisode)
 
void WakeActorUp (FCarlaActor::IdType Id, UCarlaEpisode *CarlaEpisode)
 
Range iteration support
auto begin () const noexcept
 
auto end () const noexcept
 

Private Types

using DatabaseType = TMap< FCarlaActor::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<FCarlaActor::IdType, TSharedPtr<FCarlaActor> >
private

Definition at line 25 of file ActorRegistry.h.

◆ IdType

Definition at line 29 of file ActorRegistry.h.

◆ ValueType

Definition at line 30 of file ActorRegistry.h.

Member Function Documentation

◆ begin()

auto FActorRegistry::begin ( ) const
inlinenoexcept

Definition at line 105 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 CarlaReplayerHelper::TryToCreateReplayerActor(), and FFrameData::TryToCreateReplayerActor().

+ Here is the caller graph for this function:

◆ Deregister() [1/2]

void FActorRegistry::Deregister ( IdType  Id)

Definition at line 113 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 130 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 110 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(), Ids, PutActorToSleep(), and WakeActorUp().

+ Here is the call 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 138 of file ActorRegistry.cpp.

References FCarlaActor::ConstructCarlaActor(), FActorRegistry_GetActorType(), UBoundingBoxCalculator::GetActorBoundingBox(), GetRelevantTagAsString(), 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 181 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 67 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 201 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

Definition at line 131 of file ActorRegistry.h.

Referenced by begin(), Contains(), Deregister(), end(), FindCarlaActor(), and Register().

◆ Actors

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

Definition at line 127 of file ActorRegistry.h.

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

◆ ID_COUNTER

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

Definition at line 133 of file ActorRegistry.h.

Referenced by Register().

◆ Ids

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

Definition at line 129 of file ActorRegistry.h.

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


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