BuiltinTypeTraits.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_BUILTIN_TYPE_TRAITS_H
24 #define VARIANT_TOPIC_TOOLS_BUILTIN_TYPE_TRAITS_H
25 
26 #include <string>
27 
28 #include <boost/type_traits.hpp>
29 #include <boost/type_traits/ice.hpp>
30 
31 #include <ros/duration.h>
32 #include <ros/message_traits.h>
33 #include <ros/time.h>
34 
35 namespace variant_topic_tools {
36  namespace type_traits {
37  template <typename T, typename D = void> struct IsBuiltin :
38  public boost::type_traits::ice_or<
39  boost::is_integral<T>::value,
40  boost::is_floating_point<T>::value> {
41  };
42 
43  template <typename D> struct IsBuiltin<std::string, D> :
44  public boost::true_type {
45  };
46 
47  template <typename D> struct IsBuiltin<ros::Duration, D> :
48  public boost::true_type {
49  };
50 
51  template <typename D> struct IsBuiltin<ros::Time, D> :
52  public boost::true_type {
53  };
54 
55  template <typename T, typename D = void> struct BuiltinType {
56  typedef T ValueType;
57  typedef T StreamType;
58  typedef boost::type_traits::ice_or<
59  boost::is_integral<T>::value,
60  boost::is_floating_point<T>::value> IsNumeric;
63  };
64 
65  template <typename D> struct BuiltinType<uint8_t, D> {
66  typedef uint8_t ValueType;
67  typedef uint32_t StreamType;
68  typedef boost::true_type IsNumeric;
71  };
72 
73  template <typename D> struct BuiltinType<int8_t, D> {
74  typedef int8_t ValueType;
75  typedef int32_t StreamType;
76  typedef boost::true_type IsNumeric;
79  };
80 
81  template <typename D> struct BuiltinType<bool, D> {
82  typedef uint8_t ValueType;
83  typedef std::string StreamType;
84  typedef boost::true_type IsNumeric;
87  };
88 
89  template <typename D> struct BuiltinType<ros::Duration, D> {
92  typedef boost::true_type IsNumeric;
95  };
96 
97  template <typename D> struct BuiltinType<ros::Time, D> {
100  typedef boost::true_type IsNumeric;
103  };
104 
105  template <typename T> struct ToBuiltinType {
106  typedef T BuiltinType;
107  };
108 
109  template <size_t N> struct ToBuiltinType<char[N]> {
110  typedef std::string BuiltinType;
111  };
112  };
113 };
114 
115 #endif
ros::message_traits::IsFixedSize< ValueType > IsFixedSize
ros::message_traits::IsSimple< ValueType > IsSimple
ros::message_traits::IsFixedSize< ValueType > IsFixedSize
ros::message_traits::IsSimple< ValueType > IsSimple
ros::message_traits::IsSimple< ValueType > IsSimple
ros::message_traits::IsFixedSize< ValueType > IsFixedSize
boost::type_traits::ice_or< boost::is_integral< T >::value, boost::is_floating_point< T >::value > IsNumeric
ros::message_traits::IsSimple< ValueType > IsSimple
ros::message_traits::IsSimple< ValueType > IsSimple
ros::message_traits::IsFixedSize< ValueType > IsFixedSize
ros::message_traits::IsFixedSize< ValueType > IsFixedSize
ros::message_traits::IsFixedSize< ValueType > IsFixedSize


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