subscriber.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_SUBSCRIBER_HANDLE_H
30 #define ROSCPP_SUBSCRIBER_HANDLE_H
31 
32 #include "common.h"
33 #include "ros/forwards.h"
34 #include "ros/subscription_callback_helper.h"
35 
36 namespace roswrap
37 {
38 
48 {
49 public:
51  Subscriber(const Subscriber& rhs);
52  ~Subscriber();
53 
63  void shutdown();
64 
65  std::string getTopic() const;
66 
70  uint32_t getNumPublishers() const;
71 
72  operator void*() const { return (impl_ && impl_->isValid()) ? (void*)1 : (void*)0; }
73 
74  bool operator<(const Subscriber& rhs) const
75  {
76  return impl_ < rhs.impl_;
77  }
78 
79  bool operator==(const Subscriber& rhs) const
80  {
81  return impl_ == rhs.impl_;
82  }
83 
84  bool operator!=(const Subscriber& rhs) const
85  {
86  return impl_ != rhs.impl_;
87  }
88 
89 private:
90 
91  Subscriber(const std::string& topic, const NodeHandle& node_handle,
92  const SubscriptionCallbackHelperPtr& helper);
93 
94  class Impl
95  {
96  public:
97  Impl();
98  ~Impl();
99 
100  void unsubscribe();
101  bool isValid() const;
102 
103  std::string topic_;
107  };
108  typedef std::shared_ptr<Impl> ImplPtr;
109  typedef std::weak_ptr<Impl> ImplWPtr;
110 
112 
113  friend class NodeHandle;
114  friend class NodeHandleBackingCollection;
115 };
116 typedef std::vector<Subscriber> V_Subscriber;
117 
118 }
119 
120 #endif // ROSCPP_PUBLISHER_HANDLE_H
121 
122 
unsubscribe
void unsubscribe()
roswrap::Subscriber::Impl
Definition: subscriber.h:94
roswrap::NodeHandlePtr
std::shared_ptr< NodeHandle > NodeHandlePtr
Definition: forwards.h:92
roswrap::Subscriber
Manages an subscription callback on a specific topic.
Definition: subscriber.h:47
roswrap::Subscriber::ImplWPtr
std::weak_ptr< Impl > ImplWPtr
Definition: subscriber.h:109
roswrap::shutdown
ROSCPP_DECL void shutdown()
Disconnects everything and unregisters from the master. It is generally not necessary to call this fu...
Definition: rossimu.cpp:269
roswrap::Subscriber::ImplPtr
std::shared_ptr< Impl > ImplPtr
Definition: subscriber.h:108
roswrap::Subscriber::operator<
bool operator<(const Subscriber &rhs) const
Definition: subscriber.h:74
roswrap::Subscriber::Impl::helper_
SubscriptionCallbackHelperPtr helper_
Definition: subscriber.h:105
roswrap::SubscriptionCallbackHelperPtr
std::shared_ptr< SubscriptionCallbackHelper > SubscriptionCallbackHelperPtr
Definition: message_deserializer.h:43
roswrap
Definition: param_modi.cpp:41
roswrap::Subscriber::Subscriber
Subscriber()
Definition: subscriber.h:50
roswrap::NodeHandle
roscpp's interface for creating subscribers, publishers, etc.
Definition: node_handle.h:87
common.h
roswrap::Subscriber::Impl::node_handle_
NodeHandlePtr node_handle_
Definition: subscriber.h:104
roswrap::Subscriber::operator==
bool operator==(const Subscriber &rhs) const
Definition: subscriber.h:79
roswrap::Subscriber::Impl::unsubscribed_
bool unsubscribed_
Definition: subscriber.h:106
sick_scan_base.h
roswrap::V_Subscriber
std::vector< Subscriber > V_Subscriber
Definition: subscriber.h:116
ROSCPP_DECL
#define ROSCPP_DECL
Definition: roswrap/src/cfgsimu/sick_scan/ros/common.h:63
roswrap::Subscriber::Impl::topic_
std::string topic_
Definition: subscriber.h:103
roswrap::Subscriber::impl_
ImplPtr impl_
Definition: subscriber.h:111
roswrap::Subscriber::operator!=
bool operator!=(const Subscriber &rhs) const
Definition: subscriber.h:84


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