CARLA
Loading...
Searching...
No Matches
carla::client::LightManager Class Reference

#include <LightManager.h>

Inheritance diagram for carla::client::LightManager:

Public Member Functions

std::vector< Light > GetAllLights (LightGroup type=LightGroup::None) const
Color GetColor (LightId id) const
std::vector< Color > GetColor (std::vector< Light > &lights) const
float GetIntensity (LightId id) const
std::vector< float > GetIntensity (std::vector< Light > &lights) const
LightGroup GetLightGroup (LightId id) const
std::vector< LightGroup > GetLightGroup (std::vector< Light > &lights) const
LightState GetLightState (LightId id) const
std::vector< LightState > GetLightState (std::vector< Light > &lights) const
std::vector< Light > GetTurnedOffLights (LightGroup type=LightGroup::None) const
std::vector< Light > GetTurnedOnLights (LightGroup type=LightGroup::None) const
bool IsActive (LightId id) const
std::vector< bool > IsActive (std::vector< Light > &lights) const
 LightManager ()
 LightManager (const LightManager &other)
void SetActive (LightId id, bool active)
void SetActive (std::vector< Light > &lights, std::vector< bool > &active)
void SetColor (LightId id, Color color)
void SetColor (std::vector< Light > &lights, Color color)
void SetColor (std::vector< Light > &lights, std::vector< Color > &colors)
void SetDayNightCycle (const bool active)
void SetEpisode (detail::WeakEpisodeProxy episode)
void SetIntensity (LightId id, float intensity)
void SetIntensity (std::vector< Light > &lights, float intensity)
void SetIntensity (std::vector< Light > &lights, std::vector< float > &intensities)
void SetLightGroup (LightId id, LightGroup group)
void SetLightGroup (std::vector< Light > &lights, LightGroup group)
void SetLightGroup (std::vector< Light > &lights, std::vector< LightGroup > &groups)
void SetLightState (LightId id, const LightState &new_state)
void SetLightState (std::vector< Light > &lights, LightState state)
void SetLightState (std::vector< Light > &lights, std::vector< LightState > &states)
void SetLightStateNoLock (LightId id, const LightState &new_state)
void TurnOff (std::vector< Light > &lights)
void TurnOn (std::vector< Light > &lights)
 ~LightManager ()

Private Types

using LightGroup = rpc::LightState::LightGroup

Private Member Functions

void ApplyChanges ()
void QueryLightsStateToServer ()
const LightState & RetrieveLightState (LightId id) const
void UpdateServerLightsState (bool discard_client=false)

Private Attributes

bool _dirty = false
detail::WeakEpisodeProxy _episode
std::unordered_map< LightId, Light > _lights
std::unordered_map< LightId, LightState > _lights_changes
std::unordered_map< LightId, LightState > _lights_state
std::mutex _mutex
size_t _on_light_update_register_id = 0
size_t _on_tick_register_id = 0
LightState _state

Detailed Description

Definition at line 25 of file LightManager.h.

Member Typedef Documentation

◆ LightGroup

Constructor & Destructor Documentation

◆ LightManager() [1/2]

carla::client::LightManager::LightManager ( )
inline

Definition at line 32 of file LightManager.h.

Referenced by LightManager().

◆ ~LightManager()

◆ LightManager() [2/2]

carla::client::LightManager::LightManager ( const LightManager & other)
inline

Member Function Documentation

◆ ApplyChanges()

void carla::client::LightManager::ApplyChanges ( )
private

Definition at line 359 of file LightManager.cpp.

References _lights_changes, _mutex, and SetLightStateNoLock().

Referenced by SetEpisode().

◆ GetAllLights()

std::vector< Light > carla::client::LightManager::GetAllLights ( LightGroup type = LightGroup::None) const

Definition at line 53 of file LightManager.cpp.

References _lights, _lights_state, and _mutex.

◆ GetColor() [1/2]

Color carla::client::LightManager::GetColor ( LightId id) const

Definition at line 217 of file LightManager.cpp.

References carla::client::LightState::_color, _mutex, and RetrieveLightState().

◆ GetColor() [2/2]

std::vector< Color > carla::client::LightManager::GetColor ( std::vector< Light > & lights) const

Definition at line 146 of file LightManager.cpp.

References GetColor().

Referenced by GetColor().

◆ GetIntensity() [1/2]

float carla::client::LightManager::GetIntensity ( LightId id) const

◆ GetIntensity() [2/2]

std::vector< float > carla::client::LightManager::GetIntensity ( std::vector< Light > & lights) const

Definition at line 167 of file LightManager.cpp.

References GetIntensity().

Referenced by GetIntensity().

◆ GetLightGroup() [1/2]

LightGroup carla::client::LightManager::GetLightGroup ( LightId id) const

Definition at line 232 of file LightManager.cpp.

References carla::client::LightState::_group, _mutex, and RetrieveLightState().

◆ GetLightGroup() [2/2]

std::vector< LightGroup > carla::client::LightManager::GetLightGroup ( std::vector< Light > & lights) const

Definition at line 188 of file LightManager.cpp.

References GetLightGroup().

Referenced by GetLightGroup().

◆ GetLightState() [1/2]

LightState carla::client::LightManager::GetLightState ( LightId id) const

Definition at line 227 of file LightManager.cpp.

References _mutex, and RetrieveLightState().

◆ GetLightState() [2/2]

std::vector< LightState > carla::client::LightManager::GetLightState ( std::vector< Light > & lights) const

Definition at line 209 of file LightManager.cpp.

References GetLightState().

Referenced by GetLightState().

◆ GetTurnedOffLights()

std::vector< Light > carla::client::LightManager::GetTurnedOffLights ( LightGroup type = LightGroup::None) const

◆ GetTurnedOnLights()

std::vector< Light > carla::client::LightManager::GetTurnedOnLights ( LightGroup type = LightGroup::None) const

◆ IsActive() [1/2]

bool carla::client::LightManager::IsActive ( LightId id) const

◆ IsActive() [2/2]

std::vector< bool > carla::client::LightManager::IsActive ( std::vector< Light > & lights) const

Definition at line 89 of file LightManager.cpp.

References IsActive().

Referenced by IsActive().

◆ QueryLightsStateToServer()

void carla::client::LightManager::QueryLightsStateToServer ( )
private

◆ RetrieveLightState()

const LightState & carla::client::LightManager::RetrieveLightState ( LightId id) const
private

◆ SetActive() [1/2]

void carla::client::LightManager::SetActive ( LightId id,
bool active )

◆ SetActive() [2/2]

void carla::client::LightManager::SetActive ( std::vector< Light > & lights,
std::vector< bool > & active )

Definition at line 82 of file LightManager.cpp.

References SetActive().

Referenced by SetActive(), TurnOff(), and TurnOn().

◆ SetColor() [1/3]

void carla::client::LightManager::SetColor ( LightId id,
Color color )

◆ SetColor() [2/3]

void carla::client::LightManager::SetColor ( std::vector< Light > & lights,
Color color )

Definition at line 133 of file LightManager.cpp.

References SetColor().

Referenced by SetColor(), and SetColor().

◆ SetColor() [3/3]

void carla::client::LightManager::SetColor ( std::vector< Light > & lights,
std::vector< Color > & colors )

Definition at line 139 of file LightManager.cpp.

References SetColor().

◆ SetDayNightCycle()

void carla::client::LightManager::SetDayNightCycle ( const bool active)

◆ SetEpisode()

◆ SetIntensity() [1/3]

void carla::client::LightManager::SetIntensity ( LightId id,
float intensity )

◆ SetIntensity() [2/3]

void carla::client::LightManager::SetIntensity ( std::vector< Light > & lights,
float intensity )

Definition at line 154 of file LightManager.cpp.

References SetIntensity().

Referenced by SetIntensity(), and SetIntensity().

◆ SetIntensity() [3/3]

void carla::client::LightManager::SetIntensity ( std::vector< Light > & lights,
std::vector< float > & intensities )

Definition at line 160 of file LightManager.cpp.

References SetIntensity().

◆ SetLightGroup() [1/3]

void carla::client::LightManager::SetLightGroup ( LightId id,
LightGroup group )

◆ SetLightGroup() [2/3]

void carla::client::LightManager::SetLightGroup ( std::vector< Light > & lights,
LightGroup group )

Definition at line 175 of file LightManager.cpp.

References SetLightGroup().

Referenced by SetLightGroup(), and SetLightGroup().

◆ SetLightGroup() [3/3]

void carla::client::LightManager::SetLightGroup ( std::vector< Light > & lights,
std::vector< LightGroup > & groups )

Definition at line 181 of file LightManager.cpp.

References SetLightGroup().

◆ SetLightState() [1/3]

void carla::client::LightManager::SetLightState ( LightId id,
const LightState & new_state )

Definition at line 266 of file LightManager.cpp.

References _dirty, _lights_changes, _mutex, and RetrieveLightState().

◆ SetLightState() [2/3]

void carla::client::LightManager::SetLightState ( std::vector< Light > & lights,
LightState state )

Definition at line 196 of file LightManager.cpp.

References SetLightState().

Referenced by SetLightState(), and SetLightState().

◆ SetLightState() [3/3]

void carla::client::LightManager::SetLightState ( std::vector< Light > & lights,
std::vector< LightState > & states )

Definition at line 202 of file LightManager.cpp.

References SetLightState().

◆ SetLightStateNoLock()

void carla::client::LightManager::SetLightStateNoLock ( LightId id,
const LightState & new_state )

Definition at line 274 of file LightManager.cpp.

References _lights_changes, and RetrieveLightState().

Referenced by ApplyChanges().

◆ TurnOff()

void carla::client::LightManager::TurnOff ( std::vector< Light > & lights)

Definition at line 76 of file LightManager.cpp.

References SetActive().

◆ TurnOn()

void carla::client::LightManager::TurnOn ( std::vector< Light > & lights)

Definition at line 70 of file LightManager.cpp.

References SetActive().

◆ UpdateServerLightsState()

void carla::client::LightManager::UpdateServerLightsState ( bool discard_client = false)
private

Member Data Documentation

◆ _dirty

bool carla::client::LightManager::_dirty = false
private

◆ _episode

detail::WeakEpisodeProxy carla::client::LightManager::_episode
private

◆ _lights

std::unordered_map<LightId, Light> carla::client::LightManager::_lights
private

◆ _lights_changes

std::unordered_map<LightId, LightState> carla::client::LightManager::_lights_changes
private

◆ _lights_state

std::unordered_map<LightId, LightState> carla::client::LightManager::_lights_state
private

◆ _mutex

◆ _on_light_update_register_id

size_t carla::client::LightManager::_on_light_update_register_id = 0
private

Definition at line 109 of file LightManager.h.

Referenced by LightManager(), SetEpisode(), and ~LightManager().

◆ _on_tick_register_id

size_t carla::client::LightManager::_on_tick_register_id = 0
private

Definition at line 108 of file LightManager.h.

Referenced by LightManager(), SetEpisode(), and ~LightManager().

◆ _state

LightState carla::client::LightManager::_state
private

Definition at line 107 of file LightManager.h.

Referenced by RetrieveLightState().


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