00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef ROSCPP_ADVERTISE_OPTIONS_H
00029 #define ROSCPP_ADVERTISE_OPTIONS_H
00030
00031 #include "ros/forwards.h"
00032 #include "ros/message_traits.h"
00033
00034 namespace ros
00035 {
00036
00040 struct AdvertiseOptions
00041 {
00042 AdvertiseOptions()
00043 : callback_queue(0)
00044 , latch(false)
00045 {
00046 }
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057 AdvertiseOptions(const std::string& _topic, uint32_t _queue_size, const std::string& _md5sum,
00058 const std::string& _datatype, const std::string& _message_definition,
00059 const SubscriberStatusCallback& _connect_cb = SubscriberStatusCallback(),
00060 const SubscriberStatusCallback& _disconnect_cb = SubscriberStatusCallback())
00061 : topic(_topic)
00062 , queue_size(_queue_size)
00063 , md5sum(_md5sum)
00064 , datatype(_datatype)
00065 , message_definition(_message_definition)
00066 , connect_cb(_connect_cb)
00067 , disconnect_cb(_disconnect_cb)
00068 , callback_queue(0)
00069 , latch(false)
00070 , has_header(false)
00071 {}
00072
00082 template <class M>
00083 void init(const std::string& _topic, uint32_t _queue_size,
00084 const SubscriberStatusCallback& _connect_cb = SubscriberStatusCallback(),
00085 const SubscriberStatusCallback& _disconnect_cb = SubscriberStatusCallback())
00086 {
00087 topic = _topic;
00088 queue_size = _queue_size;
00089 connect_cb = _connect_cb;
00090 disconnect_cb = _disconnect_cb;
00091 md5sum = message_traits::md5sum<M>();
00092 datatype = message_traits::datatype<M>();
00093 message_definition = message_traits::definition<M>();
00094 has_header = message_traits::hasHeader<M>();
00095 }
00096
00097 std::string topic;
00098 uint32_t queue_size;
00099
00100 std::string md5sum;
00101 std::string datatype;
00102 std::string message_definition;
00103
00104 SubscriberStatusCallback connect_cb;
00105 SubscriberStatusCallback disconnect_cb;
00106
00107 CallbackQueueInterface* callback_queue;
00108
00119 VoidConstPtr tracked_object;
00120
00125 bool latch;
00126
00130 bool has_header;
00131
00132
00146 template<class M>
00147 static AdvertiseOptions create(const std::string& topic, uint32_t queue_size,
00148 const SubscriberStatusCallback& connect_cb,
00149 const SubscriberStatusCallback& disconnect_cb,
00150 const VoidConstPtr& tracked_object,
00151 CallbackQueueInterface* queue)
00152 {
00153 AdvertiseOptions ops;
00154 ops.init<M>(topic, queue_size, connect_cb, disconnect_cb);
00155 ops.tracked_object = tracked_object;
00156 ops.callback_queue = queue;
00157 return ops;
00158 }
00159 };
00160
00161
00162 }
00163
00164 #endif