Robot Raconteur Core C++ Library
Loading...
Searching...
No Matches
RobotRaconteurConfig.h
Go to the documentation of this file.
1
23
24#pragma once
25
26#ifndef ROBOTRACONTEUR_VERSION
27// Boost Style Version Number
28#define ROBOTRACONTEUR_VERSION 100208
29#define ROBOTRACONTEUR_VERSION_TEXT "1.2.8"
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#if __APPLE__
70#include "TargetConditionals.h"
71#endif
72
73#ifdef BOOST_WINDOWS
74#define ROBOTRACONTEUR_WINDOWS
75#elif defined(__linux__)
76#define ROBOTRACONTEUR_LINUX
77#ifdef ANDROID
78#define ROBOTRACONTEUR_ANDROID
79#endif
80#elif defined(__APPLE__)
81#define ROBOTRACONTEUR_APPLE
82#if defined(TARGET_OS_IPHONE) && (TARGET_OS_IPHONE == 1)
83#define ROBOTRACONTEUR_IOS
84#elif defined(TARGET_OS_OSX) && (TARGET_OS_OSX == 1)
85#define ROBOTRACONTEUR_OSX
86#endif
87#elif defined(__EMSCRIPTEN__)
88#define ROBOTRACONTEUR_EMSCRIPTEN
89#endif
90
91#ifndef ROBOTRACONTEUR_EMSCRIPTEN
92#include <boost/thread.hpp>
93#ifndef BOOST_ASIO_DISABLE_DEPRECATED_MSG
94#define BOOST_ASIO_DISABLE_DEPRECATED_MSG
95#define RR_BOOST_ASIO_DISABLE_DEPRECATED_MSG
96#endif
97#include <boost/asio/version.hpp>
98#include <boost/asio/strand.hpp>
99#ifdef RR_BOOST_ASIO_DISABLE_DEPRECATED_MSG
100#undef RR_BOOST_ASIO_DISABLE_DEPRECATED_MSG
101#undef BOOST_ASIO_DISABLE_DEPRECATED_MSG
102#endif
103#endif
104
105#ifdef ROBOTRACONTEUR_WINDOWS
106#define ROBOTRACONTEUR_PATHSEP "\\"
107#else
108#define ROBOTRACONTEUR_PATHSEP "/"
109#endif
110
111#ifdef ROBOTRACONTEUR_WINDOWS
112#ifdef ROBOTRACONTEUR_CORE_EXPORTS
113#define ROBOTRACONTEUR_CORE_API __declspec(dllexport)
114#elif ROBOTRACONTEUR_CORE_IMPORTS
115#define ROBOTRACONTEUR_CORE_API __declspec(dllimport)
116#else
117#define ROBOTRACONTEUR_CORE_API
118#endif
119#else
120#define ROBOTRACONTEUR_CORE_API
121#endif
122
123// Small vector is relatively new
124#if BOOST_VERSION > 105800
125#define ROBOTRACONTEUR_USE_SMALL_VECTOR
126#endif
127
128// Use Boost ASIO move detection
129#ifndef ROBOTRACONTEUR_NO_CXX11
130#define RR_MOVE_ARG(type) type&&
131#define RR_MOVE(x) std::move(x)
132#define RR_FORWARD(type, x) std::forward<type>(x)
133#else
134#define RR_MOVE_ARG(type) type
135#define RR_MOVE(x) x
136#define RR_FORWARD(type, x) x
137#endif
138
139#if BOOST_ASIO_VERSION < 101200
140#define RR_BOOST_ASIO_IO_CONTEXT boost::asio::io_service
141#define RR_BOOST_ASIO_STRAND boost::asio::io_service::strand
142#define RR_BOOST_ASIO_STRAND2(exec_type) boost::asio::io_service::strand
143#define RR_BOOST_ASIO_POST(context, func) context.post(func)
144#define RR_BOOST_ASIO_BUFFER_CAST(type, buf) boost::asio::buffer_cast<type>(buf)
145#define RR_BOOST_ASIO_STRAND_WRAP(strand, f) (strand).wrap(f)
146#define RR_BOOST_ASIO_NEW_STRAND(context) (new boost::asio::strand(context))
147#define RR_BOOST_ASIO_GET_IO_SERVICE(s) (s).get_io_service()
148#define RR_BOOST_ASIO_REF_IO_SERVICE(x) boost::ref(x)
149#define RR_BOOST_ASIO_NEW_API_CONST
150#else
151#define RR_BOOST_ASIO_IO_CONTEXT boost::asio::io_context
152#define RR_BOOST_ASIO_STRAND boost::asio::strand<boost::asio::io_context::executor_type>
153#define RR_BOOST_ASIO_STRAND2(exec_type) boost::asio::strand<exec_type>
154#define RR_BOOST_ASIO_POST(context, func) boost::asio::post(context, func)
155#define RR_BOOST_ASIO_BUFFER_CAST(type, buf) static_cast<type>((buf).data())
156#define RR_BOOST_ASIO_STRAND_WRAP(strand, f) boost::asio::bind_executor(strand, f)
157#define RR_BOOST_ASIO_NEW_STRAND(context) \
158 (new boost::asio::strand<boost::asio::io_context::executor_type>((context).get_executor()))
159#define RR_BOOST_ASIO_GET_IO_SERVICE(s) (s).get_executor()
160#define RR_BOOST_ASIO_REF_IO_SERVICE(x) (x)
161#define RR_BOOST_ASIO_NEW_API_CONST const
162#endif
163
164#if BOOST_ASIO_VERSION < 101200
165#define RR_BOOST_ASIO_MAKE_STRAND(exec_type, x) boost::asio::strand(x)
166#elif BOOST_ASIO_VERSION < 101400
167#define RR_BOOST_ASIO_MAKE_STRAND(exec_type, x) boost::asio::strand<exec_type>(x)
168#else
169#define RR_BOOST_ASIO_MAKE_STRAND(exec_type, x) boost::asio::make_strand<exec_type>(x)
170#endif
171
172#if BOOST_VERSION <= 105900
173#define RR_BOOST_PLACEHOLDERS(arg) arg
174#else
175#define RR_BOOST_PLACEHOLDERS(arg) boost::placeholders::arg
176#endif
177
178#if defined(ROBOTRACONTEUR_NO_CXX11) && (__cplusplus < 201103L || defined(BOOST_NO_CXX11_TEMPLATE_ALIASES))
179#define ROBOTRACONTEUR_NO_CXX11_TEMPLATE_ALIASES
180#endif
181
182#define RR_UNUSED(var_) ((void)(var_))
183
184#if !defined(ROBOTRACONTEUR_NO_CXX11) && !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX)
185#define RR_MEMBER_ARRAY_INIT(x) , x({})
186#define RR_MEMBER_ARRAY_INIT2(x) : x({})
187#else
188#define RR_MEMBER_ARRAY_INIT(x)
189#define RR_MEMBER_ARRAY_INIT2(x)
190#endif
191
192#ifndef ROBOTRACONTEUR_NO_CXX11
193#define RR_OVERRIDE override
194#define RR_OVIRTUAL
195#else
196#define RR_OVERRIDE
197#define RR_OVIRTUAL virtual
198#endif
199#define RR_NULL_FN 0
200
201#if BOOST_VERSION >= 108400
202#include <utility>
203#define RR_SWAP std::swap
204#else
205#include <boost/core/swap.hpp>
206#define RR_SWAP boost::swap
207#endif
208
209#if BOOST_ASIO_VERSION >= 101009
210#define ROBOTRACONTEUR_BOOST_ASIO_TLS_METHOD boost::asio::ssl::context::tls
211#define ROBOTRACONTEUR_BOOST_ASIO_TLS_METHOD_HTTPS boost::asio::ssl::context::tls
212#else
213#define ROBOTRACONTEUR_BOOST_ASIO_TLS_METHOD boost::asio::ssl::context::tlsv11
214#define ROBOTRACONTEUR_BOOST_ASIO_TLS_METHOD_HTTPS boost::asio::ssl::context::tlsv12
215#endif
216
217#ifdef ROBOTRACONTEUR_EMSCRIPTEN
218#include "RobotRaconteurEmscripten.h"
219#endif
220
221#ifdef __cppcheck__
222// Simplified versions for Cppcheck parsing
223#define RR_GCC_DISABLE_WARNING(warning_name)
224#define RR_GCC_ENABLE_WARNING()
225#else
226#if defined(__GNUC__) || defined(__clang__)
227#define RR_GCC_DISABLE_WARNING_TO_PRAGMA(x) _Pragma(#x)
228#define RR_GCC_DISABLE_WARNING_IGNORE_HELPER(w) RR_GCC_DISABLE_WARNING_TO_PRAGMA(GCC diagnostic ignored w)
229#define RR_GCC_DISABLE_WARNING(warning_name) \
230 _Pragma("GCC diagnostic push") RR_GCC_DISABLE_WARNING_IGNORE_HELPER(warning_name)
231#define RR_GCC_ENABLE_WARNING() _Pragma("GCC diagnostic pop")
232#else
233#define RR_GCC_DISABLE_WARNING(warning_name)
234#define RR_GCC_ENABLE_WARNING()
235#endif
236#endif