Fix Boost.Python not getting the right signature

This commit is contained in:
nsubiron 2018-10-07 16:29:27 +02:00
parent d56c17a166
commit 91aa984350
3 changed files with 12 additions and 15 deletions

View File

@ -15,7 +15,7 @@ namespace client {
class Actor
: public EnableSharedFromThis<Actor>,
private detail::ActorState {
public detail::ActorState {
using Super = detail::ActorState;
public:
@ -23,10 +23,6 @@ namespace client {
virtual ~Actor() = default;
using Super::GetId;
using Super::GetTypeId;
using Super::GetDisplayId;
using Super::GetWorld;
geom::Location GetLocation() const;
@ -48,8 +44,6 @@ namespace client {
protected:
using Super::GetActorDescription;
auto GetClientImplementation() const {
return GetWorld().parent;
}

View File

@ -29,14 +29,16 @@ namespace detail {
std::string GetDisplayId() const;
const rpc::Actor &GetActorDescription() const {
return _description;
}
World GetWorld() const {
return _parent;
}
protected:
const rpc::Actor &GetActorDescription() const {
return _description;
}
private:
ActorState(rpc::Actor description, World parent)

View File

@ -27,10 +27,11 @@ void export_actor() {
namespace cr = carla::rpc;
class_<cc::Actor, boost::noncopyable, boost::shared_ptr<cc::Actor>>("Actor", no_init)
.add_property("id", &cc::Actor::GetId)
.add_property("type_id", +[](const cc::Actor &self) -> std::string { return self.GetTypeId(); })
.add_property("is_alive", &cc::Actor::IsAlive)
.def("get_world", &cc::Actor::GetWorld)
// work-around, force return copy to resolve Actor instead of ActorState.
.add_property("id", CALL_RETURNING_COPY(cc::Actor, GetId))
.add_property("type_id", CALL_RETURNING_COPY(cc::Actor, GetTypeId))
.add_property("is_alive", CALL_RETURNING_COPY(cc::Actor, IsAlive))
.def("get_world", CALL_RETURNING_COPY(cc::Actor, GetWorld))
.def("get_location", CONST_CALL_WITHOUT_GIL(cc::Actor, GetLocation))
.def("get_transform", CONST_CALL_WITHOUT_GIL(cc::Actor, GetTransform))
.def("set_location", &cc::Actor::SetLocation, (arg("location")))