publisher_link.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008, Morgan Quigley and Willow Garage, Inc.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  * * Redistributions of source code must retain the above copyright notice,
7  * this list of conditions and the following disclaimer.
8  * * Redistributions in binary form must reproduce the above copyright
9  * notice, this list of conditions and the following disclaimer in the
10  * documentation and/or other materials provided with the distribution.
11  * * Neither the names of Stanford University or Willow Garage, Inc. nor the names of its
12  * contributors may be used to endorse or promote products derived from
13  * this software without specific prior written permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25  * POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #ifndef ROSCPP_PUBLISHER_LINK_H
29 #define ROSCPP_PUBLISHER_LINK_H
30 
31 #include "ros/common.h"
32 #include "ros/transport_hints.h"
33 #include "ros/header.h"
34 #include "common.h"
35 #include <boost/thread/mutex.hpp>
36 #include <boost/shared_array.hpp>
37 #include <boost/weak_ptr.hpp>
38 #include <boost/enable_shared_from_this.hpp>
39 
40 #include <queue>
41 
42 namespace ros
43 {
44 class Header;
45 class Message;
46 class Subscription;
48 typedef boost::weak_ptr<Subscription> SubscriptionWPtr;
49 class Connection;
51 
56 class ROSCPP_DECL PublisherLink : public boost::enable_shared_from_this<PublisherLink>
57 {
58 public:
59  class Stats
60  {
61  public:
62  uint64_t bytes_received_, messages_received_, drops_;
64  : bytes_received_(0), messages_received_(0), drops_(0) { }
65  };
66 
67 
68  PublisherLink(const SubscriptionPtr& parent, const std::string& xmlrpc_uri, const TransportHints& transport_hints);
69  virtual ~PublisherLink();
70 
71  const Stats &getStats() { return stats_; }
72  const std::string& getPublisherXMLRPCURI();
73  int getConnectionID() const { return connection_id_; }
74  const std::string& getCallerID() { return caller_id_; }
75  bool isLatched() { return latched_; }
76 
77  bool setHeader(const Header& header);
78 
82  virtual void handleMessage(const SerializedMessage& m, bool ser, bool nocopy) = 0;
83  virtual std::string getTransportType() = 0;
84  virtual std::string getTransportInfo() = 0;
85  virtual void drop() = 0;
86 
87  const std::string& getMD5Sum();
88 
89 protected:
91  unsigned int connection_id_;
92  std::string publisher_xmlrpc_uri_;
93 
95 
97 
98  bool latched_;
99  std::string caller_id_;
101  std::string md5sum_;
102 };
103 
104 } // namespace ros
105 
106 #endif // ROSCPP_PUBLISHER_LINK_H
107 
108 
109 
ros::SerializedMessage
transport_hints.h
boost::shared_ptr
ros
ros::SubscriptionPtr
boost::shared_ptr< Subscription > SubscriptionPtr
Definition: forwards.h:72
ros::Header
ros::TransportHints
Provides a way of specifying network transport hints to ros::NodeHandle::subscribe() and someday ros:...
Definition: transport_hints.h:54
ros::SubscriptionWPtr
boost::weak_ptr< Subscription > SubscriptionWPtr
Definition: forwards.h:74
roslib::Header_< std::allocator< void > >
ros::ConnectionPtr
boost::shared_ptr< Connection > ConnectionPtr
Definition: connection.h:57
header.h


roscpp
Author(s): Morgan Quigley, Josh Faust, Brian Gerkey, Troy Straszheim, Dirk Thomas , Jacob Perron
autogenerated on Sat Sep 14 2024 02:59:35