28 #ifndef ROSCPP_SUBSCRIBE_OPTIONS_H 29 #define ROSCPP_SUBSCRIBE_OPTIONS_H 51 , allow_concurrent_callbacks(false)
64 SubscribeOptions(
const std::string& _topic, uint32_t _queue_size,
const std::string& _md5sum,
const std::string& _datatype)
66 , queue_size(_queue_size)
70 , allow_concurrent_callbacks(false)
83 const boost::function<
void (P)>& _callback,
88 queue_size = _queue_size;
89 md5sum = message_traits::md5sum<MessageType>();
90 datatype = message_traits::datatype<MessageType>();
91 helper = boost::make_shared<SubscriptionCallbackHelperT<P> >(_callback, factory_fn);
103 void init(
const std::string& _topic, uint32_t _queue_size,
109 queue_size = _queue_size;
110 md5sum = message_traits::md5sum<MessageType>();
111 datatype = message_traits::datatype<MessageType>();
112 helper = boost::make_shared<SubscriptionCallbackHelperT<const boost::shared_ptr<MessageType const>&> >(_callback, factory_fn);
159 ops.
init<M>(topic, queue_size, callback);
void initByFullCallbackType(const std::string &_topic, uint32_t _queue_size, const boost::function< void(P)> &_callback, const boost::function< boost::shared_ptr< typename ParameterAdapter< P >::Message >(void)> &factory_fn=DefaultMessageCreator< typename ParameterAdapter< P >::Message >())
Templated initialization, templated on callback parameter type. Supports any callback parameters supp...
SubscribeOptions(const std::string &_topic, uint32_t _queue_size, const std::string &_md5sum, const std::string &_datatype)
Constructor.
Abstract interface for a queue used to handle all callbacks within roscpp.
Provides a way of specifying network transport hints to ros::NodeHandle::subscribe() and someday ros:...
boost::remove_reference< typename boost::remove_const< M >::type >::type Message
std::string md5sum
MD5 of the message datatype.
SubscriptionCallbackHelperPtr helper
Helper object used to get create messages and call callbacks.
Encapsulates all options available for creating a Subscriber.
uint32_t queue_size
Number of incoming messages to queue up for processing (messages in excess of this queue capacity wil...
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)
Templated helper function for creating an AdvertiseServiceOptions with most of its options...
TransportHints transport_hints
Hints for transport type and options.
std::string datatype
Datatype of the message we'd like to subscribe as.
void init(const std::string &_topic, uint32_t _queue_size, const boost::function< void(const boost::shared_ptr< M const > &)> &_callback, const boost::function< boost::shared_ptr< M >(void)> &factory_fn=DefaultMessageCreator< M >())
Templated initialization, templated on message type. Only supports "const boost::shared_ptr<M const>&...
VoidConstPtr tracked_object
An object whose destruction will prevent the callback associated with this subscription.
std::string topic
Topic to subscribe to.
bool allow_concurrent_callbacks
CallbackQueueInterface * callback_queue
Queue to add callbacks to. If NULL, the global callback queue will be used.