DataTypeTraits.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_DATA_TYPE_TRAITS_H
00024 #define VARIANT_TOPIC_TOOLS_DATA_TYPE_TRAITS_H
00025 
00026 #include <boost/type_traits.hpp>
00027 
00028 #include <variant_topic_tools/ArrayTypeTraits.h>
00029 #include <variant_topic_tools/BuiltinTypeTraits.h>
00030 #include <variant_topic_tools/MessageTypeTraits.h>
00031 
00032 namespace variant_topic_tools {
00033   namespace type_traits {
00034     template <typename T, typename Enable = void> struct DataType;
00035     
00036     template <typename T> struct DataType<T, typename boost::
00037         enable_if<IsBuiltin<T> >::type> {
00038       typedef typename BuiltinType<T>::ValueType ValueType;
00039       typedef typename BuiltinType<T>::IsFixedSize IsFixedSize;
00040       typedef typename BuiltinType<T>::IsFixedSize IsSimple;
00041     };
00042     
00043     template <typename T> struct DataType<T, typename boost::
00044         enable_if<IsArray<T> >::type> {
00045       typedef typename ArrayType<T>::ValueType ValueType;
00046       typedef typename ArrayType<T>::IsFixedSize IsFixedSize;
00047       typedef typename ArrayType<T>::IsFixedSize IsSimple;
00048     };    
00049     
00050     template <typename T> struct DataType<T, typename boost::
00051         enable_if<IsMessage<T> >::type> {
00052       typedef typename MessageType<T>::ValueType ValueType;
00053       typedef typename MessageType<T>::IsFixedSize IsFixedSize;
00054       typedef typename MessageType<T>::IsFixedSize IsSimple;
00055     };    
00056     
00057     template <typename T, typename Enable = void> struct ToDataType;
00058     
00059     template <typename T> struct ToDataType<T, typename boost::
00060         enable_if<IsBuiltin<typename ToBuiltinType<T>::BuiltinType> >::type> {
00061       typedef typename ToBuiltinType<T>::BuiltinType DataType;
00062     };
00063     
00064     template <typename T> struct ToDataType<T, typename boost::
00065         enable_if<IsArray<typename ToArrayType<T>::ArrayType> >::type> {
00066       typedef typename ToArrayType<T>::ArrayType DataType;
00067     };
00068     
00069     template <typename T> struct ToDataType<T, typename boost::
00070         enable_if<IsMessage<typename ToMessageType<T>::MessageType> >::type> {
00071       typedef typename ToMessageType<T>::MessageType DataType;
00072     };
00073   };
00074 };
00075 
00076 #endif


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