Ariles
helpers.h
Go to the documentation of this file.
1 /**
2  @file
3  @author Alexander Sherikov
4 
5  @copyright 2017-2018 Alexander Sherikov, Licensed under the Apache License, Version 2.0.
6  (see @ref LICENSE or http://www.apache.org/licenses/LICENSE-2.0)
7 
8  @brief
9 */
10 
11 #pragma once
12 
13 #include <string>
14 #include <fstream>
15 #include <stdexcept>
16 #include <cmath>
17 #include <cstdlib>
18 #include <complex>
19 
20 
21 #if __cplusplus >= 201103L
22 
23 # include <type_traits>
24 # include <memory>
25 
26 # define ARILES2_IS_ENUM_ENABLER(Enum) const typename std::enable_if<(std::is_enum<Enum>::value)>::type * = NULL
27 
28 # define ARILES2_IS_FLOATING_POINT_ENABLER_TYPE(Real) std::enable_if<(std::is_floating_point<Real>::value)>::type *
29 
30 # define ARILES2_IS_BASE_OF(Base, Derived) std::is_base_of<Base, Derived>::value
31 
32 # define ARILES2_IS_BASE_ENABLER(Base, Derived) \
33  const typename std::enable_if<(ARILES2_IS_BASE_OF(Base, Derived))>::type * = NULL
34 
35 # define ARILES2_IS_BASE_DISABLER(Base, Derived) \
36  const typename std::enable_if<not(ARILES2_IS_BASE_OF(Base, Derived))>::type * = NULL
37 
38 # define ARILES2_IS_ANY_OF(Type, Type1, Type2) \
39  const typename std::enable_if< \
40  std::is_base_of<Type1, Type>::value or std::is_base_of<Type2, Type>::value>::type * = NULL
41 
42 # define ARILES2_SHARED_PTR std::shared_ptr
43 
44 #else
45 
46 # include <boost/utility/enable_if.hpp>
47 # include <boost/type_traits/is_enum.hpp>
48 # include <boost/type_traits/is_base_of.hpp>
49 # include <boost/type_traits/is_floating_point.hpp>
50 # include <boost/smart_ptr/shared_ptr.hpp>
51 
52 # define ARILES2_IS_ENUM_ENABLER(Enum) \
53  const typename boost::enable_if_c<(boost::is_enum<Enum>::value)>::type * = NULL
54 
55 # define ARILES2_IS_FLOATING_POINT_ENABLER_TYPE(Real) \
56  boost::enable_if_c<(boost::is_floating_point<Real>::value)>::type *
57 
58 # define ARILES2_IS_BASE_OF(Base, Derived) boost::is_base_of<Base, Derived>::value
59 
60 # define ARILES2_IS_BASE_ENABLER(Base, Derived) \
61  const typename boost::enable_if_c<(ARILES2_IS_BASE_OF(Base, Derived))>::type * = NULL
62 
63 # define ARILES2_IS_BASE_DISABLER(Base, Derived) \
64  const typename boost::enable_if_c<not(ARILES2_IS_BASE_OF(Base, Derived))>::type * = NULL
65 
66 # define ARILES2_IS_ANY_OF(Type, Type1, Type2) \
67  const typename boost::enable_if_c< \
68  boost::is_base_of<Type1, Type>::value or boost::is_base_of<Type2, Type>::value>::type * = NULL
69 
70 # define ARILES2_SHARED_PTR boost::shared_ptr
71 
72 #endif
73 
74 
75 #include "build_config.h"
76 
77 #define CMAKEUT_COMPILER_SUPPORTS_FUNC_
78 #include "cpput_config.h"
79 #include "cpput_exception.h"
80 #include "cpput_misc.h"
81 
82 
83 #define ARILES2_EMPTY_MACRO
84 
85 
86 #if __cplusplus >= 201103L
87 # define ARILES2_BASIC_SIGNED_INTEGER_TYPES_LIST \
88  ARILES2_BASIC_TYPE(int) \
89  ARILES2_BASIC_TYPE(short) \
90  ARILES2_BASIC_TYPE(long) \
91  ARILES2_BASIC_TYPE(long long) \
92  ARILES2_BASIC_TYPE(char)
93 
94 # define ARILES2_BASIC_UNSIGNED_INTEGER_TYPES_LIST \
95  ARILES2_BASIC_TYPE(unsigned int) \
96  ARILES2_BASIC_TYPE(unsigned short) \
97  ARILES2_BASIC_TYPE(unsigned long) \
98  ARILES2_BASIC_TYPE(unsigned long long) \
99  ARILES2_BASIC_TYPE(unsigned char)
100 #else
101 # define ARILES2_BASIC_SIGNED_INTEGER_TYPES_LIST \
102  ARILES2_BASIC_TYPE(int) \
103  ARILES2_BASIC_TYPE(short) \
104  ARILES2_BASIC_TYPE(long) \
105  ARILES2_BASIC_TYPE(char)
106 
107 # define ARILES2_BASIC_UNSIGNED_INTEGER_TYPES_LIST \
108  ARILES2_BASIC_TYPE(unsigned int) \
109  ARILES2_BASIC_TYPE(unsigned short) \
110  ARILES2_BASIC_TYPE(unsigned long) \
111  ARILES2_BASIC_TYPE(unsigned char)
112 #endif
113 
114 #define ARILES2_BASIC_INTEGER_TYPES_LIST \
115  ARILES2_BASIC_SIGNED_INTEGER_TYPES_LIST \
116  ARILES2_BASIC_UNSIGNED_INTEGER_TYPES_LIST
117 
118 #define ARILES2_BASIC_REAL_TYPES_LIST \
119  ARILES2_BASIC_TYPE(float) \
120  ARILES2_BASIC_TYPE(double)
121 
122 #define ARILES2_BASIC_NUMERIC_TYPES_LIST \
123  ARILES2_BASIC_INTEGER_TYPES_LIST \
124  ARILES2_BASIC_REAL_TYPES_LIST \
125  ARILES2_BASIC_TYPE(bool)
126 
127 #define ARILES2_COMPLEX_NUMBER_TYPES_LIST \
128  ARILES2_BASIC_TYPE(std::complex<float>) \
129  ARILES2_BASIC_TYPE(std::complex<double>)
130 
131 #define ARILES2_BASIC_TYPES_LIST \
132  ARILES2_BASIC_NUMERIC_TYPES_LIST \
133  ARILES2_BASIC_TYPE(std::string)
134 
135 
136 #ifndef ARILES2_VISIBILITY_ATTRIBUTE
137 # include "cpput_visibility.h"
138 # define ARILES2_VISIBILITY_ATTRIBUTE ARILES2_LIB_EXPORT
139 #endif
140 
141 
142 // #define ARILES2_TRACE_ENABLE
143 #include "cpput_trace.h"
144 
145 
146 namespace ariles2
147 {
148  // intentionally not defined
149  template <class t_Pointer>
151 
152 
154  {
155  protected:
157  {
158  }
160  {
161  }
162 
163  public:
164  virtual const std::string &arilesDefaultID() const = 0;
165  };
166 } // namespace ariles2
ariles2
Definition: basic.h:16
ariles2::PointerHandler
class ARILES2_VISIBILITY_ATTRIBUTE PointerHandler
Definition: helpers.h:150
ariles2::Ariles
Definition: helpers.h:153
ariles2::Ariles::~Ariles
~Ariles()
Definition: helpers.h:156
ARILES2_VISIBILITY_ATTRIBUTE
#define ARILES2_VISIBILITY_ATTRIBUTE
Definition: helpers.h:138
ariles2::Ariles::Ariles
Ariles()
Definition: helpers.h:159