ArraySerializer.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_ARRAY_SERIALIZER_H
24 #define VARIANT_TOPIC_TOOLS_ARRAY_SERIALIZER_H
25 
29 
30 namespace variant_topic_tools {
34  public Serializer {
35  friend class ArrayDataType;
36  friend class ArrayVariant;
37  public:
41 
44  ArraySerializer(const ArraySerializer& src);
45 
48  ArraySerializer(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 Serializer& memberSerializer = Serializer(), size_t
77  numMembers = 0);
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 
103  size_t numMembers;
104  };
105 
109  template <typename T> class ImplT :
110  public Impl {
111  public:
112  BOOST_STATIC_ASSERT(type_traits::IsArray<T>::value);
113 
117 
120  ImplT();
121 
124  virtual ~ImplT();
125 
129  size_t getSerializedLength(const Variant& value) const;
130 
133  void serialize(ros::serialization::OStream& stream, const
134  Variant& value);
135 
138  void deserialize(ros::serialization::IStream& stream, Variant& value);
139  };
140 
144  ArraySerializer(const Serializer& memberSerializer, size_t numMembers);
145 
148  template <typename T> static ArraySerializer create();
149  };
150 };
151 
152 #include <variant_topic_tools/ArraySerializer.tpp>
153 
154 #endif
Header file providing the DataType class interface.
Array serializer implementation (templated strong-typed version)
size_t numMembers
The number of array members.
Header file providing the Serializer class interface.
Array serializer implementation.
Header file providing the array type traits.
static ArraySerializer create()
Create an array serializer.
ArraySerializer()
Default constructor.
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
Array serializer implementation (variant-typed version)
virtual void serialize(ros::serialization::OStream &stream, const Variant &value)=0
Serialize a variant value (abstract declaration)
Serializer memberSerializer
The array member serializer.
Serializer()
Default constructor.
Definition: Serializer.cpp:29
type_traits::ArrayType< T >::ValueType ValueType
Definition of the value type.


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