Rename actor_id_type to ActorId
This commit is contained in:
parent
1378d7c3cf
commit
365eecbb7f
|
@ -20,7 +20,7 @@ namespace client {
|
|||
: _episode(std::move(episode)),
|
||||
_actors(std::make_move_iterator(actors.begin()), std::make_move_iterator(actors.end())) {}
|
||||
|
||||
SharedPtr<Actor> ActorList::Find(actor_id_type const actor_id) const {
|
||||
SharedPtr<Actor> ActorList::Find(const ActorId actor_id) const {
|
||||
for (auto &actor : _actors) {
|
||||
if (actor_id == actor.GetId()) {
|
||||
return actor.Get(_episode, shared_from_this());
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace client {
|
|||
public:
|
||||
|
||||
/// Find an actor by id.
|
||||
SharedPtr<Actor> Find(actor_id_type actor_id) const;
|
||||
SharedPtr<Actor> Find(ActorId actor_id) const;
|
||||
|
||||
/// Filters a list of Actor with type id matching @a wildcard_pattern.
|
||||
ActorList Filter(const std::string &wildcard_pattern) const;
|
||||
|
|
|
@ -50,11 +50,11 @@ namespace detail {
|
|||
return boost::apply_visitor(Visitor(), _value);
|
||||
}
|
||||
|
||||
actor_id_type GetId() const {
|
||||
ActorId GetId() const {
|
||||
return Serialize().id;
|
||||
}
|
||||
|
||||
actor_id_type GetParentId() const {
|
||||
ActorId GetParentId() const {
|
||||
return Serialize().parent_id;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace detail {
|
|||
/// Return the actor ids present in @a range that haven't been added to this
|
||||
/// list.
|
||||
template <typename RangeT>
|
||||
std::vector<actor_id_type> GetMissingIds(const RangeT &range) const;
|
||||
std::vector<ActorId> GetMissingIds(const RangeT &range) const;
|
||||
|
||||
/// Retrieve the actors matching the ids in @a range.
|
||||
template <typename RangeT>
|
||||
|
@ -52,7 +52,7 @@ namespace detail {
|
|||
|
||||
mutable std::mutex _mutex;
|
||||
|
||||
std::unordered_map<actor_id_type, rpc::Actor> _actors;
|
||||
std::unordered_map<ActorId, rpc::Actor> _actors;
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
@ -79,8 +79,8 @@ namespace detail {
|
|||
}
|
||||
|
||||
template <typename RangeT>
|
||||
inline std::vector<actor_id_type> CachedActorList::GetMissingIds(const RangeT &range) const {
|
||||
std::vector<actor_id_type> result;
|
||||
inline std::vector<ActorId> CachedActorList::GetMissingIds(const RangeT &range) const {
|
||||
std::vector<ActorId> result;
|
||||
result.reserve(range.size());
|
||||
std::lock_guard<std::mutex> lock(_mutex);
|
||||
std::copy_if(std::begin(range), std::end(range), std::back_inserter(result), [this](auto id) {
|
||||
|
|
|
@ -165,7 +165,7 @@ namespace detail {
|
|||
}
|
||||
|
||||
std::vector<rpc::Actor> Client::GetActorsById(
|
||||
const std::vector<actor_id_type> &ids) {
|
||||
const std::vector<ActorId> &ids) {
|
||||
using return_t = std::vector<rpc::Actor>;
|
||||
return _pimpl->CallAndWait<return_t>("get_actors_by_id", ids);
|
||||
}
|
||||
|
@ -264,8 +264,8 @@ namespace detail {
|
|||
_pimpl->AsyncCall("add_actor_impulse", actor, vector);
|
||||
}
|
||||
|
||||
std::vector<rpc::actor_id_type> Client::GetGroupTrafficLights(const rpc::Actor &trafficLight) {
|
||||
using return_t = std::vector<rpc::actor_id_type>;
|
||||
std::vector<ActorId> Client::GetGroupTrafficLights(const rpc::Actor &trafficLight) {
|
||||
using return_t = std::vector<ActorId>;
|
||||
return _pimpl->CallAndWait<return_t>("get_group_traffic_lights", trafficLight);
|
||||
}
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ namespace detail {
|
|||
|
||||
void SetWeatherParameters(const rpc::WeatherParameters &weather);
|
||||
|
||||
std::vector<rpc::Actor> GetActorsById(const std::vector<actor_id_type> &ids);
|
||||
std::vector<rpc::Actor> GetActorsById(const std::vector<ActorId> &ids);
|
||||
|
||||
rpc::VehiclePhysicsControl GetVehiclePhysicsControl(const rpc::Actor &actor) const;
|
||||
|
||||
|
@ -180,7 +180,7 @@ namespace detail {
|
|||
std::string ShowRecorderActorsBlocked(std::string name, double min_time, double min_distance);
|
||||
std::string ReplayFile(std::string name, double start, double duration, uint32_t follow_id);
|
||||
|
||||
std::vector<rpc::actor_id_type> GetGroupTrafficLights(const rpc::Actor &trafficLight);
|
||||
std::vector<ActorId> GetGroupTrafficLights(const rpc::Actor &trafficLight);
|
||||
|
||||
void SendTickCue();
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace detail {
|
|||
return _timestamp;
|
||||
}
|
||||
|
||||
ActorState GetActorState(actor_id_type id) const {
|
||||
ActorState GetActorState(ActorId id) const {
|
||||
ActorState state;
|
||||
auto it = _actors.find(id);
|
||||
if (it != _actors.end()) {
|
||||
|
@ -73,7 +73,7 @@ namespace detail {
|
|||
|
||||
const Timestamp _timestamp;
|
||||
|
||||
std::unordered_map<actor_id_type, ActorState> _actors;
|
||||
std::unordered_map<ActorId, ActorState> _actors;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
|
|
@ -326,7 +326,7 @@ namespace detail {
|
|||
_client.FreezeTrafficLight(trafficLight.Serialize(), freeze);
|
||||
}
|
||||
|
||||
std::vector<rpc::actor_id_type> GetGroupTrafficLights(TrafficLight &trafficLight) {
|
||||
std::vector<ActorId> GetGroupTrafficLights(TrafficLight &trafficLight) {
|
||||
return _client.GetGroupTrafficLights(trafficLight.Serialize());
|
||||
}
|
||||
|
||||
|
|
|
@ -22,10 +22,10 @@ namespace rpc {
|
|||
|
||||
Actor() = default;
|
||||
|
||||
actor_id_type id = 0u;
|
||||
ActorId id = 0u;
|
||||
|
||||
/// @todo parent should not be here as it may change during the simulation.
|
||||
actor_id_type parent_id = 0u;
|
||||
ActorId parent_id = 0u;
|
||||
|
||||
ActorDescription description;
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace rpc {
|
|||
|
||||
ActorDefinition() = default;
|
||||
|
||||
actor_id_type uid = 0u;
|
||||
ActorId uid = 0u;
|
||||
|
||||
std::string id;
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace rpc {
|
|||
|
||||
ActorDescription() = default;
|
||||
|
||||
actor_id_type uid = 0u;
|
||||
ActorId uid = 0u;
|
||||
|
||||
std::string id;
|
||||
|
||||
|
|
|
@ -11,10 +11,10 @@
|
|||
namespace carla {
|
||||
namespace rpc {
|
||||
|
||||
using actor_id_type = uint32_t;
|
||||
using ActorId = uint32_t;
|
||||
|
||||
} // namespace rpc
|
||||
|
||||
using actor_id_type = rpc::actor_id_type;
|
||||
using ActorId = rpc::ActorId;
|
||||
|
||||
} // namespace carla
|
||||
|
|
|
@ -61,7 +61,7 @@ namespace detail {
|
|||
float speed_limit;
|
||||
rpc::TrafficLightState traffic_light_state;
|
||||
bool has_traffic_light;
|
||||
rpc::actor_id_type traffic_light_id;
|
||||
rpc::ActorId traffic_light_id;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
|
@ -109,7 +109,7 @@ namespace detail {
|
|||
/// Dynamic state of an actor at a certain frame.
|
||||
struct ActorDynamicState {
|
||||
|
||||
actor_id_type id;
|
||||
ActorId id;
|
||||
|
||||
geom::Transform transform;
|
||||
|
||||
|
|
|
@ -678,7 +678,7 @@ void FTheNewCarlaServer::FPimpl::BindActions()
|
|||
});
|
||||
|
||||
Server.BindSync("get_group_traffic_lights", [this](
|
||||
const cr::Actor Actor) -> R<std::vector<cr::actor_id_type>>
|
||||
const cr::Actor Actor) -> R<std::vector<cr::ActorId>>
|
||||
{
|
||||
REQUIRE_CARLA_EPISODE();
|
||||
auto ActorView = Episode->GetActorRegistry().Find(Actor.id);
|
||||
|
@ -691,7 +691,7 @@ void FTheNewCarlaServer::FPimpl::BindActions()
|
|||
{
|
||||
RESPOND_ERROR("unable to get group traffic lights: actor is not a traffic light");
|
||||
}
|
||||
std::vector<cr::actor_id_type> Result;
|
||||
std::vector<cr::ActorId> Result;
|
||||
for (auto TLight : TrafficLight->GetGroupTrafficLights())
|
||||
{
|
||||
auto View = Episode->FindActor(TLight);
|
||||
|
|
Loading…
Reference in New Issue