capstone_finish
Dependencies: BufferedSerial motor_sn7544
ros/message_traits.h@10:ca4e4062701a, 2019-11-26 (annotated)
- Committer:
- Jeonghoon
- Date:
- Tue Nov 26 15:30:27 2019 +0000
- Revision:
- 10:ca4e4062701a
- Parent:
- 3:2a3664dc6634
capstone finish
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Jeonghoon | 3:2a3664dc6634 | 1 | /* |
Jeonghoon | 3:2a3664dc6634 | 2 | * Copyright (C) 2009, Willow Garage, Inc. |
Jeonghoon | 3:2a3664dc6634 | 3 | * |
Jeonghoon | 3:2a3664dc6634 | 4 | * Redistribution and use in source and binary forms, with or without |
Jeonghoon | 3:2a3664dc6634 | 5 | * modification, are permitted provided that the following conditions are met: |
Jeonghoon | 3:2a3664dc6634 | 6 | * * Redistributions of source code must retain the above copyright notice, |
Jeonghoon | 3:2a3664dc6634 | 7 | * this list of conditions and the following disclaimer. |
Jeonghoon | 3:2a3664dc6634 | 8 | * * Redistributions in binary form must reproduce the above copyright |
Jeonghoon | 3:2a3664dc6634 | 9 | * notice, this list of conditions and the following disclaimer in the |
Jeonghoon | 3:2a3664dc6634 | 10 | * documentation and/or other materials provided with the distribution. |
Jeonghoon | 3:2a3664dc6634 | 11 | * * Neither the names of Willow Garage, Inc. nor the names of its |
Jeonghoon | 3:2a3664dc6634 | 12 | * contributors may be used to endorse or promote products derived from |
Jeonghoon | 3:2a3664dc6634 | 13 | * this software without specific prior written permission. |
Jeonghoon | 3:2a3664dc6634 | 14 | * |
Jeonghoon | 3:2a3664dc6634 | 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
Jeonghoon | 3:2a3664dc6634 | 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
Jeonghoon | 3:2a3664dc6634 | 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
Jeonghoon | 3:2a3664dc6634 | 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
Jeonghoon | 3:2a3664dc6634 | 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
Jeonghoon | 3:2a3664dc6634 | 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
Jeonghoon | 3:2a3664dc6634 | 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
Jeonghoon | 3:2a3664dc6634 | 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
Jeonghoon | 3:2a3664dc6634 | 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
Jeonghoon | 3:2a3664dc6634 | 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
Jeonghoon | 3:2a3664dc6634 | 25 | * POSSIBILITY OF SUCH DAMAGE. |
Jeonghoon | 3:2a3664dc6634 | 26 | */ |
Jeonghoon | 3:2a3664dc6634 | 27 | |
Jeonghoon | 3:2a3664dc6634 | 28 | #ifndef ROSLIB_MESSAGE_TRAITS_H |
Jeonghoon | 3:2a3664dc6634 | 29 | #define ROSLIB_MESSAGE_TRAITS_H |
Jeonghoon | 3:2a3664dc6634 | 30 | |
Jeonghoon | 3:2a3664dc6634 | 31 | #include "message_forward.h" |
Jeonghoon | 3:2a3664dc6634 | 32 | |
Jeonghoon | 3:2a3664dc6634 | 33 | #include <ros/time.h> |
Jeonghoon | 3:2a3664dc6634 | 34 | |
Jeonghoon | 3:2a3664dc6634 | 35 | #include <string> |
Jeonghoon | 3:2a3664dc6634 | 36 | #include <boost/utility/enable_if.hpp> |
Jeonghoon | 3:2a3664dc6634 | 37 | #include <boost/type_traits/remove_const.hpp> |
Jeonghoon | 3:2a3664dc6634 | 38 | #include <boost/type_traits/remove_reference.hpp> |
Jeonghoon | 3:2a3664dc6634 | 39 | |
Jeonghoon | 3:2a3664dc6634 | 40 | namespace std_msgs |
Jeonghoon | 3:2a3664dc6634 | 41 | { |
Jeonghoon | 3:2a3664dc6634 | 42 | ROS_DECLARE_MESSAGE(Header) |
Jeonghoon | 3:2a3664dc6634 | 43 | } |
Jeonghoon | 3:2a3664dc6634 | 44 | |
Jeonghoon | 3:2a3664dc6634 | 45 | #define ROS_IMPLEMENT_SIMPLE_TOPIC_TRAITS(msg, md5sum, datatype, definition) \ |
Jeonghoon | 3:2a3664dc6634 | 46 | namespace ros \ |
Jeonghoon | 3:2a3664dc6634 | 47 | { \ |
Jeonghoon | 3:2a3664dc6634 | 48 | namespace message_traits \ |
Jeonghoon | 3:2a3664dc6634 | 49 | { \ |
Jeonghoon | 3:2a3664dc6634 | 50 | template<> struct MD5Sum<msg> \ |
Jeonghoon | 3:2a3664dc6634 | 51 | { \ |
Jeonghoon | 3:2a3664dc6634 | 52 | static const char* value() { return md5sum; } \ |
Jeonghoon | 3:2a3664dc6634 | 53 | static const char* value(const msg&) { return value(); } \ |
Jeonghoon | 3:2a3664dc6634 | 54 | }; \ |
Jeonghoon | 3:2a3664dc6634 | 55 | template<> struct DataType<msg> \ |
Jeonghoon | 3:2a3664dc6634 | 56 | { \ |
Jeonghoon | 3:2a3664dc6634 | 57 | static const char* value() { return datatype; } \ |
Jeonghoon | 3:2a3664dc6634 | 58 | static const char* value(const msg&) { return value(); } \ |
Jeonghoon | 3:2a3664dc6634 | 59 | }; \ |
Jeonghoon | 3:2a3664dc6634 | 60 | template<> struct Definition<msg> \ |
Jeonghoon | 3:2a3664dc6634 | 61 | { \ |
Jeonghoon | 3:2a3664dc6634 | 62 | static const char* value() { return definition; } \ |
Jeonghoon | 3:2a3664dc6634 | 63 | static const char* value(const msg&) { return value(); } \ |
Jeonghoon | 3:2a3664dc6634 | 64 | }; \ |
Jeonghoon | 3:2a3664dc6634 | 65 | } \ |
Jeonghoon | 3:2a3664dc6634 | 66 | } |
Jeonghoon | 3:2a3664dc6634 | 67 | |
Jeonghoon | 3:2a3664dc6634 | 68 | |
Jeonghoon | 3:2a3664dc6634 | 69 | namespace ros |
Jeonghoon | 3:2a3664dc6634 | 70 | { |
Jeonghoon | 3:2a3664dc6634 | 71 | namespace message_traits |
Jeonghoon | 3:2a3664dc6634 | 72 | { |
Jeonghoon | 3:2a3664dc6634 | 73 | |
Jeonghoon | 3:2a3664dc6634 | 74 | /** |
Jeonghoon | 3:2a3664dc6634 | 75 | * \brief Base type for compile-type true/false tests. Compatible with Boost.MPL. classes inheriting from this type |
Jeonghoon | 3:2a3664dc6634 | 76 | * are \b true values. |
Jeonghoon | 3:2a3664dc6634 | 77 | */ |
Jeonghoon | 3:2a3664dc6634 | 78 | struct TrueType |
Jeonghoon | 3:2a3664dc6634 | 79 | { |
Jeonghoon | 3:2a3664dc6634 | 80 | static const bool value = true; |
Jeonghoon | 3:2a3664dc6634 | 81 | typedef TrueType type; |
Jeonghoon | 3:2a3664dc6634 | 82 | }; |
Jeonghoon | 3:2a3664dc6634 | 83 | |
Jeonghoon | 3:2a3664dc6634 | 84 | /** |
Jeonghoon | 3:2a3664dc6634 | 85 | * \brief Base type for compile-type true/false tests. Compatible with Boost.MPL. classes inheriting from this type |
Jeonghoon | 3:2a3664dc6634 | 86 | * are \b false values. |
Jeonghoon | 3:2a3664dc6634 | 87 | */ |
Jeonghoon | 3:2a3664dc6634 | 88 | struct FalseType |
Jeonghoon | 3:2a3664dc6634 | 89 | { |
Jeonghoon | 3:2a3664dc6634 | 90 | static const bool value = false; |
Jeonghoon | 3:2a3664dc6634 | 91 | typedef FalseType type; |
Jeonghoon | 3:2a3664dc6634 | 92 | }; |
Jeonghoon | 3:2a3664dc6634 | 93 | |
Jeonghoon | 3:2a3664dc6634 | 94 | /** |
Jeonghoon | 3:2a3664dc6634 | 95 | * \brief A simple datatype is one that can be memcpy'd directly in array form, i.e. it's a POD, fixed-size type and |
Jeonghoon | 3:2a3664dc6634 | 96 | * sizeof(M) == sum(serializationLength(M:a...)) |
Jeonghoon | 3:2a3664dc6634 | 97 | */ |
Jeonghoon | 3:2a3664dc6634 | 98 | template<typename M> struct IsSimple : public FalseType {}; |
Jeonghoon | 3:2a3664dc6634 | 99 | /** |
Jeonghoon | 3:2a3664dc6634 | 100 | * \brief A fixed-size datatype is one whose size is constant, i.e. it has no variable-length arrays or strings |
Jeonghoon | 3:2a3664dc6634 | 101 | */ |
Jeonghoon | 3:2a3664dc6634 | 102 | template<typename M> struct IsFixedSize : public FalseType {}; |
Jeonghoon | 3:2a3664dc6634 | 103 | /** |
Jeonghoon | 3:2a3664dc6634 | 104 | * \brief HasHeader informs whether or not there is a header that gets serialized as the first thing in the message |
Jeonghoon | 3:2a3664dc6634 | 105 | */ |
Jeonghoon | 3:2a3664dc6634 | 106 | template<typename M> struct HasHeader : public FalseType {}; |
Jeonghoon | 3:2a3664dc6634 | 107 | |
Jeonghoon | 3:2a3664dc6634 | 108 | /** |
Jeonghoon | 3:2a3664dc6634 | 109 | * \brief Am I message or not |
Jeonghoon | 3:2a3664dc6634 | 110 | */ |
Jeonghoon | 3:2a3664dc6634 | 111 | template<typename M> struct IsMessage : public FalseType {}; |
Jeonghoon | 3:2a3664dc6634 | 112 | |
Jeonghoon | 3:2a3664dc6634 | 113 | /** |
Jeonghoon | 3:2a3664dc6634 | 114 | * \brief Specialize to provide the md5sum for a message |
Jeonghoon | 3:2a3664dc6634 | 115 | */ |
Jeonghoon | 3:2a3664dc6634 | 116 | template<typename M> |
Jeonghoon | 3:2a3664dc6634 | 117 | struct MD5Sum |
Jeonghoon | 3:2a3664dc6634 | 118 | { |
Jeonghoon | 3:2a3664dc6634 | 119 | static const char* value() |
Jeonghoon | 3:2a3664dc6634 | 120 | { |
Jeonghoon | 3:2a3664dc6634 | 121 | return M::__s_getMD5Sum().c_str(); |
Jeonghoon | 3:2a3664dc6634 | 122 | } |
Jeonghoon | 3:2a3664dc6634 | 123 | |
Jeonghoon | 3:2a3664dc6634 | 124 | static const char* value(const M& m) |
Jeonghoon | 3:2a3664dc6634 | 125 | { |
Jeonghoon | 3:2a3664dc6634 | 126 | return m.__getMD5Sum().c_str(); |
Jeonghoon | 3:2a3664dc6634 | 127 | } |
Jeonghoon | 3:2a3664dc6634 | 128 | }; |
Jeonghoon | 3:2a3664dc6634 | 129 | |
Jeonghoon | 3:2a3664dc6634 | 130 | /** |
Jeonghoon | 3:2a3664dc6634 | 131 | * \brief Specialize to provide the datatype for a message |
Jeonghoon | 3:2a3664dc6634 | 132 | */ |
Jeonghoon | 3:2a3664dc6634 | 133 | template<typename M> |
Jeonghoon | 3:2a3664dc6634 | 134 | struct DataType |
Jeonghoon | 3:2a3664dc6634 | 135 | { |
Jeonghoon | 3:2a3664dc6634 | 136 | static const char* value() |
Jeonghoon | 3:2a3664dc6634 | 137 | { |
Jeonghoon | 3:2a3664dc6634 | 138 | return M::__s_getDataType().c_str(); |
Jeonghoon | 3:2a3664dc6634 | 139 | } |
Jeonghoon | 3:2a3664dc6634 | 140 | |
Jeonghoon | 3:2a3664dc6634 | 141 | static const char* value(const M& m) |
Jeonghoon | 3:2a3664dc6634 | 142 | { |
Jeonghoon | 3:2a3664dc6634 | 143 | return m.__getDataType().c_str(); |
Jeonghoon | 3:2a3664dc6634 | 144 | } |
Jeonghoon | 3:2a3664dc6634 | 145 | }; |
Jeonghoon | 3:2a3664dc6634 | 146 | |
Jeonghoon | 3:2a3664dc6634 | 147 | /** |
Jeonghoon | 3:2a3664dc6634 | 148 | * \brief Specialize to provide the definition for a message |
Jeonghoon | 3:2a3664dc6634 | 149 | */ |
Jeonghoon | 3:2a3664dc6634 | 150 | template<typename M> |
Jeonghoon | 3:2a3664dc6634 | 151 | struct Definition |
Jeonghoon | 3:2a3664dc6634 | 152 | { |
Jeonghoon | 3:2a3664dc6634 | 153 | static const char* value() |
Jeonghoon | 3:2a3664dc6634 | 154 | { |
Jeonghoon | 3:2a3664dc6634 | 155 | return M::__s_getMessageDefinition().c_str(); |
Jeonghoon | 3:2a3664dc6634 | 156 | } |
Jeonghoon | 3:2a3664dc6634 | 157 | |
Jeonghoon | 3:2a3664dc6634 | 158 | static const char* value(const M& m) |
Jeonghoon | 3:2a3664dc6634 | 159 | { |
Jeonghoon | 3:2a3664dc6634 | 160 | return m.__getMessageDefinition().c_str(); |
Jeonghoon | 3:2a3664dc6634 | 161 | } |
Jeonghoon | 3:2a3664dc6634 | 162 | }; |
Jeonghoon | 3:2a3664dc6634 | 163 | |
Jeonghoon | 3:2a3664dc6634 | 164 | /** |
Jeonghoon | 3:2a3664dc6634 | 165 | * \brief Header trait. In the default implementation pointer() |
Jeonghoon | 3:2a3664dc6634 | 166 | * returns &m.header if HasHeader<M>::value is true, otherwise returns NULL |
Jeonghoon | 3:2a3664dc6634 | 167 | */ |
Jeonghoon | 3:2a3664dc6634 | 168 | template<typename M, typename Enable = void> |
Jeonghoon | 3:2a3664dc6634 | 169 | struct Header |
Jeonghoon | 3:2a3664dc6634 | 170 | { |
Jeonghoon | 3:2a3664dc6634 | 171 | static std_msgs::Header* pointer(M& m) { (void)m; return 0; } |
Jeonghoon | 3:2a3664dc6634 | 172 | static std_msgs::Header const* pointer(const M& m) { (void)m; return 0; } |
Jeonghoon | 3:2a3664dc6634 | 173 | }; |
Jeonghoon | 3:2a3664dc6634 | 174 | |
Jeonghoon | 3:2a3664dc6634 | 175 | template<typename M> |
Jeonghoon | 3:2a3664dc6634 | 176 | struct Header<M, typename boost::enable_if<HasHeader<M> >::type > |
Jeonghoon | 3:2a3664dc6634 | 177 | { |
Jeonghoon | 3:2a3664dc6634 | 178 | static std_msgs::Header* pointer(M& m) { return &m.header; } |
Jeonghoon | 3:2a3664dc6634 | 179 | static std_msgs::Header const* pointer(const M& m) { return &m.header; } |
Jeonghoon | 3:2a3664dc6634 | 180 | }; |
Jeonghoon | 3:2a3664dc6634 | 181 | |
Jeonghoon | 3:2a3664dc6634 | 182 | /** |
Jeonghoon | 3:2a3664dc6634 | 183 | * \brief FrameId trait. In the default implementation pointer() |
Jeonghoon | 3:2a3664dc6634 | 184 | * returns &m.header.frame_id if HasHeader<M>::value is true, otherwise returns NULL. value() |
Jeonghoon | 3:2a3664dc6634 | 185 | * does not exist, and causes a compile error |
Jeonghoon | 3:2a3664dc6634 | 186 | */ |
Jeonghoon | 3:2a3664dc6634 | 187 | template<typename M, typename Enable = void> |
Jeonghoon | 3:2a3664dc6634 | 188 | struct FrameId |
Jeonghoon | 3:2a3664dc6634 | 189 | { |
Jeonghoon | 3:2a3664dc6634 | 190 | static std::string* pointer(M& m) { (void)m; return 0; } |
Jeonghoon | 3:2a3664dc6634 | 191 | static std::string const* pointer(const M& m) { (void)m; return 0; } |
Jeonghoon | 3:2a3664dc6634 | 192 | }; |
Jeonghoon | 3:2a3664dc6634 | 193 | |
Jeonghoon | 3:2a3664dc6634 | 194 | template<typename M> |
Jeonghoon | 3:2a3664dc6634 | 195 | struct FrameId<M, typename boost::enable_if<HasHeader<M> >::type > |
Jeonghoon | 3:2a3664dc6634 | 196 | { |
Jeonghoon | 3:2a3664dc6634 | 197 | static std::string* pointer(M& m) { return &m.header.frame_id; } |
Jeonghoon | 3:2a3664dc6634 | 198 | static std::string const* pointer(const M& m) { return &m.header.frame_id; } |
Jeonghoon | 3:2a3664dc6634 | 199 | static std::string value(const M& m) { return m.header.frame_id; } |
Jeonghoon | 3:2a3664dc6634 | 200 | }; |
Jeonghoon | 3:2a3664dc6634 | 201 | |
Jeonghoon | 3:2a3664dc6634 | 202 | /** |
Jeonghoon | 3:2a3664dc6634 | 203 | * \brief TimeStamp trait. In the default implementation pointer() |
Jeonghoon | 3:2a3664dc6634 | 204 | * returns &m.header.stamp if HasHeader<M>::value is true, otherwise returns NULL. value() |
Jeonghoon | 3:2a3664dc6634 | 205 | * does not exist, and causes a compile error |
Jeonghoon | 3:2a3664dc6634 | 206 | */ |
Jeonghoon | 3:2a3664dc6634 | 207 | template<typename M, typename Enable = void> |
Jeonghoon | 3:2a3664dc6634 | 208 | struct TimeStamp |
Jeonghoon | 3:2a3664dc6634 | 209 | { |
Jeonghoon | 3:2a3664dc6634 | 210 | static ros::Time* pointer(M& m) { (void)m; return 0; } |
Jeonghoon | 3:2a3664dc6634 | 211 | static ros::Time const* pointer(const M& m) { (void)m; return 0; } |
Jeonghoon | 3:2a3664dc6634 | 212 | }; |
Jeonghoon | 3:2a3664dc6634 | 213 | |
Jeonghoon | 3:2a3664dc6634 | 214 | template<typename M> |
Jeonghoon | 3:2a3664dc6634 | 215 | struct TimeStamp<M, typename boost::enable_if<HasHeader<M> >::type > |
Jeonghoon | 3:2a3664dc6634 | 216 | { |
Jeonghoon | 3:2a3664dc6634 | 217 | static ros::Time* pointer(typename boost::remove_const<M>::type &m) { return &m.header.stamp; } |
Jeonghoon | 3:2a3664dc6634 | 218 | static ros::Time const* pointer(const M& m) { return &m.header.stamp; } |
Jeonghoon | 3:2a3664dc6634 | 219 | static ros::Time value(const M& m) { return m.header.stamp; } |
Jeonghoon | 3:2a3664dc6634 | 220 | }; |
Jeonghoon | 3:2a3664dc6634 | 221 | |
Jeonghoon | 3:2a3664dc6634 | 222 | /** |
Jeonghoon | 3:2a3664dc6634 | 223 | * \brief returns MD5Sum<M>::value(); |
Jeonghoon | 3:2a3664dc6634 | 224 | */ |
Jeonghoon | 3:2a3664dc6634 | 225 | template<typename M> |
Jeonghoon | 3:2a3664dc6634 | 226 | inline const char* md5sum() |
Jeonghoon | 3:2a3664dc6634 | 227 | { |
Jeonghoon | 3:2a3664dc6634 | 228 | return MD5Sum<typename boost::remove_reference<typename boost::remove_const<M>::type>::type>::value(); |
Jeonghoon | 3:2a3664dc6634 | 229 | } |
Jeonghoon | 3:2a3664dc6634 | 230 | |
Jeonghoon | 3:2a3664dc6634 | 231 | /** |
Jeonghoon | 3:2a3664dc6634 | 232 | * \brief returns DataType<M>::value(); |
Jeonghoon | 3:2a3664dc6634 | 233 | */ |
Jeonghoon | 3:2a3664dc6634 | 234 | template<typename M> |
Jeonghoon | 3:2a3664dc6634 | 235 | inline const char* datatype() |
Jeonghoon | 3:2a3664dc6634 | 236 | { |
Jeonghoon | 3:2a3664dc6634 | 237 | return DataType<typename boost::remove_reference<typename boost::remove_const<M>::type>::type>::value(); |
Jeonghoon | 3:2a3664dc6634 | 238 | } |
Jeonghoon | 3:2a3664dc6634 | 239 | |
Jeonghoon | 3:2a3664dc6634 | 240 | /** |
Jeonghoon | 3:2a3664dc6634 | 241 | * \brief returns Definition<M>::value(); |
Jeonghoon | 3:2a3664dc6634 | 242 | */ |
Jeonghoon | 3:2a3664dc6634 | 243 | template<typename M> |
Jeonghoon | 3:2a3664dc6634 | 244 | inline const char* definition() |
Jeonghoon | 3:2a3664dc6634 | 245 | { |
Jeonghoon | 3:2a3664dc6634 | 246 | return Definition<typename boost::remove_reference<typename boost::remove_const<M>::type>::type>::value(); |
Jeonghoon | 3:2a3664dc6634 | 247 | } |
Jeonghoon | 3:2a3664dc6634 | 248 | |
Jeonghoon | 3:2a3664dc6634 | 249 | /** |
Jeonghoon | 3:2a3664dc6634 | 250 | * \brief returns MD5Sum<M>::value(m); |
Jeonghoon | 3:2a3664dc6634 | 251 | */ |
Jeonghoon | 3:2a3664dc6634 | 252 | template<typename M> |
Jeonghoon | 3:2a3664dc6634 | 253 | inline const char* md5sum(const M& m) |
Jeonghoon | 3:2a3664dc6634 | 254 | { |
Jeonghoon | 3:2a3664dc6634 | 255 | return MD5Sum<typename boost::remove_reference<typename boost::remove_const<M>::type>::type>::value(m); |
Jeonghoon | 3:2a3664dc6634 | 256 | } |
Jeonghoon | 3:2a3664dc6634 | 257 | |
Jeonghoon | 3:2a3664dc6634 | 258 | /** |
Jeonghoon | 3:2a3664dc6634 | 259 | * \brief returns DataType<M>::value(m); |
Jeonghoon | 3:2a3664dc6634 | 260 | */ |
Jeonghoon | 3:2a3664dc6634 | 261 | template<typename M> |
Jeonghoon | 3:2a3664dc6634 | 262 | inline const char* datatype(const M& m) |
Jeonghoon | 3:2a3664dc6634 | 263 | { |
Jeonghoon | 3:2a3664dc6634 | 264 | return DataType<typename boost::remove_reference<typename boost::remove_const<M>::type>::type>::value(m); |
Jeonghoon | 3:2a3664dc6634 | 265 | } |
Jeonghoon | 3:2a3664dc6634 | 266 | |
Jeonghoon | 3:2a3664dc6634 | 267 | /** |
Jeonghoon | 3:2a3664dc6634 | 268 | * \brief returns Definition<M>::value(m); |
Jeonghoon | 3:2a3664dc6634 | 269 | */ |
Jeonghoon | 3:2a3664dc6634 | 270 | template<typename M> |
Jeonghoon | 3:2a3664dc6634 | 271 | inline const char* definition(const M& m) |
Jeonghoon | 3:2a3664dc6634 | 272 | { |
Jeonghoon | 3:2a3664dc6634 | 273 | return Definition<typename boost::remove_reference<typename boost::remove_const<M>::type>::type>::value(m); |
Jeonghoon | 3:2a3664dc6634 | 274 | } |
Jeonghoon | 3:2a3664dc6634 | 275 | |
Jeonghoon | 3:2a3664dc6634 | 276 | /** |
Jeonghoon | 3:2a3664dc6634 | 277 | * \brief returns Header<M>::pointer(m); |
Jeonghoon | 3:2a3664dc6634 | 278 | */ |
Jeonghoon | 3:2a3664dc6634 | 279 | template<typename M> |
Jeonghoon | 3:2a3664dc6634 | 280 | inline std_msgs::Header* header(M& m) |
Jeonghoon | 3:2a3664dc6634 | 281 | { |
Jeonghoon | 3:2a3664dc6634 | 282 | return Header<typename boost::remove_reference<typename boost::remove_const<M>::type>::type>::pointer(m); |
Jeonghoon | 3:2a3664dc6634 | 283 | } |
Jeonghoon | 3:2a3664dc6634 | 284 | |
Jeonghoon | 3:2a3664dc6634 | 285 | /** |
Jeonghoon | 3:2a3664dc6634 | 286 | * \brief returns Header<M>::pointer(m); |
Jeonghoon | 3:2a3664dc6634 | 287 | */ |
Jeonghoon | 3:2a3664dc6634 | 288 | template<typename M> |
Jeonghoon | 3:2a3664dc6634 | 289 | inline std_msgs::Header const* header(const M& m) |
Jeonghoon | 3:2a3664dc6634 | 290 | { |
Jeonghoon | 3:2a3664dc6634 | 291 | return Header<typename boost::remove_reference<typename boost::remove_const<M>::type>::type>::pointer(m); |
Jeonghoon | 3:2a3664dc6634 | 292 | } |
Jeonghoon | 3:2a3664dc6634 | 293 | |
Jeonghoon | 3:2a3664dc6634 | 294 | /** |
Jeonghoon | 3:2a3664dc6634 | 295 | * \brief returns FrameId<M>::pointer(m); |
Jeonghoon | 3:2a3664dc6634 | 296 | */ |
Jeonghoon | 3:2a3664dc6634 | 297 | template<typename M> |
Jeonghoon | 3:2a3664dc6634 | 298 | inline std::string* frameId(M& m) |
Jeonghoon | 3:2a3664dc6634 | 299 | { |
Jeonghoon | 3:2a3664dc6634 | 300 | return FrameId<typename boost::remove_reference<typename boost::remove_const<M>::type>::type>::pointer(m); |
Jeonghoon | 3:2a3664dc6634 | 301 | } |
Jeonghoon | 3:2a3664dc6634 | 302 | |
Jeonghoon | 3:2a3664dc6634 | 303 | /** |
Jeonghoon | 3:2a3664dc6634 | 304 | * \brief returns FrameId<M>::pointer(m); |
Jeonghoon | 3:2a3664dc6634 | 305 | */ |
Jeonghoon | 3:2a3664dc6634 | 306 | template<typename M> |
Jeonghoon | 3:2a3664dc6634 | 307 | inline std::string const* frameId(const M& m) |
Jeonghoon | 3:2a3664dc6634 | 308 | { |
Jeonghoon | 3:2a3664dc6634 | 309 | return FrameId<typename boost::remove_reference<typename boost::remove_const<M>::type>::type>::pointer(m); |
Jeonghoon | 3:2a3664dc6634 | 310 | } |
Jeonghoon | 3:2a3664dc6634 | 311 | |
Jeonghoon | 3:2a3664dc6634 | 312 | /** |
Jeonghoon | 3:2a3664dc6634 | 313 | * \brief returns TimeStamp<M>::pointer(m); |
Jeonghoon | 3:2a3664dc6634 | 314 | */ |
Jeonghoon | 3:2a3664dc6634 | 315 | template<typename M> |
Jeonghoon | 3:2a3664dc6634 | 316 | inline ros::Time* timeStamp(M& m) |
Jeonghoon | 3:2a3664dc6634 | 317 | { |
Jeonghoon | 3:2a3664dc6634 | 318 | return TimeStamp<typename boost::remove_reference<typename boost::remove_const<M>::type>::type>::pointer(m); |
Jeonghoon | 3:2a3664dc6634 | 319 | } |
Jeonghoon | 3:2a3664dc6634 | 320 | |
Jeonghoon | 3:2a3664dc6634 | 321 | /** |
Jeonghoon | 3:2a3664dc6634 | 322 | * \brief returns TimeStamp<M>::pointer(m); |
Jeonghoon | 3:2a3664dc6634 | 323 | */ |
Jeonghoon | 3:2a3664dc6634 | 324 | template<typename M> |
Jeonghoon | 3:2a3664dc6634 | 325 | inline ros::Time const* timeStamp(const M& m) |
Jeonghoon | 3:2a3664dc6634 | 326 | { |
Jeonghoon | 3:2a3664dc6634 | 327 | return TimeStamp<typename boost::remove_reference<typename boost::remove_const<M>::type>::type>::pointer(m); |
Jeonghoon | 3:2a3664dc6634 | 328 | } |
Jeonghoon | 3:2a3664dc6634 | 329 | |
Jeonghoon | 3:2a3664dc6634 | 330 | /** |
Jeonghoon | 3:2a3664dc6634 | 331 | * \brief returns IsSimple<M>::value; |
Jeonghoon | 3:2a3664dc6634 | 332 | */ |
Jeonghoon | 3:2a3664dc6634 | 333 | template<typename M> |
Jeonghoon | 3:2a3664dc6634 | 334 | inline bool isSimple() |
Jeonghoon | 3:2a3664dc6634 | 335 | { |
Jeonghoon | 3:2a3664dc6634 | 336 | return IsSimple<typename boost::remove_reference<typename boost::remove_const<M>::type>::type>::value; |
Jeonghoon | 3:2a3664dc6634 | 337 | } |
Jeonghoon | 3:2a3664dc6634 | 338 | |
Jeonghoon | 3:2a3664dc6634 | 339 | /** |
Jeonghoon | 3:2a3664dc6634 | 340 | * \brief returns IsFixedSize<M>::value; |
Jeonghoon | 3:2a3664dc6634 | 341 | */ |
Jeonghoon | 3:2a3664dc6634 | 342 | template<typename M> |
Jeonghoon | 3:2a3664dc6634 | 343 | inline bool isFixedSize() |
Jeonghoon | 3:2a3664dc6634 | 344 | { |
Jeonghoon | 3:2a3664dc6634 | 345 | return IsFixedSize<typename boost::remove_reference<typename boost::remove_const<M>::type>::type>::value; |
Jeonghoon | 3:2a3664dc6634 | 346 | } |
Jeonghoon | 3:2a3664dc6634 | 347 | |
Jeonghoon | 3:2a3664dc6634 | 348 | /** |
Jeonghoon | 3:2a3664dc6634 | 349 | * \brief returns HasHeader<M>::value; |
Jeonghoon | 3:2a3664dc6634 | 350 | */ |
Jeonghoon | 3:2a3664dc6634 | 351 | template<typename M> |
Jeonghoon | 3:2a3664dc6634 | 352 | inline bool hasHeader() |
Jeonghoon | 3:2a3664dc6634 | 353 | { |
Jeonghoon | 3:2a3664dc6634 | 354 | return HasHeader<typename boost::remove_reference<typename boost::remove_const<M>::type>::type>::value; |
Jeonghoon | 3:2a3664dc6634 | 355 | } |
Jeonghoon | 3:2a3664dc6634 | 356 | |
Jeonghoon | 3:2a3664dc6634 | 357 | } // namespace message_traits |
Jeonghoon | 3:2a3664dc6634 | 358 | } // namespace ros |
Jeonghoon | 3:2a3664dc6634 | 359 | |
Jeonghoon | 3:2a3664dc6634 | 360 | #endif // ROSLIB_MESSAGE_TRAITS_H |