CARLA
ActorState.cpp
Go to the documentation of this file.
1 // Copyright (c) 2017 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 
8 
9 #include <string>
10 #include <iterator>
11 
12 namespace carla {
13 namespace client {
14 namespace detail {
15 
17  rpc::Actor description,
18  EpisodeProxy episode)
19  : _description(std::move(description)),
20  _episode(std::move(episode)),
21  _display_id([](const auto &desc) {
22  using namespace std::string_literals;
23  return
24  "Actor "s +
25  std::to_string(desc.id) +
26  " (" + desc.description.id + ')';
27  }(_description)),
28  _attributes(_description.description.attributes.begin(), _description.description.attributes.end())
29  {}
30 
31  SharedPtr<Actor> ActorState::GetParent() const {
32  auto parent_id = GetParentId();
33  return parent_id != 0u ? GetWorld().GetActor(parent_id) : nullptr;
34  }
35 
36 } // namespace detail
37 } // namespace client
38 } // namespace carla
boost::shared_ptr< T > SharedPtr
Use this SharedPtr (boost::shared_ptr) to keep compatibility with boost::python, but it would be nice...
Definition: Memory.h:20
This file contains definitions of common data structures used in traffic manager. ...
Definition: Carla.cpp:133
carla::SharedPtr< cc::Actor > Actor
_attributes(_description.description.attributes.begin(), _description.description.attributes.end())
Definition: ActorState.cpp:28
ActorState(rpc::Actor description, EpisodeProxy episode)
EpisodeProxyImpl< EpisodeProxyPointerType::Strong > EpisodeProxy
Definition: EpisodeProxy.h:69