MessageSerializer.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright (C) 2014 by Ralf Kaestner *
3  * ralf.kaestner@gmail.com *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the Lesser GNU General Public License as published by*
7  * the Free Software Foundation; either version 3 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * Lesser GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the Lesser GNU General Public License *
16  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
17  ******************************************************************************/
18 
23 #ifndef VARIANT_TOPIC_TOOLS_MESSAGE_SERIALIZER_H
24 #define VARIANT_TOPIC_TOOLS_MESSAGE_SERIALIZER_H
25 
29 
30 namespace variant_topic_tools {
34  public Serializer {
35  friend class MessageDataType;
36  friend class MessageVariant;
37  public:
41 
45 
48  MessageSerializer(const Serializer& src);
49 
53 
54  protected:
57  class Impl :
58  public virtual Serializer::Impl {
59  public:
62  Impl();
63 
66  virtual ~Impl();
67  };
68 
71  class ImplV :
72  public Impl {
73  public:
76  ImplV(const MessageFieldCollection<Serializer>& memberSerializers =
78 
81  virtual ~ImplV();
82 
86  size_t getSerializedLength(const Variant& value) const;
87 
90  void serialize(ros::serialization::OStream& stream, const
91  Variant& value);
92 
95  void deserialize(ros::serialization::IStream& stream, Variant& value);
96 
100  };
101 
105  template <typename T> class ImplT :
106  public Impl {
107  public:
108  BOOST_STATIC_ASSERT(type_traits::IsMessage<T>::value);
109 
113 
116  ImplT();
117 
120  virtual ~ImplT();
121 
125  size_t getSerializedLength(const Variant& value) const;
126 
129  void serialize(ros::serialization::OStream& stream, const
130  Variant& value);
131 
134  void deserialize(ros::serialization::IStream& stream, Variant& value);
135  };
136 
141  memberSerializers);
142 
143 
146  template <typename T> static MessageSerializer create();
147  };
148 };
149 
150 #include <variant_topic_tools/MessageSerializer.tpp>
151 
152 #endif
Header file providing the Serializer class interface.
type_traits::MessageType< T >::ValueType ValueType
Definition of the value type.
Message serializer implementation (variant-typed version)
Header file providing the MessageFieldCollection class interface.
MessageFieldCollection< Serializer > memberSerializers
The message member serializers.
virtual size_t getSerializedLength(const Variant &value) const =0
Retrieve the serialized length of a variant value (abstract declaration)
virtual void deserialize(ros::serialization::IStream &stream, Variant &value)=0
Deserialize a variant value (abstract declaration)
Serializer implementation.
Definition: Serializer.h:88
Header file providing the message type traits.
virtual void serialize(ros::serialization::OStream &stream, const Variant &value)=0
Serialize a variant value (abstract declaration)
Message serializer implementation (templated strong-typed version)
Message serializer implementation.
static MessageSerializer create()
Create a message serializer.
Forward declaration of the message field collection.
Definition: Forwards.h:64


variant_topic_tools
Author(s): Ralf Kaestner
autogenerated on Sat Jan 9 2021 03:56:49