route_serializer.h
Go to the documentation of this file.
00001 // *****************************************************************************
00002 //
00003 // Copyright (c) 2016, Southwest Research Institute® (SwRI®)
00004 // All rights reserved.
00005 //
00006 // Redistribution and use in source and binary forms, with or without
00007 // modification, are permitted provided that the following conditions are met:
00008 //     * Redistributions of source code must retain the above copyright
00009 //       notice, this list of conditions and the following disclaimer.
00010 //     * Redistributions in binary form must reproduce the above copyright
00011 //       notice, this list of conditions and the following disclaimer in the
00012 //       documentation and/or other materials provided with the distribution.
00013 //     * Neither the name of Southwest Research Institute® (SwRI®) nor the
00014 //       names of its contributors may be used to endorse or promote products
00015 //       derived from this software without specific prior written permission.
00016 //
00017 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00018 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00019 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00020 // ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
00021 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00022 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00023 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00024 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00025 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00026 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027 //
00028 // *****************************************************************************
00029 
00030 #include <ros/message_traits.h>
00031 #include <ros/serialization.h>
00032 
00033 namespace ros
00034 {
00035 namespace message_traits
00036 {
00037 // http://wiki.ros.org/roscpp/Overview/MessagesSerializationAndAdaptingTypes
00038 // http://wiki.ros.org/roscpp/Overview/MessagesTraits
00039 
00040 // This type is not fixed-size.
00041 template<> struct IsFixedSize<swri_route_util::Route> : public FalseType {};
00042 // This type is memcpyable
00043 template<> struct IsSimple<swri_route_util::Route> : public TrueType {};
00044 // This type has a header
00045 template<> struct HasHeader<swri_route_util::Route> : public TrueType {};
00046 
00047 template<>
00048 struct MD5Sum<swri_route_util::Route>
00049 {
00050   static const char* value()
00051   {
00052     // Ensure that if the definition of marti_nav_msgs::Route changes
00053     // we have a compile error here.
00054     ROS_STATIC_ASSERT(MD5Sum<marti_nav_msgs::Route>::static_value1 == 0x626dfe06202116afULL);
00055     ROS_STATIC_ASSERT(MD5Sum<marti_nav_msgs::Route>::static_value2 == 0xac99e6de9fa42b3eULL);
00056     return MD5Sum<marti_nav_msgs::Route>::value();
00057   }
00058 
00059   static const char* value(const swri_route_util::Route& m)
00060   {
00061     return MD5Sum<swri_route_util::Route>::value();
00062   }
00063 };  // struct MD5Sum<swri_route_util::Route>
00064 
00065 template<>
00066 struct DataType<swri_route_util::Route>
00067 {
00068   static const char* value()
00069   {
00070     return DataType<marti_nav_msgs::Route>::value();
00071   }
00072 
00073   static const char* value(const swri_route_util::Route& m)
00074   {
00075     return DataType<swri_route_util::Route>::value();
00076   }
00077 };  // struct DataType<swri_route_util::Route>
00078 
00079 template<>
00080 struct Definition<swri_route_util::Route>
00081 {
00082   static const char* value()
00083   {
00084     return Definition<marti_nav_msgs::Route>::value();
00085   }
00086 
00087   static const char* value(const swri_route_util::Route& m)
00088   {
00089     return Definition<swri_route_util::Route>::value();
00090   }
00091 };  // struct Definition<swri_route_util::Route>
00092 }  // namespace message_traits
00093 
00094 namespace serialization
00095 {
00096 template<>
00097 struct Serializer<swri_route_util::Route>
00098 {
00099   template<typename Stream>
00100   inline static void write(Stream& stream, const swri_route_util::Route& route)
00101   {
00102     marti_nav_msgs::Route msg;
00103     route.toMsg(msg);
00104     stream.next(msg);
00105   }
00106 
00107   template<typename Stream>
00108   inline static void read(Stream& stream, swri_route_util::Route& route)
00109   {
00110     marti_nav_msgs::Route msg;
00111     stream.next(msg);
00112     route = swri_route_util::Route(msg);
00113   }
00114 
00115   inline static uint32_t serializedLength(const swri_route_util::Route& route)
00116   {
00117     marti_nav_msgs::Route msg;
00118     route.toMsg(msg);
00119     return serializationLength(msg);
00120   }
00121 };
00122 }  // namespace serialization
00123 }  // namespace ros


swri_route_util
Author(s):
autogenerated on Thu Jun 6 2019 20:35:04