CARLA
Loading...
Searching...
No Matches
LibCarla
source
carla
client
ActorList.cpp
Go to the documentation of this file.
1
// Copyright (c) 2026 Computer Vision Center (CVC) at the Universitat Autonoma
2
// de Barcelona (UAB).
3
//
4
// This work is licensed under the terms of the MIT license.
5
// For a copy, see <https://opensource.org/licenses/MIT>.
6
7
#include "
carla/client/ActorList.h
"
8
9
#include "
carla/StringUtil.h
"
10
#include "
carla/client/detail/ActorFactory.h
"
11
12
#include <iterator>
13
14
namespace
carla
{
15
namespace
client {
16
17
ActorList::ActorList(
18
detail::EpisodeProxy
episode,
19
std::vector<rpc::Actor> actors)
20
: _episode(
std
::move(episode)),
21
_actors(
std
::make_move_iterator(actors.begin()),
std
::make_move_iterator(actors.end())) {}
22
23
SharedPtr<Actor>
ActorList::Find(
const
ActorId
actor_id)
const
{
24
for
(
auto
&actor :
_actors
) {
25
if
(actor_id == actor.GetId()) {
26
return
actor.Get(
_episode
);
27
}
28
}
29
return
nullptr
;
30
}
31
32
SharedPtr<ActorList>
ActorList::Filter(
const
std::string &wildcard_pattern)
const
{
33
SharedPtr<ActorList>
filtered (
new
ActorList
(
_episode
, {}));
34
for
(
auto
&&actor :
_actors
) {
35
if
(
StringUtil::Match
(actor.GetTypeId(), wildcard_pattern)) {
36
filtered->_actors.push_back(actor);
37
}
38
}
39
return
filtered;
40
}
41
42
}
// namespace client
43
}
// namespace carla
ActorFactory.h
ActorList.h
StringUtil.h
carla::StringUtil::Match
static bool Match(const char *str, const char *wildcard_pattern)
Match str with the Unix shell-style wildcard_pattern.
Definition
StringUtil.cpp:20
carla::client::ActorList
Definition
ActorList.h:18
carla::client::ActorList::_actors
std::vector< detail::ActorVariant > _actors
Definition
ActorList.h:68
carla::client::ActorList::_episode
detail::EpisodeProxy _episode
Definition
ActorList.h:66
carla::client::detail::EpisodeProxyImpl< EpisodeProxyPointerType::Strong >
carla::traffic_manager::ActorId
carla::ActorId ActorId
Definition
AtomicActorSet.h:21
carla
This file contains definitions of common data structures used in traffic manager.
Definition
SignComponent.h:21
carla::SharedPtr
std::shared_ptr< T > SharedPtr
Definition
Memory.h:15
std
Definition
CarlaRecorderCollision.h:31
Generated by
1.9.8