ArraySerializer.h
Go to the documentation of this file.
00001 /******************************************************************************
00002  * Copyright (C) 2014 by Ralf Kaestner                                        *
00003  * ralf.kaestner@gmail.com                                                    *
00004  *                                                                            *
00005  * This program is free software; you can redistribute it and/or modify       *
00006  * it under the terms of the Lesser GNU General Public License as published by*
00007  * the Free Software Foundation; either version 3 of the License, or          *
00008  * (at your option) any later version.                                        *
00009  *                                                                            *
00010  * This program is distributed in the hope that it will be useful,            *
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the               *
00013  * Lesser GNU General Public License for more details.                        *
00014  *                                                                            *
00015  * You should have received a copy of the Lesser GNU General Public License   *
00016  * along with this program. If not, see <http://www.gnu.org/licenses/>.       *
00017  ******************************************************************************/
00018 
00023 #ifndef VARIANT_TOPIC_TOOLS_ARRAY_SERIALIZER_H
00024 #define VARIANT_TOPIC_TOOLS_ARRAY_SERIALIZER_H
00025 
00026 #include <variant_topic_tools/ArrayTypeTraits.h>
00027 #include <variant_topic_tools/DataType.h>
00028 #include <variant_topic_tools/Serializer.h>
00029 
00030 namespace variant_topic_tools {
00033   class ArraySerializer :
00034     public Serializer {
00035   friend class ArrayDataType;
00036   friend class ArrayVariant;
00037   public:
00040     ArraySerializer();
00041     
00044     ArraySerializer(const ArraySerializer& src);
00045     
00048     ArraySerializer(const Serializer& src);
00049     
00052     ~ArraySerializer();
00053     
00054   protected:
00057     class Impl :
00058       public virtual Serializer::Impl {
00059     public:
00062       Impl();
00063       
00066       virtual ~Impl();
00067     };
00068     
00071     class ImplV :
00072       public Impl {
00073     public:
00076       ImplV(const Serializer& memberSerializer = Serializer(), size_t
00077         numMembers = 0);
00078       
00081       virtual ~ImplV();
00082     
00086       size_t getSerializedLength(const Variant& value) const;
00087       
00090       void serialize(ros::serialization::OStream& stream, const
00091         Variant& value);
00092       
00095       void deserialize(ros::serialization::IStream& stream, Variant& value);
00096         
00099       Serializer memberSerializer;
00100       
00103       size_t numMembers;
00104     };
00105     
00109     template <typename T> class ImplT :
00110       public Impl {
00111     public:
00112       BOOST_STATIC_ASSERT(type_traits::IsArray<T>::value);
00113       
00116       typedef typename type_traits::ArrayType<T>::ValueType ValueType;
00117       
00120       ImplT();
00121       
00124       virtual ~ImplT();
00125     
00129       size_t getSerializedLength(const Variant& value) const;
00130       
00133       void serialize(ros::serialization::OStream& stream, const
00134         Variant& value);
00135       
00138       void deserialize(ros::serialization::IStream& stream, Variant& value);        
00139     };
00140     
00144     ArraySerializer(const Serializer& memberSerializer, size_t numMembers);
00145     
00148     template <typename T> static ArraySerializer create();
00149   };
00150 };
00151 
00152 #include <variant_topic_tools/ArraySerializer.tpp>
00153 
00154 #endif


variant_topic_tools
Author(s): Ralf Kaestner
autogenerated on Fri Aug 5 2016 06:06:26