advertise_options.h
Go to the documentation of this file.
1 #include "sick_scan/sick_scan_base.h" /* Base definitions included in all header files, added by add_sick_scan_base_header.py. Do not edit this line. */
2 /*
3  * Copyright (C) 2009, Willow Garage, Inc.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * * Redistributions of source code must retain the above copyright notice,
8  * this list of conditions and the following disclaimer.
9  * * Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * * Neither the names of Stanford University or Willow Garage, Inc. nor the names of its
13  * contributors may be used to endorse or promote products derived from
14  * this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
20  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26  * POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #ifndef ROSCPP_ADVERTISE_OPTIONS_H
30 #define ROSCPP_ADVERTISE_OPTIONS_H
31 
32 #include "ros/forwards.h"
33 #include "ros/message_traits.h"
34 #include "common.h"
35 
36 namespace roswrap
37 {
38 
43 {
45  : callback_queue(0)
46  , latch(false)
47  {
48  }
49 
50  /*
51  * \brief Constructor
52  * \param _topic Topic to publish on
53  * \param _queue_size Maximum number of outgoing messages to be queued for delivery to subscribers
54  * \param _md5sum The md5sum of the message datatype published on this topic
55  * \param _datatype Datatype of the message published on this topic (eg. "std_msgs/String")
56  * \param _connect_cb Function to call when a subscriber connects to this topic
57  * \param _disconnect_cb Function to call when a subscriber disconnects from this topic
58  */
59  AdvertiseOptions(const std::string& _topic, uint32_t _queue_size, const std::string& _md5sum,
60  const std::string& _datatype, const std::string& _message_definition,
62  const SubscriberStatusCallback& _disconnect_cb = SubscriberStatusCallback())
63  : topic(_topic)
64  , queue_size(_queue_size)
65  , md5sum(_md5sum)
66  , datatype(_datatype)
67  , message_definition(_message_definition)
68  , connect_cb(_connect_cb)
69  , disconnect_cb(_disconnect_cb)
70  , callback_queue(0)
71  , latch(false)
72  , has_header(false)
73  {}
74 
84  template <class M>
85  void init(const std::string& _topic, uint32_t _queue_size,
87  const SubscriberStatusCallback& _disconnect_cb = SubscriberStatusCallback())
88  {
89  topic = _topic;
90  queue_size = _queue_size;
91  connect_cb = _connect_cb;
92  disconnect_cb = _disconnect_cb;
93  md5sum = message_traits::md5sum<M>();
94  datatype = message_traits::datatype<M>();
95  message_definition = message_traits::definition<M>();
96  has_header = message_traits::hasHeader<M>();
97  }
98 
99  std::string topic;
100  uint32_t queue_size;
101 
102  std::string md5sum;
103  std::string datatype;
104  std::string message_definition;
105 
108 
110 
122 
127  bool latch;
128 
133 
134 
148  template<class M>
149  static AdvertiseOptions create(const std::string& topic, uint32_t queue_size,
150  const SubscriberStatusCallback& connect_cb,
151  const SubscriberStatusCallback& disconnect_cb,
152  const VoidConstPtr& tracked_object,
153  CallbackQueueInterface* queue)
154  {
155  AdvertiseOptions ops;
156  ops.init<M>(topic, queue_size, connect_cb, disconnect_cb);
157  ops.tracked_object = tracked_object;
158  ops.callback_queue = queue;
159  return ops;
160  }
161 };
162 
163 
164 }
165 
166 #endif
roswrap::message_traits::md5sum
const char * md5sum()
returns MD5Sum<M>::value();
Definition: message_traits.h:227
roswrap::message_traits::datatype
const char * datatype()
returns DataType<M>::value();
Definition: message_traits.h:236
roswrap::AdvertiseOptions::disconnect_cb
SubscriberStatusCallback disconnect_cb
The function to call when a subscriber disconnects from this topic.
Definition: advertise_options.h:107
roswrap::AdvertiseOptions
Encapsulates all options available for creating a Publisher.
Definition: advertise_options.h:42
roswrap::AdvertiseOptions::AdvertiseOptions
AdvertiseOptions(const std::string &_topic, uint32_t _queue_size, const std::string &_md5sum, const std::string &_datatype, const std::string &_message_definition, const SubscriberStatusCallback &_connect_cb=SubscriberStatusCallback(), const SubscriberStatusCallback &_disconnect_cb=SubscriberStatusCallback())
Definition: advertise_options.h:59
roswrap::AdvertiseOptions::has_header
bool has_header
Tells whether or not the message has a header. If it does, the sequence number will be written direct...
Definition: advertise_options.h:132
roswrap::AdvertiseOptions::latch
bool latch
Whether or not this publication should "latch". A latching publication will automatically send out th...
Definition: advertise_options.h:127
roswrap::AdvertiseOptions::tracked_object
VoidConstPtr tracked_object
An object whose destruction will prevent the callbacks associated with this advertisement from being ...
Definition: advertise_options.h:121
sick_scan_xd_api_test.queue_size
queue_size
Definition: sick_scan_xd_api_test.py:353
roswrap::AdvertiseOptions::connect_cb
SubscriberStatusCallback connect_cb
The function to call when a subscriber connects to this topic.
Definition: advertise_options.h:106
roswrap::CallbackQueueInterface
Abstract interface for a queue used to handle all callbacks within roscpp.
Definition: callback_queue_interface.h:83
roswrap
Definition: param_modi.cpp:41
roswrap::AdvertiseOptions::message_definition
std::string message_definition
The full definition of the message published on this topic.
Definition: advertise_options.h:104
roswrap::AdvertiseOptions::md5sum
std::string md5sum
The md5sum of the message datatype published on this topic.
Definition: advertise_options.h:102
roswrap::AdvertiseOptions::AdvertiseOptions
AdvertiseOptions()
Definition: advertise_options.h:44
common.h
roswrap::AdvertiseOptions::queue_size
uint32_t queue_size
The maximum number of outgoing messages to be queued for delivery to subscribers.
Definition: advertise_options.h:100
roswrap::AdvertiseOptions::init
void init(const std::string &_topic, uint32_t _queue_size, const SubscriberStatusCallback &_connect_cb=SubscriberStatusCallback(), const SubscriberStatusCallback &_disconnect_cb=SubscriberStatusCallback())
templated helper function for automatically filling out md5sum, datatype and message definition
Definition: advertise_options.h:85
sick_scan_base.h
roswrap::AdvertiseOptions::topic
std::string topic
The topic to publish on.
Definition: advertise_options.h:99
roswrap::AdvertiseOptions::create
static AdvertiseOptions create(const std::string &topic, uint32_t queue_size, const SubscriberStatusCallback &connect_cb, const SubscriberStatusCallback &disconnect_cb, const VoidConstPtr &tracked_object, CallbackQueueInterface *queue)
Templated helper function for creating an AdvertiseOptions for a message type with most options.
Definition: advertise_options.h:149
ROSCPP_DECL
#define ROSCPP_DECL
Definition: roswrap/src/cfgsimu/sick_scan/ros/common.h:63
roswrap::SubscriberStatusCallback
std::function< void(const SingleSubscriberPublisher &)> SubscriberStatusCallback
Definition: forwards.h:96
roswrap::AdvertiseOptions::callback_queue
CallbackQueueInterface * callback_queue
Queue to add callbacks to. If NULL, the global callback queue will be used.
Definition: advertise_options.h:109
roswrap::VoidConstPtr
std::shared_ptr< void const > VoidConstPtr
Definition: forwards.h:54
roswrap::AdvertiseOptions::datatype
std::string datatype
The datatype of the message published on this topic (eg. "std_msgs/String")
Definition: advertise_options.h:103


sick_scan_xd
Author(s): Michael Lehning , Jochen Sprickerhof , Martin Günther
autogenerated on Fri Oct 25 2024 02:47:07