ArrayDataType.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_DATA_TYPE_H
00024 #define VARIANT_TOPIC_TOOLS_ARRAY_DATA_TYPE_H
00025 
00026 #include <variant_topic_tools/ArrayTypeTraits.h>
00027 #include <variant_topic_tools/DataType.h>
00028 
00029 namespace variant_topic_tools {
00032   class ArrayDataType :
00033     public DataType {
00034   friend class ArraySerializer;
00035   friend class ArrayVariant;
00036   friend class DataType;
00037   friend class DataTypeRegistry;
00038   public:
00041     ArrayDataType();
00042     
00045     ArrayDataType(const ArrayDataType& src);
00046     
00049     ArrayDataType(const DataType& src);
00050     
00053     virtual ~ArrayDataType();
00054   
00057     const DataType& getMemberType() const;
00058     
00061     size_t getNumMembers() const;
00062     
00065     bool isDynamic() const;
00066     
00069     ArrayDataType& operator=(const DataType& src);
00070     
00071   protected:
00074     class Impl :
00075       public DataType::Impl {
00076     public:
00079       Impl(const DataType& memberType);
00080       
00083       virtual ~Impl();
00084       
00088       const std::string& getIdentifier() const;
00089     
00093       virtual size_t getNumMembers() const = 0;
00094       
00098       virtual bool isDynamic() const = 0;
00099       
00102       mutable std::string identifier;
00103       
00106       DataType memberType;
00107     };
00108     
00111     class ImplV :
00112       public Impl {
00113     public:
00116       ImplV(const DataType& memberType, size_t numMembers);
00117       
00120       virtual ~ImplV();
00121       
00125       size_t getNumMembers() const;
00126       
00130       size_t getSize() const;
00131       
00135       bool isDynamic() const;
00136       
00140       bool isFixedSize() const;
00141       
00145       bool isSimple() const;
00146       
00149       Serializer createSerializer(const DataType& type) const;
00150       
00153       Variant createVariant(const DataType& type) const;
00154       
00157       size_t numMembers;
00158     };
00159     
00162     template <typename T> class ImplT :
00163       public Impl {
00164     public:
00165       BOOST_STATIC_ASSERT(type_traits::IsArray<T>::value);
00166       
00169       ImplT();
00170       
00173       virtual ~ImplT();
00174       
00178       const std::type_info& getTypeInfo() const;
00179       
00183       size_t getNumMembers() const;
00184       
00188       bool isDynamic() const;
00189       
00193       size_t getSize() const;
00194       
00198       bool isFixedSize() const;
00199       
00203       bool isSimple() const;
00204       
00207       Serializer createSerializer(const DataType& type) const;
00208       
00211       Variant createVariant(const DataType& type) const;
00212     };
00213     
00217     ArrayDataType(const DataType& memberType, size_t numMembers);
00218     
00222     template <typename T> static ArrayDataType create();
00223     
00227     template <typename T, size_t N> static ArrayDataType create(typename
00228       boost::enable_if<boost::type_traits::ice_eq<N, 0> >::type* = 0);
00229     
00233     template <typename T, size_t N> static ArrayDataType create(typename
00234       boost::disable_if<boost::type_traits::ice_eq<N, 0> >::type* = 0);
00235   };
00236 };
00237 
00238 #include <variant_topic_tools/ArrayDataType.tpp>
00239 
00240 #endif


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