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

#include <LightManager.h>

+ Inheritance diagram for carla::client::LightManager:
+ Collaboration diagram for carla::client::LightManager:

Public Member Functions

std::vector< LightGetAllLights (LightGroup type=LightGroup::None) const
 
std::vector< ColorGetColor (std::vector< Light > &lights) const
 
Color GetColor (LightId id) const
 
std::vector< float > GetIntensity (std::vector< Light > &lights) const
 
float GetIntensity (LightId id) const
 
std::vector< LightGroupGetLightGroup (std::vector< Light > &lights) const
 
LightGroup GetLightGroup (LightId id) const
 
std::vector< LightStateGetLightState (std::vector< Light > &lights) const
 
LightState GetLightState (LightId id) const
 
std::vector< LightGetTurnedOffLights (LightGroup type=LightGroup::None) const
 
std::vector< LightGetTurnedOnLights (LightGroup type=LightGroup::None) const
 
std::vector< bool > IsActive (std::vector< Light > &lights) const
 
bool IsActive (LightId id) const
 
 LightManager ()
 
 LightManager (const LightManager &other)
 
void SetActive (std::vector< Light > &lights, std::vector< bool > &active)
 
void SetActive (LightId id, bool active)
 
void SetColor (std::vector< Light > &lights, Color color)
 
void SetColor (std::vector< Light > &lights, std::vector< Color > &colors)
 
void SetColor (LightId id, Color color)
 
void SetDayNightCycle (const bool active)
 
void SetEpisode (detail::EpisodeProxy episode)
 
void SetIntensity (std::vector< Light > &lights, float intensity)
 
void SetIntensity (std::vector< Light > &lights, std::vector< float > &intensities)
 
void SetIntensity (LightId id, float intensity)
 
void SetLightGroup (std::vector< Light > &lights, LightGroup group)
 
void SetLightGroup (std::vector< Light > &lights, std::vector< LightGroup > &groups)
 
void SetLightGroup (LightId id, LightGroup group)
 
void SetLightState (std::vector< Light > &lights, LightState state)
 
void SetLightState (std::vector< Light > &lights, std::vector< LightState > &states)
 
void SetLightState (LightId id, const LightState &new_state)
 
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 LightStateRetrieveLightState (LightId id) const
 
void UpdateServerLightsState (bool discard_client=false)
 

Private Attributes

bool _dirty = false
 
detail::EpisodeProxy _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

Definition at line 28 of file LightManager.h.

Constructor & Destructor Documentation

◆ LightManager() [1/2]

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

Definition at line 32 of file LightManager.h.

References ~LightManager().

+ Here is the call graph for this function:

◆ ~LightManager()

carla::client::LightManager::~LightManager ( )

Definition at line 17 of file LightManager.cpp.

References _episode, _on_light_update_register_id, carla::client::detail::EpisodeProxyImpl< PointerT >::IsValid(), carla::client::detail::EpisodeProxyImpl< PointerT >::Lock(), and UpdateServerLightsState().

Referenced by LightManager().

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

◆ LightManager() [2/2]

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

Member Function Documentation

◆ ApplyChanges()

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

Definition at line 323 of file LightManager.cpp.

References _lights_changes, _mutex, and SetLightStateNoLock().

Referenced by LightManager(), and SetEpisode().

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

◆ GetAllLights()

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

Definition at line 43 of file LightManager.cpp.

References _lights, _lights_state, and carla::rpc::LightState::None.

Referenced by LightManager().

+ Here is the caller graph for this function:

◆ GetColor() [1/2]

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

Definition at line 127 of file LightManager.cpp.

Referenced by LightManager().

+ Here is the caller graph for this function:

◆ GetColor() [2/2]

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

Definition at line 198 of file LightManager.cpp.

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

+ Here is the call graph for this function:

◆ GetIntensity() [1/2]

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

Definition at line 148 of file LightManager.cpp.

Referenced by LightManager().

+ Here is the caller graph for this function:

◆ GetIntensity() [2/2]

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

Definition at line 202 of file LightManager.cpp.

References carla::client::LightState::_intensity, and RetrieveLightState().

+ Here is the call graph for this function:

◆ GetLightGroup() [1/2]

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

Definition at line 169 of file LightManager.cpp.

Referenced by LightManager().

+ Here is the caller graph for this function:

◆ GetLightGroup() [2/2]

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

Definition at line 210 of file LightManager.cpp.

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

+ Here is the call graph for this function:

◆ GetLightState() [1/2]

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

Definition at line 190 of file LightManager.cpp.

References RetrieveLightState().

Referenced by LightManager().

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

◆ GetLightState() [2/2]

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

Definition at line 206 of file LightManager.cpp.

References RetrieveLightState().

+ Here is the call graph for this function:

◆ GetTurnedOffLights()

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

Definition at line 99 of file LightManager.cpp.

References carla::client::LightState::_active, carla::client::LightState::_group, _lights, _lights_state, and carla::rpc::LightState::None.

Referenced by LightManager().

+ Here is the caller graph for this function:

◆ GetTurnedOnLights()

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

Definition at line 84 of file LightManager.cpp.

References carla::client::LightState::_active, carla::client::LightState::_group, _lights, _lights_state, and carla::rpc::LightState::None.

Referenced by LightManager().

+ Here is the caller graph for this function:

◆ IsActive() [1/2]

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

Definition at line 76 of file LightManager.cpp.

Referenced by LightManager().

+ Here is the caller graph for this function:

◆ IsActive() [2/2]

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

Definition at line 214 of file LightManager.cpp.

References carla::client::LightState::_active, and RetrieveLightState().

+ Here is the call graph for this function:

◆ QueryLightsStateToServer()

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

Definition at line 273 of file LightManager.cpp.

References _episode, _lights, _lights_state, _mutex, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

Referenced by LightManager(), and SetEpisode().

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

◆ RetrieveLightState()

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

Definition at line 264 of file LightManager.cpp.

References _lights_state, _state, and carla::log_warning().

Referenced by GetColor(), GetIntensity(), GetLightGroup(), GetLightState(), IsActive(), LightManager(), SetActive(), SetColor(), SetIntensity(), SetLightGroup(), SetLightState(), and SetLightStateNoLock().

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

◆ SetActive() [1/2]

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

Definition at line 69 of file LightManager.cpp.

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

+ Here is the caller graph for this function:

◆ SetActive() [2/2]

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

Definition at line 218 of file LightManager.cpp.

References carla::client::LightState::_active, _dirty, _lights_changes, _mutex, and RetrieveLightState().

+ Here is the call graph for this function:

◆ SetColor() [1/3]

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

Definition at line 114 of file LightManager.cpp.

Referenced by LightManager(), and SetColor().

+ Here is the caller graph for this function:

◆ SetColor() [2/3]

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

Definition at line 120 of file LightManager.cpp.

References SetColor().

+ Here is the call graph for this function:

◆ SetColor() [3/3]

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

Definition at line 226 of file LightManager.cpp.

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

+ Here is the call graph for this function:

◆ SetDayNightCycle()

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

Definition at line 330 of file LightManager.cpp.

References _episode, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

Referenced by LightManager().

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

◆ SetEpisode()

void carla::client::LightManager::SetEpisode ( detail::EpisodeProxy  episode)

Definition at line 25 of file LightManager.cpp.

References _episode, _on_light_update_register_id, _on_tick_register_id, ApplyChanges(), carla::client::detail::EpisodeProxyImpl< PointerT >::Lock(), QueryLightsStateToServer(), and UpdateServerLightsState().

Referenced by LightManager().

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

◆ SetIntensity() [1/3]

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

Definition at line 135 of file LightManager.cpp.

Referenced by LightManager(), and SetIntensity().

+ Here is the caller graph for this function:

◆ SetIntensity() [2/3]

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

Definition at line 141 of file LightManager.cpp.

References SetIntensity().

+ Here is the call graph for this function:

◆ SetIntensity() [3/3]

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

Definition at line 234 of file LightManager.cpp.

References _dirty, carla::client::LightState::_intensity, _lights_changes, _mutex, and RetrieveLightState().

+ Here is the call graph for this function:

◆ SetLightGroup() [1/3]

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

Definition at line 156 of file LightManager.cpp.

Referenced by LightManager(), and SetLightGroup().

+ Here is the caller graph for this function:

◆ SetLightGroup() [2/3]

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

Definition at line 162 of file LightManager.cpp.

References SetLightGroup().

+ Here is the call graph for this function:

◆ SetLightGroup() [3/3]

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

Definition at line 256 of file LightManager.cpp.

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

+ Here is the call graph for this function:

◆ SetLightState() [1/3]

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

Definition at line 177 of file LightManager.cpp.

Referenced by LightManager(), and SetLightState().

+ Here is the caller graph for this function:

◆ SetLightState() [2/3]

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

Definition at line 183 of file LightManager.cpp.

References SetLightState().

+ Here is the call graph for this function:

◆ SetLightState() [3/3]

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

Definition at line 242 of file LightManager.cpp.

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

+ Here is the call graph for this function:

◆ SetLightStateNoLock()

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

Definition at line 250 of file LightManager.cpp.

References _lights_changes, and RetrieveLightState().

Referenced by ApplyChanges(), and LightManager().

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

◆ TurnOff()

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

Definition at line 63 of file LightManager.cpp.

References SetActive().

Referenced by LightManager().

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

◆ TurnOn()

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

Definition at line 57 of file LightManager.cpp.

References SetActive().

Referenced by LightManager().

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

◆ UpdateServerLightsState()

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

Definition at line 296 of file LightManager.cpp.

References _dirty, _episode, carla::rpc::LightState::_id, _lights, _lights_changes, _mutex, and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

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

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

Member Data Documentation

◆ _dirty

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

◆ _episode

detail::EpisodeProxy 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

std::mutex carla::client::LightManager::_mutex
private

◆ _on_light_update_register_id

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

Definition at line 108 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 107 of file LightManager.h.

Referenced by LightManager(), and SetEpisode().

◆ _state

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

Definition at line 106 of file LightManager.h.

Referenced by RetrieveLightState().


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