message_traits.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 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 ROSLIB_MESSAGE_TRAITS_H
30 #define ROSLIB_MESSAGE_TRAITS_H
31 
32 #include "message_forward.h"
33 
34 #include <ros/time.h>
35 
36 #include <string>
37 //#include <boost/utility/enable_if.hpp>
38 //#include <boost/type_traits/remove_const.hpp>
39 //#include <boost/type_traits/remove_reference.hpp>
40 
41 namespace std_msgs
42 {
44 }
45 
46 #define ROS_IMPLEMENT_SIMPLE_TOPIC_TRAITS(msg, md5sum, datatype, definition) \
47  namespace roswrap \
48  { \
49  namespace message_traits \
50  { \
51  template<> struct MD5Sum<msg> \
52  { \
53  static const char* value() { return md5sum; } \
54  static const char* value(const msg&) { return value(); } \
55  }; \
56  template<> struct DataType<msg> \
57  { \
58  static const char* value() { return datatype; } \
59  static const char* value(const msg&) { return value(); } \
60  }; \
61  template<> struct Definition<msg> \
62  { \
63  static const char* value() { return definition; } \
64  static const char* value(const msg&) { return value(); } \
65  }; \
66  } \
67  }
68 
69 
70 namespace roswrap
71 {
72 namespace message_traits
73 {
74 
79 struct TrueType
80 {
81  static const bool value = true;
82  typedef TrueType type;
83 };
84 
89 struct FalseType
90 {
91  static const bool value = false;
92  typedef FalseType type;
93 };
94 
99 template<typename M> struct IsSimple : public FalseType {};
103 template<typename M> struct IsFixedSize : public FalseType {};
107 template<typename M> struct HasHeader : public FalseType {};
108 
112 template<typename M> struct IsMessage : public FalseType {};
113 
117 template<typename M>
118 struct MD5Sum
119 {
120  static const char* value()
121  {
122  return M::__s_getMD5Sum().c_str();
123  }
124 
125  static const char* value(const M& m)
126  {
127  return m.__getMD5Sum().c_str();
128  }
129 };
130 
134 template<typename M>
135 struct DataType
136 {
137  static const char* value()
138  {
139  return M::__s_getDataType().c_str();
140  }
141 
142  static const char* value(const M& m)
143  {
144  return m.__getDataType().c_str();
145  }
146 };
147 
151 template<typename M>
153 {
154  static const char* value()
155  {
156  return M::__s_getMessageDefinition().c_str();
157  }
158 
159  static const char* value(const M& m)
160  {
161  return m.__getMessageDefinition().c_str();
162  }
163 };
164 
169 template<typename M, typename Enable = void>
170 struct Header
171 {
172  static std_msgs::Header* pointer(M& m) { (void)m; return 0; }
173  static std_msgs::Header const* pointer(const M& m) { (void)m; return 0; }
174 };
175 
176 template<typename M>
177 struct Header<M, typename std::enable_if<HasHeader<M>::value >::type >
178 {
179  static std_msgs::Header* pointer(M& m) { return &m.header; }
180  static std_msgs::Header const* pointer(const M& m) { return &m.header; }
181 };
182 
188 template<typename M, typename Enable = void>
189 struct FrameId
190 {
191  static std::string* pointer(M& m) { (void)m; return 0; }
192  static std::string const* pointer(const M& m) { (void)m; return 0; }
193 };
194 
195 template<typename M>
196 struct FrameId<M, typename std::enable_if<HasHeader<M>::value >::type >
197 {
198  static std::string* pointer(M& m) { return &m.header.frame_id; }
199  static std::string const* pointer(const M& m) { return &m.header.frame_id; }
200  static std::string value(const M& m) { return m.header.frame_id; }
201 };
202 
208 template<typename M, typename Enable = void>
209 struct TimeStamp
210 {
211  static ros::Time* pointer(M& m) { (void)m; return 0; }
212  static ros::Time const* pointer(const M& m) { (void)m; return 0; }
213 };
214 
215 template<typename M>
216 struct TimeStamp<M, typename std::enable_if<HasHeader<M>::value >::type >
217 {
218  static ros::Time* pointer(typename std::remove_const<M>::type &m) { return &m.header.stamp; }
219  static ros::Time const* pointer(const M& m) { return &m.header.stamp; }
220  static ros::Time value(const M& m) { return m.header.stamp; }
221 };
222 
226 template<typename M>
227 inline const char* md5sum()
228 {
230 }
231 
235 template<typename M>
236 inline const char* datatype()
237 {
239 }
240 
244 template<typename M>
245 inline const char* definition()
246 {
248 }
249 
253 template<typename M>
254 inline const char* md5sum(const M& m)
255 {
257 }
258 
262 template<typename M>
263 inline const char* datatype(const M& m)
264 {
266 }
267 
271 template<typename M>
272 inline const char* definition(const M& m)
273 {
275 }
276 
280 template<typename M>
282 {
284 }
285 
289 template<typename M>
290 inline std_msgs::Header const* header(const M& m)
291 {
293 }
294 
298 template<typename M>
299 inline std::string* frameId(M& m)
300 {
302 }
303 
307 template<typename M>
308 inline std::string const* frameId(const M& m)
309 {
311 }
312 
316 template<typename M>
317 inline ros::Time* timeStamp(M& m)
318 {
320 }
321 
325 template<typename M>
326 inline ros::Time const* timeStamp(const M& m)
327 {
329 }
330 
334 template<typename M>
335 inline bool isSimple()
336 {
338 }
339 
343 template<typename M>
344 inline bool isFixedSize()
345 {
347 }
348 
352 template<typename M>
353 inline bool hasHeader()
354 {
356 }
357 
358 } // namespace message_traits
359 } // namespace roswrap
360 
361 #endif // ROSLIB_MESSAGE_TRAITS_H
roswrap::message_traits::hasHeader
bool hasHeader()
returns HasHeader<M>::value;
Definition: message_traits.h:353
roswrap::message_traits::md5sum
const char * md5sum()
returns MD5Sum<M>::value();
Definition: message_traits.h:227
roswrap::message_traits::FalseType
Base type for compile-type true/false tests. Compatible with Boost.MPL. classes inheriting from this ...
Definition: message_traits.h:89
roswrap::message_traits::IsSimple
A simple datatype is one that can be memcpy'd directly in array form, i.e. it's a POD,...
Definition: message_traits.h:99
roswrap::message_traits::TimeStamp::pointer
static ros::Time const * pointer(const M &m)
Definition: message_traits.h:212
roswrap::message_traits::TimeStamp::pointer
static ros::Time * pointer(M &m)
Definition: message_traits.h:211
message_forward.h
roswrap::message_traits::Header::pointer
static std_msgs::Header * pointer(M &m)
Definition: message_traits.h:172
Header
roswrap::message_traits::HasHeader
HasHeader informs whether or not there is a header that gets serialized as the first thing in the mes...
Definition: message_traits.h:107
roswrap::message_traits::TimeStamp< M, typename std::enable_if< HasHeader< M >::value >::type >::pointer
static ros::Time * pointer(typename std::remove_const< M >::type &m)
Definition: message_traits.h:218
roswrap::message_traits::TimeStamp< M, typename std::enable_if< HasHeader< M >::value >::type >::value
static ros::Time value(const M &m)
Definition: message_traits.h:220
roswrap::message_traits::frameId
std::string * frameId(M &m)
returns FrameId<M>::pointer(m);
Definition: message_traits.h:299
roswrap::message_traits::datatype
const char * datatype()
returns DataType<M>::value();
Definition: message_traits.h:236
roswrap::message_traits::TimeStamp
TimeStamp trait. In the default implementation pointer() returns &m.header.stamp if HasHeader<M>::val...
Definition: message_traits.h:209
test_server.type
type
Definition: test_server.py:210
roswrap::message_traits::IsFixedSize
A fixed-size datatype is one whose size is constant, i.e. it has no variable-length arrays or strings...
Definition: message_traits.h:103
roswrap::message_traits::FrameId
FrameId trait. In the default implementation pointer() returns &m.header.frame_id if HasHeader<M>::va...
Definition: message_traits.h:189
roswrap::message_traits::FrameId::pointer
static std::string const * pointer(const M &m)
Definition: message_traits.h:192
roswrap::message_traits::DataType::value
static const char * value(const M &m)
Definition: message_traits.h:142
roswrap::message_traits::isFixedSize
bool isFixedSize()
returns IsFixedSize<M>::value;
Definition: message_traits.h:344
roswrap::message_traits::DataType
Specialize to provide the datatype for a message.
Definition: message_traits.h:135
roswrap::message_traits::Definition::value
static const char * value()
Definition: message_traits.h:154
roswrap::message_traits::Definition
Specialize to provide the definition for a message.
Definition: message_traits.h:152
std_msgs
ROS_DECLARE_MESSAGE
#define ROS_DECLARE_MESSAGE(msg)
Forward-declare a message, including Ptr and ConstPtr types, using std::allocator.
Definition: message_forward.h:70
roswrap::message_traits::FrameId::pointer
static std::string * pointer(M &m)
Definition: message_traits.h:191
roswrap::message_traits::Definition::value
static const char * value(const M &m)
Definition: message_traits.h:159
roswrap
Definition: param_modi.cpp:41
roswrap::message_traits::FrameId< M, typename std::enable_if< HasHeader< M >::value >::type >::pointer
static std::string * pointer(M &m)
Definition: message_traits.h:198
std_msgs::Header_< std::allocator< void > >
roswrap::message_traits::Header
Header trait. In the default implementation pointer() returns &m.header if HasHeader<M>::value is tru...
Definition: message_traits.h:170
roswrap::message_traits::FrameId< M, typename std::enable_if< HasHeader< M >::value >::type >::pointer
static std::string const * pointer(const M &m)
Definition: message_traits.h:199
roswrap::message_traits::TrueType
Base type for compile-type true/false tests. Compatible with Boost.MPL. classes inheriting from this ...
Definition: message_traits.h:79
roswrap::message_traits::MD5Sum
Specialize to provide the md5sum for a message.
Definition: message_traits.h:118
roswrap::message_traits::FalseType::type
FalseType type
Definition: message_traits.h:92
ros::Time
roswrap::message_traits::MD5Sum::value
static const char * value(const M &m)
Definition: message_traits.h:125
roswrap::message_traits::IsMessage
Am I message or not.
Definition: message_traits.h:112
std
roswrap::message_traits::isSimple
bool isSimple()
returns IsSimple<M>::value;
Definition: message_traits.h:335
roswrap::message_traits::FalseType::value
static const bool value
Definition: message_traits.h:91
sick_scan_base.h
roswrap::message_traits::TrueType::type
TrueType type
Definition: message_traits.h:82
roswrap::message_traits::DataType::value
static const char * value()
Definition: message_traits.h:137
roswrap::message_traits::FrameId< M, typename std::enable_if< HasHeader< M >::value >::type >::value
static std::string value(const M &m)
Definition: message_traits.h:200
roswrap::message_traits::Header< M, typename std::enable_if< HasHeader< M >::value >::type >::pointer
static std_msgs::Header const * pointer(const M &m)
Definition: message_traits.h:180
roswrap::message_traits::MD5Sum::value
static const char * value()
Definition: message_traits.h:120
roswrap::message_traits::timeStamp
ros::Time * timeStamp(M &m)
returns TimeStamp<M>::pointer(m);
Definition: message_traits.h:317
roswrap::message_traits::header
std_msgs::Header * header(M &m)
returns Header<M>::pointer(m);
Definition: message_traits.h:281
roswrap::message_traits::Header::pointer
static std_msgs::Header const * pointer(const M &m)
Definition: message_traits.h:173
roswrap::message_traits::Header< M, typename std::enable_if< HasHeader< M >::value >::type >::pointer
static std_msgs::Header * pointer(M &m)
Definition: message_traits.h:179
roswrap::message_traits::TrueType::value
static const bool value
Definition: message_traits.h:81
roswrap::message_traits::definition
const char * definition()
returns Definition<M>::value();
Definition: message_traits.h:245
roswrap::message_traits::TimeStamp< M, typename std::enable_if< HasHeader< M >::value >::type >::pointer
static ros::Time const * pointer(const M &m)
Definition: message_traits.h:219


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