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
18 #endif // LIBCARLA_INCLUDED_FROM_UE4
19 
20 namespace carla {
21 namespace rpc {
22 
24  public:
25 
26  ActorDescription() = default;
27 
28  ActorId uid = 0u;
29 
30  std::string id;
31 
32  std::vector<ActorAttributeValue> attributes;
33 
34 #ifdef LIBCARLA_INCLUDED_FROM_UE4
35 
36  ActorDescription(const FActorDescription &Description)
37  : uid(Description.UId),
38  id(FromFString(Description.Id)) {
39  attributes.reserve(Description.Variations.Num());
40  for (const auto &Item : Description.Variations) {
41  attributes.emplace_back(Item.Value);
42  }
43  }
44 
45  operator FActorDescription() const {
46  FActorDescription Description;
47  Description.UId = uid;
48  Description.Id = ToFString(id);
49  Description.Variations.Reserve(attributes.size());
50  for (const auto &item : attributes) {
51  Description.Variations.Emplace(ToFString(item.id), item);
52  }
53  return Description;
54  }
55 
56 #endif // LIBCARLA_INCLUDED_FROM_UE4
57 
58  MSGPACK_DEFINE_ARRAY(uid, id, attributes);
59  };
60 
61 } // namespace rpc
62 } // namespace carla
This file contains definitions of common data structures used in traffic manager. ...
Definition: Carla.cpp:99
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.