diff options
author | Thomas Gubler <thomasgubler@gmail.com> | 2015-01-21 16:33:19 +0100 |
---|---|---|
committer | Thomas Gubler <thomasgubler@gmail.com> | 2015-01-21 16:33:19 +0100 |
commit | 1511fd7b2dd19e0ae4c63553cbaf00e2a753148f (patch) | |
tree | 805c055f2aea86d3ca550a7bf33e5396d3c893e5 /src/platforms/px4_nodehandle.h | |
parent | 52a2a23cc77cff300d0c73f66a450fc1a8fccd5a (diff) | |
download | px4-firmware-1511fd7b2dd19e0ae4c63553cbaf00e2a753148f.tar.gz px4-firmware-1511fd7b2dd19e0ae4c63553cbaf00e2a753148f.tar.bz2 px4-firmware-1511fd7b2dd19e0ae4c63553cbaf00e2a753148f.zip |
make handle() static
Diffstat (limited to 'src/platforms/px4_nodehandle.h')
-rw-r--r-- | src/platforms/px4_nodehandle.h | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/platforms/px4_nodehandle.h b/src/platforms/px4_nodehandle.h index 2406a4a77..5ae4f9325 100644 --- a/src/platforms/px4_nodehandle.h +++ b/src/platforms/px4_nodehandle.h @@ -93,7 +93,7 @@ public: Subscriber<T> *subscribe(void(*fp)(const T &)) { SubscriberBase *sub = new SubscriberROS<T>(std::bind(fp, std::placeholders::_1)); - ros::Subscriber ros_sub = ros::NodeHandle::subscribe((new T())->handle(), kQueueSizeDefault, + ros::Subscriber ros_sub = ros::NodeHandle::subscribe(T::handle(), kQueueSizeDefault, &SubscriberROS<T>::callback, (SubscriberROS<T> *)sub); ((SubscriberROS<T> *)sub)->set_ros_sub(ros_sub); _subs.push_back(sub); @@ -147,7 +147,7 @@ public: Publisher* advertise() // Publisher<T> *advertise() { - ros::Publisher ros_pub = ros::NodeHandle::advertise<typename std::remove_reference<decltype(((T*)nullptr)->data())>::type &>((new T())->handle(), kQueueSizeDefault); + ros::Publisher ros_pub = ros::NodeHandle::advertise<typename std::remove_reference<decltype(((T*)nullptr)->data())>::type &>(T::handle(), kQueueSizeDefault); Publisher *pub = new Publisher(ros_pub); _pubs.push_back(pub); return pub; @@ -245,8 +245,7 @@ public: // Subscriber<T> *subscribe(void(*fp)(const typename std::remove_reference<decltype(((T*)nullptr)->data())>::type &), unsigned interval=10) //XXX interval Subscriber<T> *subscribe(void(*fp)(const T &), unsigned interval=10) //XXX interval { - const struct orb_metadata * meta = NULL; - uORB::SubscriptionBase * uorb_sub = new uORB::SubscriptionBase(meta, interval); + uORB::SubscriptionBase * uorb_sub = new uORB::SubscriptionBase(T::handle(), interval); // SubscriberUORBCallback<T> *sub_px4 = new SubscriberUORBCallback<T>(uorb_sub, interval, callback); SubscriberUORBCallback<T> *sub_px4 = new SubscriberUORBCallback<T>(uorb_sub, interval, std::bind(fp, std::placeholders::_1)); @@ -300,8 +299,7 @@ public: { //XXX // uORB::PublicationBase * uorb_pub = new uORB::PublicationBase((new T())->handle()); - const struct orb_metadata * meta = NULL; - uORB::PublicationBase * uorb_pub = new uORB::PublicationBase(meta); + uORB::PublicationBase * uorb_pub = new uORB::PublicationBase(T::handle()); Publisher *pub = new Publisher(uorb_pub); _pubs.add(pub); |