Subscriber.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright (C) 2014 by Ralf Kaestner *
3  * ralf.kaestner@gmail.com *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the Lesser GNU General Public License as published by*
7  * the Free Software Foundation; either version 3 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * Lesser GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the Lesser GNU General Public License *
16  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
17  ******************************************************************************/
18 
23 #ifndef VARIANT_TOPIC_TOOLS_SUBSCRIBER_H
24 #define VARIANT_TOPIC_TOOLS_SUBSCRIBER_H
25 
26 #include <ros/ros.h>
27 
32 
33 namespace variant_topic_tools {
36  class Subscriber {
37  friend class MessageType;
38  public:
41  Subscriber();
42 
45  Subscriber(const Subscriber& src);
46 
49  ~Subscriber();
50 
53  std::string getTopic() const;
54 
57  size_t getNumPublishers() const;
58 
61  void shutdown();
62 
65  inline operator void*() const {
66  return (impl && impl->isValid()) ? (void*)1 : (void*)0;
67  };
68 
72  operator ros::Subscriber() const;
73 
74  private:
77  class Impl {
78  public:
82  std::string& topic, size_t queueSize, const SubscriberCallback&
83  callback);
84 
87  ~Impl();
88 
91  bool isValid() const;
92 
95  void shutdown();
96 
100 
104 
108 
112 
116 
120  };
121 
125 
129  typedef boost::weak_ptr<Impl> ImplWPtr;
130 
133  ImplPtr impl;
134  };
135 };
136 
137 #endif
Variant message subscriber.
Definition: Subscriber.h:36
Header file providing the MessageSerializer class interface.
Variant message type information.
Definition: MessageType.h:33
Header file providing forward declarations for the variant topic tools.
Header file providing the MessageVariant class interface.
void eventCallback(const ros::MessageEvent< Message const > &event)
This subscriber&#39;s event callback.
Definition: Subscriber.cpp:103
Impl(ros::NodeHandle &nodeHandle, const MessageType &type, const std::string &topic, size_t queueSize, const SubscriberCallback &callback)
Constructor.
Definition: Subscriber.cpp:40
boost::shared_ptr< Impl > ImplPtr
Declaration of the subscriber implementation pointer type.
Definition: Subscriber.h:124
boost::weak_ptr< Impl > ImplWPtr
Declaration of the subscriber implementation weak pointer type.
Definition: Subscriber.h:129
ros::Subscriber subscriber
The ROS subscriber.
Definition: Subscriber.h:119
boost::function< void(const MessageVariant &, const ros::Time &)> SubscriberCallback
Definition of the subscriber callback type.
Definition: Forwards.h:120
Subscriber()
Default constructor.
Definition: Subscriber.cpp:30
ros::NodeHandlePtr nodeHandle
Definition: echo.cpp:23
size_t getNumPublishers() const
Retrieve this subscriber&#39;s number of publishers.
Definition: Subscriber.cpp:75
MessageType type
The message type associated with this subscriber.
Definition: Subscriber.h:103
MessageDataType dataType
The message data type associated with this subscriber.
Definition: Subscriber.h:107
bool isValid() const
True, if this subscriber implementation is valid.
Definition: Subscriber.cpp:82
void shutdown()
Perform shutdown of the subscriber.
Definition: Subscriber.cpp:90
ImplPtr impl
The subscriber&#39;s implementation.
Definition: Subscriber.h:133
void shutdown()
Perform shutdown of the subscriber.
Definition: Subscriber.cpp:95
Variant message subscriber implementation.
Definition: Subscriber.h:77
std::string getTopic() const
Retrieve the topic this subscriber is subscribed to.
Definition: Subscriber.cpp:68
SubscriberCallback callback
The subscriber&#39;s callback.
Definition: Subscriber.h:115
Header file providing the MessageType class interface.
MessageSerializer serializer
The message serializer associated with this subscriber.
Definition: Subscriber.h:111


variant_topic_tools
Author(s): Ralf Kaestner
autogenerated on Sat Jan 9 2021 03:56:50