libpnicore
traits.hpp
1 //
2 // (c) Copyright 2014 DESY, Eugen Wintersberger <eugen.wintersberger@desy.de>
3 //
4 // This file is part of libpnicore.
5 //
6 // libpnicore is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation, either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // libpnicore is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with libpnicore. If not, see <http://www.gnu.org/licenses/>.
18 //
19 // ============================================================================
20 //
21 // Created on: Dec 29, 2014
22 // Author: Eugen Wintersberger
23 //
24 #pragma once
25 
26 #include "types.hpp"
27 #include <boost/mpl/contains.hpp>
28 
29 namespace pni{
30 namespace core{
31 
32  //------------------------------------------------------------------------
42  template<typename T> struct is_integer_type
43  {
45  static const bool value = boost::mpl::contains<integer_types,T>::value;
46  };
47 
48  //------------------------------------------------------------------------
58  template<typename T> struct is_float_type
59  {
61  static const bool value = boost::mpl::contains<float_types,T>::value;
62  };
63 
64  //------------------------------------------------------------------------
74  template<typename T> struct is_complex_type
75  {
77  static const bool value = boost::mpl::contains<complex_types,T>::value;
78  };
79 
80  //-------------------------------------------------------------------------
91  template<typename T> struct is_numeric_type
92  {
94  static const bool value = boost::mpl::contains<numeric_types,T>::value;
95  };
96 
97  //-------------------------------------------------------------------------
108  template<typename T> struct is_non_numeric_type
109  {
111  static const bool value =
112  boost::mpl::contains<non_numeric_types,T>::value;
113  };
114 
115  //-------------------------------------------------------------------------
125  template<typename T> struct is_primitive_type
126  {
128  static const bool value =
129  boost::mpl::contains<primitive_types,T>::value;
130  };
131 
132  //------------------------------------------------------------------------
143  bool is_numeric(type_id_t tid);
144 
145  //------------------------------------------------------------------------
156  bool is_integer(type_id_t tid);
157 
158  //------------------------------------------------------------------------
169  bool is_complex(type_id_t tid);
170 
171  //------------------------------------------------------------------------
182  bool is_float(type_id_t tid);
183 
184 //end of namespace
185 }
186 }
check numeric type
Definition: traits.hpp:91
check complex type
Definition: traits.hpp:74
bool is_complex(type_id_t tid)
check complex type
bool is_float(type_id_t tid)
check float type
check non numeric type
Definition: traits.hpp:108
check integer type
Definition: traits.hpp:42
bool is_integer(type_id_t tid)
check integer type
Definition: add_op.hpp:29
check float type
Definition: traits.hpp:58
bool is_numeric(type_id_t tid)
check numeric type
check primitive type
Definition: traits.hpp:125
type_id_t
type codes for PNI data types
Definition: types/types.hpp:148
type erasure for POD data
Definition: value.hpp:46