17 namespace traffic_manager {
37 std::lock_guard<std::mutex> lock(modification_mutex);
38 std::vector<ActorPtr> actor_list;
39 for (
auto it = actor_set.begin(); it != actor_set.end(); ++it) {
40 actor_list.push_back(it->second);
47 std::lock_guard<std::mutex> lock(modification_mutex);
48 std::vector<ActorId> actor_list;
49 for (
auto it = actor_set.begin(); it != actor_set.end(); ++it) {
50 actor_list.push_back(it->first);
55 void Insert(std::vector<ActorPtr> actor_list) {
57 std::lock_guard<std::mutex> lock(modification_mutex);
58 for (
auto &actor: actor_list) {
59 actor_set.insert({actor->GetId(), actor});
64 void Remove(std::vector<ActorId> actor_id_list) {
66 std::lock_guard<std::mutex> lock(modification_mutex);
67 for (
auto& actor_id: actor_id_list) {
68 if (actor_set.find(actor_id) != actor_set.end()){
69 actor_set.erase(actor_id);
77 std::lock_guard<std::mutex> lock(modification_mutex);
78 if (actor_set.find(actor_id) != actor_set.end()) {
79 ActorPtr actor = actor_set.at(actor_id);
81 actor_set.erase(actor_id);
88 std::lock_guard<std::mutex> lock(modification_mutex);
94 std::lock_guard<std::mutex> lock(modification_mutex);
95 return actor_set.find(
id) != actor_set.end();
100 std::lock_guard<std::mutex> lock(modification_mutex);
101 return actor_set.size();
106 std::lock_guard<std::mutex> lock(modification_mutex);
107 return actor_set.clear();
carla::SharedPtr< cc::Actor > ActorPtr
boost::shared_ptr< T > SharedPtr
Use this SharedPtr (boost::shared_ptr) to keep compatibility with boost::python, but it would be nice...
This file contains definitions of common data structures used in traffic manager. ...
std::vector< ActorId > GetIDList()
std::map< ActorId, ActorPtr > actor_set
std::vector< ActorPtr > GetList()
void Insert(std::vector< ActorPtr > actor_list)
bool Contains(ActorId id)
void Destroy(ActorId actor_id)
void Remove(std::vector< ActorId > actor_id_list)
std::mutex modification_mutex