subscriber_base.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 
21 #ifndef INCLUDE_FKIE_MESSAGE_FILTERS_SUBSCRIBER_BASE_H_
22 #define INCLUDE_FKIE_MESSAGE_FILTERS_SUBSCRIBER_BASE_H_
23 
24 #include <boost/signals2.hpp>
25 
26 namespace fkie_message_filters
27 {
28 
29 class PublisherBase;
30 
39 {
40  friend class PublisherBase;
41 public:
42  virtual ~SubscriberBase();
50  virtual void subscribe();
59  virtual void unsubscribe();
70  virtual void subscribe_on_demand(PublisherBase& pub);
75  virtual std::string topic() const = 0;
76 protected:
86  virtual bool is_configured() const = 0;
94  virtual void subscribe_impl() = 0;
102  virtual void unsubscribe_impl() = 0;
120  void unlink_from_publisher();
121 private:
122  boost::signals2::connection conn1_, conn2_;
123 };
124 
125 } // namespace fkie_message_filters
126 
127 #endif /* INCLUDE_FKIE_MESSAGE_FILTERS_SUBSCRIBER_BASE_H_ */
virtual bool is_configured() const =0
Check if the subscriber is properly configured.
virtual std::string topic() const =0
Return the subscribed topic name.
Base class for ROS publishers in a filter pipeline.
virtual void subscribe_on_demand(PublisherBase &pub)
Subscribe to the configured ROS topic whenever the given publisher is active.
virtual void subscribe()
Subscribe to the configured ROS topic.
Base class for ROS subscribers in a filter pipeline.
Primary namespace.
Definition: buffer.h:33
void link_with_publisher(PublisherBase &pub)
Add self to the list of subscribers which are controlled by a publisher.
virtual void unsubscribe()
Unsubscribe from the configured ROS topic.
void unlink_from_publisher()
Remove self from the list of subscribers which are controlled by a publisher.
virtual void unsubscribe_impl()=0
Implement how to unsubscribe from the configured ROS topic.
virtual void subscribe_impl()=0
Implement how to subscribe to the configured ROS topic.
boost::signals2::connection conn1_
boost::signals2::connection conn2_


fkie_message_filters
Author(s): Timo Röhling
autogenerated on Mon Feb 28 2022 22:21:43