subscriber_link.cpp
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 #include "ros/subscriber_link.h"
29 #include "ros/publication.h"
30 
31 #include <boost/bind.hpp>
32 
33 namespace ros
34 {
35 
37  : connection_id_(0)
38 {
39 
40 }
41 
43 {
44 
45 }
46 
47 bool SubscriberLink::verifyDatatype(const std::string &datatype)
48 {
49  PublicationPtr parent = parent_.lock();
50  if (!parent)
51  {
52  ROS_ERROR("Trying to verify the datatype on a publisher without a parent");
53  ROS_BREAK();
54 
55  return false;
56  }
57 
58  if (datatype != parent->getDataType())
59  {
60  ROS_ERROR( "tried to send a message with type %s on a " \
61  "TransportSubscriberLink that has datatype %s",
62  datatype.c_str(), parent->getDataType().c_str());
63  return false; // todo: figure out a way to log this error
64  }
65 
66  return true;
67 }
68 
69 const std::string& SubscriberLink::getMD5Sum()
70 {
71  PublicationPtr parent = parent_.lock();
72  return parent->getMD5Sum();
73 }
74 
75 const std::string& SubscriberLink::getDataType()
76 {
77  PublicationPtr parent = parent_.lock();
78  return parent->getDataType();
79 }
80 
82 {
83  PublicationPtr parent = parent_.lock();
84  return parent->getMessageDefinition();
85 }
86 
87 } // namespace ros
#define ROS_BREAK()
#define ROS_ERROR(...)


roscpp
Author(s): Morgan Quigley, Josh Faust, Brian Gerkey, Troy Straszheim, Dirk Thomas
autogenerated on Mon Feb 28 2022 23:33:27