parameter_adapter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2010, 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_PARAMETER_ADAPTER_H
29 #define ROSCPP_PARAMETER_ADAPTER_H
30 
31 #include "ros/forwards.h"
32 #include "ros/message_event.h"
33 #include <ros/static_assert.h>
34 
35 #include <boost/type_traits/add_const.hpp>
36 #include <boost/type_traits/remove_const.hpp>
37 #include <boost/type_traits/remove_reference.hpp>
38 
39 namespace ros
40 {
41 
68 template<typename M>
70 {
71  typedef typename boost::remove_reference<typename boost::remove_const<M>::type>::type Message;
73  typedef M Parameter;
74  static const bool is_const = true;
75 
76  static Parameter getParameter(const Event& event)
77  {
78  return *event.getMessage();
79  }
80 };
81 
82 template<typename M>
83 struct ParameterAdapter<const boost::shared_ptr<M const>& >
84 {
85  typedef typename boost::remove_reference<typename boost::remove_const<M>::type>::type Message;
88  static const bool is_const = true;
89 
90  static Parameter getParameter(const Event& event)
91  {
92  return event.getMessage();
93  }
94 };
95 
96 template<typename M>
97 struct ParameterAdapter<const boost::shared_ptr<M>& >
98 {
99  typedef typename boost::remove_reference<typename boost::remove_const<M>::type>::type Message;
102  static const bool is_const = false;
103 
104  static Parameter getParameter(const Event& event)
105  {
106  return ros::MessageEvent<Message>(event).getMessage();
107  }
108 };
109 
110 template<typename M>
111 struct ParameterAdapter<const M&>
112 {
113  typedef typename boost::remove_reference<typename boost::remove_const<M>::type>::type Message;
115  typedef const M& Parameter;
116  static const bool is_const = true;
117 
118  static Parameter getParameter(const Event& event)
119  {
120  return *event.getMessage();
121  }
122 };
123 
124 template<typename M>
125 struct ParameterAdapter<boost::shared_ptr<M const> >
126 {
127  typedef typename boost::remove_reference<typename boost::remove_const<M>::type>::type Message;
130  static const bool is_const = true;
131 
132  static Parameter getParameter(const Event& event)
133  {
134  return event.getMessage();
135  }
136 };
137 
138 template<typename M>
139 struct ParameterAdapter<boost::shared_ptr<M> >
140 {
141  typedef typename boost::remove_reference<typename boost::remove_const<M>::type>::type Message;
144  static const bool is_const = false;
145 
146  static Parameter getParameter(const Event& event)
147  {
148  return ros::MessageEvent<Message>(event).getMessage();
149  }
150 };
151 
152 template<typename M>
153 struct ParameterAdapter<const ros::MessageEvent<M const>& >
154 {
155  typedef typename boost::remove_reference<typename boost::remove_const<M>::type>::type Message;
158  static const bool is_const = true;
159 
160  static Parameter getParameter(const Event& event)
161  {
162  return event;
163  }
164 };
165 
166 template<typename M>
167 struct ParameterAdapter<const ros::MessageEvent<M>& >
168 {
169  typedef typename boost::remove_reference<typename boost::remove_const<M>::type>::type Message;
172  static const bool is_const = false;
173 
174  static Parameter getParameter(const Event& event)
175  {
176  return ros::MessageEvent<Message>(event);
177  }
178 };
179 
180 }
181 
182 #endif // ROSCPP_PARAMETER_ADAPTER_H
ros::ParameterAdapter< const boost::shared_ptr< M > & >::Event
ros::MessageEvent< Message const > Event
Definition: parameter_adapter.h:100
ros::ParameterAdapter< boost::shared_ptr< M const > >::Event
ros::MessageEvent< Message const > Event
Definition: parameter_adapter.h:128
ros::ParameterAdapter< const M & >::Message
boost::remove_reference< typename boost::remove_const< M >::type >::type Message
Definition: parameter_adapter.h:113
ros::ParameterAdapter< const ros::MessageEvent< M const > & >::getParameter
static Parameter getParameter(const Event &event)
Definition: parameter_adapter.h:160
ros::ParameterAdapter< boost::shared_ptr< M > >::getParameter
static Parameter getParameter(const Event &event)
Definition: parameter_adapter.h:146
boost::shared_ptr
ros::ParameterAdapter< const boost::shared_ptr< M > & >::Message
boost::remove_reference< typename boost::remove_const< M >::type >::type Message
Definition: parameter_adapter.h:99
forwards.h
ros
ros::ParameterAdapter< const ros::MessageEvent< M > & >::getParameter
static Parameter getParameter(const Event &event)
Definition: parameter_adapter.h:174
ros::ParameterAdapter< const boost::shared_ptr< M const > & >::Message
boost::remove_reference< typename boost::remove_const< M >::type >::type Message
Definition: parameter_adapter.h:85
ros::ParameterAdapter
Generally not for outside use. Adapts a function parameter type into the message type,...
Definition: parameter_adapter.h:69
boost
ros::ParameterAdapter< boost::shared_ptr< M const > >::Message
boost::remove_reference< typename boost::remove_const< M >::type >::type Message
Definition: parameter_adapter.h:127
ros::ParameterAdapter< boost::shared_ptr< M const > >::getParameter
static Parameter getParameter(const Event &event)
Definition: parameter_adapter.h:132
ros::ParameterAdapter< boost::shared_ptr< M > >::Message
boost::remove_reference< typename boost::remove_const< M >::type >::type Message
Definition: parameter_adapter.h:141
ros::ParameterAdapter< const boost::shared_ptr< M const > & >::Parameter
const typedef boost::shared_ptr< Message const > Parameter
Definition: parameter_adapter.h:87
ros::ParameterAdapter::Parameter
M Parameter
Definition: parameter_adapter.h:73
ros::ParameterAdapter< const ros::MessageEvent< M const > & >::Parameter
const typedef ros::MessageEvent< Message const > & Parameter
Definition: parameter_adapter.h:157
ros::ParameterAdapter< boost::shared_ptr< M > >::Parameter
boost::shared_ptr< Message > Parameter
Definition: parameter_adapter.h:143
ros::ParameterAdapter< const ros::MessageEvent< M > & >::Parameter
ros::MessageEvent< Message > Parameter
Definition: parameter_adapter.h:171
ros::ParameterAdapter< boost::shared_ptr< M > >::Event
ros::MessageEvent< Message const > Event
Definition: parameter_adapter.h:142
ros::ParameterAdapter< const M & >::Parameter
const typedef M & Parameter
Definition: parameter_adapter.h:115
ros::ParameterAdapter::Message
boost::remove_reference< typename boost::remove_const< M >::type >::type Message
Definition: parameter_adapter.h:71
ros::ParameterAdapter::getParameter
static Parameter getParameter(const Event &event)
Definition: parameter_adapter.h:76
ros::ParameterAdapter< const ros::MessageEvent< M > & >::Message
boost::remove_reference< typename boost::remove_const< M >::type >::type Message
Definition: parameter_adapter.h:169
ros::ParameterAdapter< const boost::shared_ptr< M const > & >::Event
ros::MessageEvent< Message const > Event
Definition: parameter_adapter.h:86
ros::ParameterAdapter< const ros::MessageEvent< M > & >::Event
ros::MessageEvent< Message const > Event
Definition: parameter_adapter.h:170
ros::ParameterAdapter< const boost::shared_ptr< M > & >::getParameter
static Parameter getParameter(const Event &event)
Definition: parameter_adapter.h:104
ros::ParameterAdapter< const ros::MessageEvent< M const > & >::Message
boost::remove_reference< typename boost::remove_const< M >::type >::type Message
Definition: parameter_adapter.h:155
ros::ParameterAdapter::Event
ros::MessageEvent< Message const > Event
Definition: parameter_adapter.h:72
ros::ParameterAdapter::is_const
static const bool is_const
Definition: parameter_adapter.h:74
ros::ParameterAdapter< const M & >::getParameter
static Parameter getParameter(const Event &event)
Definition: parameter_adapter.h:118
ros::ParameterAdapter< const M & >::Event
ros::MessageEvent< Message const > Event
Definition: parameter_adapter.h:114
ros::MessageEvent::getMessage
boost::shared_ptr< M > getMessage() const
ros::ParameterAdapter< const boost::shared_ptr< M const > & >::getParameter
static Parameter getParameter(const Event &event)
Definition: parameter_adapter.h:90
ros::ParameterAdapter< boost::shared_ptr< M const > >::Parameter
boost::shared_ptr< Message const > Parameter
Definition: parameter_adapter.h:129
static_assert.h
message_event.h
ros::ParameterAdapter< const ros::MessageEvent< M const > & >::Event
ros::MessageEvent< Message const > Event
Definition: parameter_adapter.h:156
ros::ParameterAdapter< const boost::shared_ptr< M > & >::Parameter
boost::shared_ptr< Message > Parameter
Definition: parameter_adapter.h:101
ros::MessageEvent


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