Robot Raconteur Core C++ Library
RobotRaconteurConfig.h
Go to the documentation of this file.
1 
24 #pragma once
25 
26 #ifndef ROBOTRACONTEUR_VERSION
27 // Boost Style Version Number
28 #define ROBOTRACONTEUR_VERSION 100202
29 #define ROBOTRACONTEUR_VERSION_TEXT "1.2.2"
30 #endif
31 
32 #if (__GNUC__ == 4 && __GNUC_MINOR__ == 7)
33 #error GCC 4.7 is bug riddled and does not produce reliable executables. Use GCC 4.6 or a newer version.
34 #endif
35 
36 #ifndef RR_STD_SHARED_PTR
37 #include <boost/shared_ptr.hpp>
38 #include <boost/make_shared.hpp>
39 #include <boost/enable_shared_from_this.hpp>
40 #include <boost/intrusive_ptr.hpp>
41 
42 #define RR_SHARED_PTR boost::shared_ptr
43 #define RR_MAKE_SHARED boost::make_shared
44 #define RR_WEAK_PTR boost::weak_ptr
45 #define RR_ENABLE_SHARED_FROM_THIS boost::enable_shared_from_this
46 #define RR_DYNAMIC_POINTER_CAST boost::dynamic_pointer_cast
47 #define RR_STATIC_POINTER_CAST boost::static_pointer_cast
48 
49 #else
50 
51 #include <memory>
52 
53 #define RR_SHARED_PTR std::shared_ptr
54 #define RR_MAKE_SHARED std::make_shared
55 #define RR_WEAK_PTR std::weak_ptr
56 #define RR_ENABLE_SHARED_FROM_THIS std::enable_shared_from_this
57 #define RR_DYNAMIC_POINTER_CAST std::dynamic_pointer_cast
58 #define RR_STATIC_POINTER_CAST std::static_pointer_cast
59 
60 #endif
61 
62 #define RR_INTRUSIVE_PTR boost::intrusive_ptr
63 #define RR_INTRUSIVE_PTR boost::intrusive_ptr
64 
65 #define RR_UNORDERED_MAP boost::unordered_map
66 
67 #include <boost/regex.hpp>
68 
69 #ifdef BOOST_WINDOWS
70 #define ROBOTRACONTEUR_WINDOWS
71 #elif defined(__linux__)
72 #define ROBOTRACONTEUR_LINUX
73 #ifdef ANDROID
74 #define ROBOTRACONTEUR_ANDROID
75 #endif
76 #elif defined(__APPLE__)
77 #define ROBOTRACONTEUR_APPLE
78 #if defined(TARGET_OS_IPHONE) || defined(TARGET_IPHONE_SIMULATOR)
79 #define ROBOTRACONTEUR_IOS
80 #else
81 #define ROBOTRACONTEUR_OSX
82 #endif
83 #elif defined(__EMSCRIPTEN__)
84 #define ROBOTRACONTEUR_EMSCRIPTEN
85 #endif
86 
87 #ifndef ROBOTRACONTEUR_EMSCRIPTEN
88 #include <boost/thread.hpp>
89 #include <boost/asio/version.hpp>
90 #include <boost/asio/strand.hpp>
91 #endif
92 
93 #ifdef ROBOTRACONTEUR_WINDOWS
94 #define ROBOTRACONTEUR_PATHSEP "\\"
95 #else
96 #define ROBOTRACONTEUR_PATHSEP "/"
97 #endif
98 
99 #ifdef ROBOTRACONTEUR_WINDOWS
100 #ifdef ROBOTRACONTEUR_CORE_EXPORTS
101 #define ROBOTRACONTEUR_CORE_API __declspec(dllexport)
102 #elif ROBOTRACONTEUR_CORE_IMPORTS
103 #define ROBOTRACONTEUR_CORE_API __declspec(dllimport)
104 #else
105 #define ROBOTRACONTEUR_CORE_API
106 #endif
107 #else
108 #define ROBOTRACONTEUR_CORE_API
109 #endif
110 
111 // Small vector is relatively new
112 #if BOOST_VERSION > 105800
113 #define ROBOTRACONTEUR_USE_SMALL_VECTOR
114 #endif
115 
116 // Use Boost ASIO move detection
117 #ifndef ROBOTRACONTEUR_NO_CXX11
118 #define RR_MOVE_ARG(type) type&&
119 #define RR_MOVE(x) std::move(x)
120 #define RR_FORWARD(type, x) std::forward<type>(x)
121 #else
122 #define RR_MOVE_ARG(type) type
123 #define RR_MOVE(x) x
124 #define RR_FORWARD(type, x) x
125 #endif
126 
127 #if BOOST_ASIO_VERSION < 101200
128 #define RR_BOOST_ASIO_IO_CONTEXT boost::asio::io_service
129 #define RR_BOOST_ASIO_STRAND boost::asio::io_service::strand
130 #define RR_BOOST_ASIO_STRAND2(exec_type) boost::asio::io_service::strand
131 #define RR_BOOST_ASIO_POST(context, func) context.post(func)
132 #define RR_BOOST_ASIO_BUFFER_CAST(type, buf) boost::asio::buffer_cast<type>(buf)
133 #define RR_BOOST_ASIO_STRAND_WRAP(strand, f) (strand).wrap(f)
134 #define RR_BOOST_ASIO_NEW_STRAND(context) (new boost::asio::strand(context))
135 #define RR_BOOST_ASIO_GET_IO_SERVICE(s) (s).get_io_service()
136 #define RR_BOOST_ASIO_REF_IO_SERVICE(x) boost::ref(x)
137 #define RR_BOOST_ASIO_NEW_API_CONST
138 #else
139 #define RR_BOOST_ASIO_IO_CONTEXT boost::asio::io_context
140 #define RR_BOOST_ASIO_STRAND boost::asio::strand<boost::asio::io_context::executor_type>
141 #define RR_BOOST_ASIO_STRAND2(exec_type) boost::asio::strand<exec_type>
142 #define RR_BOOST_ASIO_POST(context, func) boost::asio::post(context, func)
143 #define RR_BOOST_ASIO_BUFFER_CAST(type, buf) (type)(buf).data()
144 #define RR_BOOST_ASIO_STRAND_WRAP(strand, f) boost::asio::bind_executor(strand, f)
145 #define RR_BOOST_ASIO_NEW_STRAND(context) \
146  (new boost::asio::strand<boost::asio::io_context::executor_type>((context).get_executor()))
147 #define RR_BOOST_ASIO_GET_IO_SERVICE(s) (s).get_executor()
148 #define RR_BOOST_ASIO_REF_IO_SERVICE(x) (x)
149 #define RR_BOOST_ASIO_NEW_API_CONST const
150 #endif
151 
152 #if BOOST_ASIO_VERSION < 101200
153 #define RR_BOOST_ASIO_MAKE_STRAND(exec_type, x) boost::asio::strand(x)
154 #elif BOOST_ASIO_VERSION < 101400
155 #define RR_BOOST_ASIO_MAKE_STRAND(exec_type, x) boost::asio::strand<exec_type>(x)
156 #else
157 #define RR_BOOST_ASIO_MAKE_STRAND(exec_type, x) boost::asio::make_strand<exec_type>(x)
158 #endif
159 
160 #if BOOST_VERSION <= 105900
161 #define RR_BOOST_PLACEHOLDERS(arg) arg
162 #else
163 #define RR_BOOST_PLACEHOLDERS(arg) boost::placeholders::arg
164 #endif
165 
166 #if defined(ROBOTRACONTEUR_NO_CXX11) && (__cplusplus < 201103L || defined(BOOST_NO_CXX11_TEMPLATE_ALIASES))
167 #define ROBOTRACONTEUR_NO_CXX11_TEMPLATE_ALIASES
168 #endif
169 
170 #define RR_UNUSED(var_) ((void)(var_))
171 
172 #if !defined(ROBOTRACONTEUR_NO_CXX11) && !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX)
173 #define RR_MEMBER_ARRAY_INIT(x) , x({})
174 #define RR_MEMBER_ARRAY_INIT2(x) : x({})
175 #else
176 #define RR_MEMBER_ARRAY_INIT(x)
177 #define RR_MEMBER_ARRAY_INIT2(x)
178 #endif
179 
180 #ifndef ROBOTRACONTEUR_NO_CXX11
181 #define RR_OVERRIDE override
182 #define RR_OVIRTUAL
183 #else
184 #define RR_OVERRIDE
185 #define RR_OVIRTUAL virtual
186 #endif
187 #define RR_NULL_FN 0
188 
189 #if BOOST_VERSION >= 108400
190 #include <utility>
191 #define RR_SWAP std::swap
192 #else
193 #include <boost/core/swap.hpp>
194 #define RR_SWAP boost::swap
195 #endif
196 
197 #if BOOST_ASIO_VERSION >= 101009
198 #define ROBOTRACONTEUR_BOOST_ASIO_TLS_METHOD boost::asio::ssl::context::tls
199 #define ROBOTRACONTEUR_BOOST_ASIO_TLS_METHOD_HTTPS boost::asio::ssl::context::tls
200 #else
201 #define ROBOTRACONTEUR_BOOST_ASIO_TLS_METHOD boost::asio::ssl::context::tlsv11
202 #define ROBOTRACONTEUR_BOOST_ASIO_TLS_METHOD_HTTPS boost::asio::ssl::context::tlsv12
203 #endif
204 
205 #ifdef ROBOTRACONTEUR_EMSCRIPTEN
206 #include "RobotRaconteurEmscripten.h"
207 #endif