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 
19 
20 #if __cplusplus >= 201103L
21 
22 # include <type_traits>
23 # include <memory>
24 
25 # define ARILES_IS_ENUM_ENABLER(Enum) const typename std::enable_if<(std::is_enum<Enum>::value)>::type * = NULL
26 
27 # define ARILES_IS_BASE_OF(Base, Derived) std::is_base_of<Base, Derived>::value
28 
29 # define ARILES_IS_BASE_ENABLER(Base, Derived) \
30  const typename std::enable_if<(ARILES_IS_BASE_OF(Base, Derived))>::type * = NULL
31 
32 # define ARILES_IS_BASE_DISABLER(Base, Derived) \
33  const typename std::enable_if<not(ARILES_IS_BASE_OF(Base, Derived))>::type * = NULL
34 
35 # define ARILES_SHARED_PTR std::shared_ptr
36 
37 #else
38 
39 # include <boost/utility/enable_if.hpp>
40 # include <boost/type_traits/is_enum.hpp>
41 # include <boost/type_traits/is_base_of.hpp>
42 # include <boost/smart_ptr/shared_ptr.hpp>
43 
44 # define ARILES_IS_ENUM_ENABLER(Enum) const typename boost::enable_if_c<(boost::is_enum<Enum>::value)>::type * = NULL
45 
46 # define ARILES_IS_BASE_OF(Base, Derived) boost::is_base_of<Base, Derived>::value
47 
48 # define ARILES_IS_BASE_ENABLER(Base, Derived) \
49  const typename boost::enable_if_c<(ARILES_IS_BASE_OF(Base, Derived))>::type * = NULL
50 
51 # define ARILES_IS_BASE_DISABLER(Base, Derived) \
52  const typename boost::enable_if_c<not(ARILES_IS_BASE_OF(Base, Derived))>::type * = NULL
53 
54 
55 # define ARILES_SHARED_PTR boost::shared_ptr
56 
57 #endif
58 
59 
60 #include "build_config.h"
61 #include "cpput_config.h"
62 #include "cpput_exception.h"
63 #include "cpput_floating_point_utils.h"
64 #include "cpput_misc.h"
65 #include "cpput_flags.h"
66 
67 #ifndef ARILES_VISIBILITY_ATTRIBUTE
68 # include "cpput_visibility.h"
69 # define ARILES_VISIBILITY_ATTRIBUTE ARILES_LIB_EXPORT
70 #endif
71 
72 // #define ARILES_TRACE_ENABLE
73 #include "trace.h"
74 
75 
76 
77 #define ARILES_EMPTY_MACRO
78 
79 
80 #define ARILES_BASIC_SIGNED_INTEGER_TYPES_LIST \
81  ARILES_BASIC_TYPE(int) \
82  ARILES_BASIC_TYPE(short) \
83  ARILES_BASIC_TYPE(long) \
84  ARILES_BASIC_TYPE(char)
85 
86 #define ARILES_BASIC_UNSIGNED_INTEGER_TYPES_LIST \
87  ARILES_BASIC_TYPE(unsigned int) \
88  ARILES_BASIC_TYPE(unsigned short) \
89  ARILES_BASIC_TYPE(unsigned long) \
90  ARILES_BASIC_TYPE(unsigned char)
91 
92 #define ARILES_BASIC_INTEGER_TYPES_LIST \
93  ARILES_BASIC_SIGNED_INTEGER_TYPES_LIST \
94  ARILES_BASIC_UNSIGNED_INTEGER_TYPES_LIST
95 
96 #define ARILES_BASIC_REAL_TYPES_LIST \
97  ARILES_BASIC_TYPE(float) \
98  ARILES_BASIC_TYPE(double)
99 
100 #define ARILES_BASIC_NUMERIC_TYPES_LIST \
101  ARILES_BASIC_INTEGER_TYPES_LIST \
102  ARILES_BASIC_REAL_TYPES_LIST \
103  ARILES_BASIC_TYPE(bool)
104 
105 #define ARILES_BASIC_TYPES_LIST \
106  ARILES_BASIC_NUMERIC_TYPES_LIST \
107  ARILES_BASIC_TYPE(std::string)
108 
109 
110 namespace ariles
111 {
112  // intentionally not defined
113  template <class t_Pointer>
115 
116 
118  {
119  protected:
121  {
122  }
124  {
125  }
126 
127  public:
128  virtual const std::string &arilesDefaultID() const = 0;
129  };
130 } // namespace ariles
class ARILES_VISIBILITY_ATTRIBUTE PointerHandler
Definition: helpers.h:114
#define ARILES_VISIBILITY_ATTRIBUTE
Definition: helpers.h:69
Definition: basic.h:17