BuiltinDataType.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_BUILTIN_DATA_TYPE_H
00024 #define VARIANT_TOPIC_TOOLS_BUILTIN_DATA_TYPE_H
00025 
00026 #include <variant_topic_tools/BuiltinTypeTraits.h>
00027 #include <variant_topic_tools/DataType.h>
00028 
00029 namespace variant_topic_tools {
00032   class BuiltinDataType :
00033     public DataType {
00034   friend class DataType;
00035   friend class DataTypeRegistry;
00036   public:
00039     BuiltinDataType();
00040     
00043     BuiltinDataType(const BuiltinDataType& src);
00044     
00047     BuiltinDataType(const DataType& src);
00048     
00051     virtual ~BuiltinDataType();
00052     
00055     BuiltinDataType& operator=(const DataType& src);
00056     
00059     bool isNumeric() const;
00060     
00061   protected:
00064     class Impl :
00065       public DataType::Impl {
00066     public:
00069       Impl(const std::string& identifier);
00070       
00073       virtual ~Impl();
00074       
00078       const std::string& getIdentifier() const;
00079     
00083       virtual bool isNumeric() const = 0;
00084     
00087       std::string identifier;
00088     };
00089     
00093     template <typename T> class ImplT :
00094       public Impl {
00095     public:
00096       BOOST_STATIC_ASSERT(type_traits::IsBuiltin<T>::value);
00097       
00100       ImplT(const std::string& identifier);
00101       
00104       virtual ~ImplT();
00105     
00109       const std::type_info& getTypeInfo() const;
00110       
00114       size_t getSize() const;
00115       
00119       bool isFixedSize() const;
00120       
00124       bool isSimple() const;
00125       
00128       bool isNumeric() const;
00129     
00132       Serializer createSerializer(const DataType& type) const;
00133       
00136       Variant createVariant(const DataType& type) const;
00137     };
00138     
00141     template <typename T> static BuiltinDataType create(const
00142       std::string& identifier);    
00143   };
00144 };
00145 
00146 #include <variant_topic_tools/BuiltinDataType.tpp>
00147 
00148 #endif


variant_topic_tools
Author(s): Ralf Kaestner
autogenerated on Tue Jul 9 2019 03:18:42