CARLA
LibCarla/source/carla/rpc/ActorDescription.h
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 
7 #pragma once
8 
9 #include "carla/MsgPack.h"
11 #include "carla/rpc/ActorId.h"
12 #include "carla/rpc/String.h"
13 
14 #include <vector>
15 
16 #ifdef LIBCARLA_INCLUDED_FROM_UE4
20 #endif // LIBCARLA_INCLUDED_FROM_UE4
21 
22 namespace carla {
23 namespace rpc {
24 
26  public:
27 
28  ActorDescription() = default;
29 
30  ActorId uid = 0u;
31 
32  std::string id;
33 
34  std::vector<ActorAttributeValue> attributes;
35 
36 #ifdef LIBCARLA_INCLUDED_FROM_UE4
37 
38  ActorDescription(const FActorDescription &Description)
39  : uid(Description.UId),
40  id(FromFString(Description.Id)) {
41  attributes.reserve(Description.Variations.Num());
42  for (const auto &Item : Description.Variations) {
43  attributes.emplace_back(Item.Value);
44  }
45  }
46 
47  operator FActorDescription() const {
48  FActorDescription Description;
49  Description.UId = uid;
50  Description.Id = ToFString(id);
51  Description.Variations.Reserve(attributes.size());
52  for (const auto &item : attributes) {
53  Description.Variations.Emplace(ToFString(item.id), item);
54  }
55  return Description;
56  }
57 
58 #endif // LIBCARLA_INCLUDED_FROM_UE4
59 
60  MSGPACK_DEFINE_ARRAY(uid, id, attributes);
61  };
62 
63 } // namespace rpc
64 } // namespace carla
This file contains definitions of common data structures used in traffic manager. ...
Definition: Carla.cpp:133
TMap< FString, FActorAttribute > Variations
User selected variations of the actor.
A description of a Carla Actor with all its variation.
uint32_t ActorId
Definition: ActorId.h:14
MSGPACK_DEFINE_ARRAY(uid, id, attributes)
uint32 UId
UId of the definition in which this description was based.