image_publisher.h
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * fkie_message_filters
4  * Copyright © 2018-2020 Fraunhofer FKIE
5  * Author: Timo Röhling
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  ****************************************************************************/
20 #ifndef INCLUDE_FKIE_MESSAGE_FILTERS_IMAGE_PUBLISHER_H_
21 #define INCLUDE_FKIE_MESSAGE_FILTERS_IMAGE_PUBLISHER_H_
22 
23 #include "publisher_base.h"
24 #include "sink.h"
25 #include <sensor_msgs/Image.h>
27 
28 namespace fkie_message_filters
29 {
30 
42 class ImagePublisher : public PublisherBase, public Sink<sensor_msgs::ImageConstPtr>
43 {
44 public:
51  ImagePublisher() noexcept {}
58  ImagePublisher (const image_transport::ImageTransport& it, const std::string& base_topic, uint32_t queue_size, bool latch = false) noexcept;
63  virtual bool is_active() const noexcept override;
68  virtual std::string topic() const noexcept override;
81  void advertise (const image_transport::ImageTransport& it, const std::string& base_topic, uint32_t queue_size, bool latch = false) noexcept;
97  void advertise (const image_transport::ImageTransport& it, const std::string& base_topic, uint32_t queue_size, const image_transport::SubscriberStatusCallback& connect_cb, const image_transport::SubscriberStatusCallback& disconnect_cb = image_transport::SubscriberStatusCallback(), const ros::VoidPtr& tracked_object = ros::VoidPtr(), bool latch = false) noexcept;
98 
99 protected:
101  void receive (const sensor_msgs::ImageConstPtr&) noexcept override;
102 private:
103  std::shared_ptr<image_transport::ImageTransport> it_;
105 };
106 
107 } // namespace fkie_message_filters
108 
109 #endif /* INCLUDE_FKIE_MESSAGE_FILTERS_IMAGE_PUBLISHER_H_ */
std::shared_ptr< image_transport::ImageTransport > it_
Base class for data consumers.
Definition: sink.h:46
Publish consumed data to a ROS image topic.
Base class for ROS publishers in a filter pipeline.
boost::function< void(const SingleSubscriberPublisher &)> SubscriberStatusCallback
ImagePublisher() noexcept
Constructs an empty publisher.
Primary namespace.
Definition: buffer.h:33
virtual bool is_active() const noexcept override
Check if the ROS publisher has at least one subscriber.
virtual std::string topic() const noexcept override
Return the configured ROS topic.
void advertise(const image_transport::ImageTransport &it, const std::string &base_topic, uint32_t queue_size, bool latch=false) noexcept
Advertise ROS image topic.
void receive(const sensor_msgs::ImageConstPtr &) noexcept override
image_transport::Publisher pub_


fkie_message_filters
Author(s): Timo Röhling
autogenerated on Sun Sep 12 2021 02:52:12