CARLA
Loading...
Searching...
No Matches
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:

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

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.

◆ ~LightManager()

carla::client::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 337 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, and _lights_state.

◆ GetColor() [1/2]

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

Definition at line 208 of file LightManager.cpp.

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

◆ GetColor() [2/2]

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

Definition at line 137 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 158 of file LightManager.cpp.

References GetIntensity().

Referenced by GetIntensity().

◆ GetLightGroup() [1/2]

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

Definition at line 220 of file LightManager.cpp.

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

◆ GetLightGroup() [2/2]

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

Definition at line 179 of file LightManager.cpp.

References GetLightGroup().

Referenced by GetLightGroup().

◆ GetLightState() [1/2]

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

Definition at line 216 of file LightManager.cpp.

References RetrieveLightState().

◆ GetLightState() [2/2]

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

Definition at line 200 of file LightManager.cpp.

References RetrieveLightState().

◆ 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

Definition at line 224 of file LightManager.cpp.

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

◆ IsActive() [2/2]

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

Definition at line 86 of file LightManager.cpp.

References IsActive().

Referenced by IsActive().

◆ QueryLightsStateToServer()

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

Definition at line 283 of file LightManager.cpp.

References _episode, _lights, _lights_state, and _mutex.

Referenced by SetEpisode().

◆ 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 79 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 124 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 130 of file LightManager.cpp.

References SetColor().

◆ SetDayNightCycle()

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

Definition at line 344 of file LightManager.cpp.

References _episode.

◆ SetEpisode()

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

◆ 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 145 of file LightManager.cpp.

References intensity, and 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 151 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 166 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 172 of file LightManager.cpp.

References SetLightGroup().

◆ SetLightState() [1/3]

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

Definition at line 252 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 187 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 193 of file LightManager.cpp.

References SetLightState().

◆ SetLightStateNoLock()

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

Definition at line 260 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 73 of file LightManager.cpp.

References SetActive().

◆ TurnOn()

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

Definition at line 67 of file LightManager.cpp.

References SetActive().

◆ UpdateServerLightsState()

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

Definition at line 310 of file LightManager.cpp.

References _dirty, _episode, carla::rpc::LightState::_id, _lights, _lights_changes, and _mutex.

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

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

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(), SetEpisode(), and ~LightManager().

◆ _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: