ros::SubscribeOptions::create doesn't take object T* Obj pointer.
Hi,
SubscribeOptions::create function doesn't support setting class member function as callback function? I cannot see the argument option in its signature.
template<class M >
static SubscribeOptions create (const std::string &topic, uint32_t queue_size, const boost::function< void(const boost::shared_ptr< M const > &)> &callback, const VoidConstPtr &tracked_object, CallbackQueueInterface *queue)
Like subscribe does below. Is it possible to add a class member function as callback function to the SubscribeOptions?
Subscriber subscribe(const std::string& topic, uint32_t queue_size,
void(T::*fp)(const boost::shared_ptr<M const>&) const, T* obj,
const TransportHints& transport_hints = TransportHints())
Can you show us how you've tried to use this?
Using member functions should be/is definitely supported, so perhaps you're not providing the correct arguments to the function.
@gvdhoorn, I have not tried to use the function yet but from the interface to create SubscribeOptions like pasted in question, I cannot see the possibility to give a pointer to the instance. That's why I assumed it is not supported. Shall I use boost::bind?
Ah, wait. I'd missed you were trying to use
SubscribeOptions
. Thecreate(..)
function does seem to only take the "simple" type of callbacks, but perhaps theinitByFullCallbackType(..)
function can help there.I've not used this myself, so I don't know whether it will work, but ..
.. the docs say (from here):
@gvdhoorn. Hmm I cannot find the definition of SubscriptionCallbackAdapter..
It's in
subscription_callback_helper.h
. Docs here. But again: I don't know whether this will work.Did someone solve this?