route_serializer.h
Go to the documentation of this file.
1 // *****************************************************************************
2 //
3 // Copyright (c) 2016, Southwest Research Institute® (SwRI®)
4 // All rights reserved.
5 //
6 // Redistribution and use in source and binary forms, with or without
7 // modification, are permitted provided that the following conditions are met:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of Southwest Research Institute® (SwRI®) nor the
14 // names of its contributors may be used to endorse or promote products
15 // derived from this software without specific prior written permission.
16 //
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 // ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
21 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 //
28 // *****************************************************************************
29 
30 #include <ros/message_traits.h>
31 #include <ros/serialization.h>
32 
33 namespace ros
34 {
35 namespace message_traits
36 {
37 // http://wiki.ros.org/roscpp/Overview/MessagesSerializationAndAdaptingTypes
38 // http://wiki.ros.org/roscpp/Overview/MessagesTraits
39 
40 // This type is not fixed-size.
41 template<> struct IsFixedSize<swri_route_util::Route> : public FalseType {};
42 // This type is memcpyable
43 template<> struct IsSimple<swri_route_util::Route> : public TrueType {};
44 // This type has a header
45 template<> struct HasHeader<swri_route_util::Route> : public TrueType {};
46 
47 template<>
48 struct MD5Sum<swri_route_util::Route>
49 {
50  static const char* value()
51  {
52  // Ensure that if the definition of marti_nav_msgs::Route changes
53  // we have a compile error here.
57  }
58 
59  static const char* value(const swri_route_util::Route& m)
60  {
62  }
63 }; // struct MD5Sum<swri_route_util::Route>
64 
65 template<>
66 struct DataType<swri_route_util::Route>
67 {
68  static const char* value()
69  {
71  }
72 
73  static const char* value(const swri_route_util::Route& m)
74  {
76  }
77 }; // struct DataType<swri_route_util::Route>
78 
79 template<>
80 struct Definition<swri_route_util::Route>
81 {
82  static const char* value()
83  {
85  }
86 
87  static const char* value(const swri_route_util::Route& m)
88  {
90  }
91 }; // struct Definition<swri_route_util::Route>
92 } // namespace message_traits
93 
94 namespace serialization
95 {
96 template<>
98 {
99  template<typename Stream>
100  inline static void write(Stream& stream, const swri_route_util::Route& route)
101  {
102  marti_nav_msgs::Route msg;
103  route.toMsg(msg);
104  stream.next(msg);
105  }
106 
107  template<typename Stream>
108  inline static void read(Stream& stream, swri_route_util::Route& route)
109  {
110  marti_nav_msgs::Route msg;
111  stream.next(msg);
112  route = swri_route_util::Route(msg);
113  }
114 
115  inline static uint32_t serializedLength(const swri_route_util::Route& route)
116  {
117  marti_nav_msgs::Route msg;
118  route.toMsg(msg);
119  return serializationLength(msg);
120  }
121 };
122 } // namespace serialization
123 } // namespace ros
msg
static const char * value(const swri_route_util::Route &m)
static void read(Stream &stream, swri_route_util::Route &route)
#define ROS_STATIC_ASSERT(cond)
static const char * value()
static const char * value(const swri_route_util::Route &m)
void toMsg(marti_nav_msgs::Route &msg) const
Definition: route.cpp:84
static const char * value()
static const char * value()
static const char * value(const swri_route_util::Route &m)
uint32_t serializationLength(const T &t)
static void write(Stream &stream, const swri_route_util::Route &route)
static uint32_t serializedLength(const swri_route_util::Route &route)


swri_route_util
Author(s):
autogenerated on Tue Apr 6 2021 02:50:48