5 #ifndef PACKIO_CONFIG_H
6 #define PACKIO_CONFIG_H
9 #include <unordered_map>
12 #if !defined(PACKIO_HAS_MSGPACK)
13 #define PACKIO_HAS_MSGPACK __has_include(<msgpack.hpp>)
16 #if !defined(PACKIO_HAS_NLOHMANN_JSON)
17 #define PACKIO_HAS_NLOHMANN_JSON __has_include(<nlohmann/json.hpp>)
20 #if !defined(PACKIO_HAS_BOOST_JSON)
21 #define PACKIO_HAS_BOOST_JSON __has_include(<boost/json.hpp>)
24 #if !defined(PACKIO_STANDALONE_ASIO)
26 #define PACKIO_STANDALONE_ASIO (!__has_include(<boost/asio.hpp>) && __has_include(<asio.hpp>))
29 #if PACKIO_STANDALONE_ASIO
32 #include <boost/asio.hpp>
35 #if defined(BOOST_ASIO_HAS_CO_AWAIT) || defined(ASIO_HAS_CO_AWAIT) \
36 || defined(PACKIO_DOCUMENTATION)
37 #define PACKIO_HAS_CO_AWAIT 1
40 #if defined(BOOST_ASIO_HAS_LOCAL_SOCKETS) || defined(ASIO_HAS_LOCAL_SOCKETS) \
41 || defined(PACKIO_DOCUMENTATION)
42 #define PACKIO_HAS_LOCAL_SOCKETS 1
45 #if defined(BOOST_ASIO_DEFAULT_COMPLETION_TOKEN)
46 #define PACKIO_DEFAULT_COMPLETION_TOKEN(e) \
47 BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(e)
48 #elif defined(ASIO_DEFAULT_COMPLETION_TOKEN)
49 #define PACKIO_DEFAULT_COMPLETION_TOKEN(e) ASIO_DEFAULT_COMPLETION_TOKEN(e)
50 #elif defined(PACKIO_DOCUMENTATION)
51 #define PACKIO_DEFAULT_COMPLETION_TOKEN(e) \
52 = typename net::default_completion_token<e>::type()
54 #define PACKIO_DEFAULT_COMPLETION_TOKEN(e)
57 #if defined(BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE)
58 #define PACKIO_DEFAULT_COMPLETION_TOKEN_TYPE(e) \
59 BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(e)
60 #elif defined(ASIO_DEFAULT_COMPLETION_TOKEN_TYPE)
61 #define PACKIO_DEFAULT_COMPLETION_TOKEN_TYPE(e) \
62 ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(e)
63 #elif defined(PACKIO_DOCUMENTATION)
64 #define PACKIO_DEFAULT_COMPLETION_TOKEN(e) \
65 = typename net::default_completion_token<e>::type
67 #define PACKIO_DEFAULT_COMPLETION_TOKEN_TYPE(e)
70 #if defined(BOOST_ASIO_COMPLETION_TOKEN_FOR)
71 #define PACKIO_COMPLETION_TOKEN_FOR(s) BOOST_ASIO_COMPLETION_TOKEN_FOR(s)
72 #elif defined(ASIO_COMPLETION_TOKEN_FOR)
73 #define PACKIO_COMPLETION_TOKEN_FOR(s) ASIO_COMPLETION_TOKEN_FOR(s)
75 #define PACKIO_COMPLETION_TOKEN_FOR(s) typename
80 #if PACKIO_STANDALONE_ASIO
81 namespace net = ::asio;
82 using error_code = std::error_code;
83 using system_error = std::system_error;
84 using error_category = std::error_category;
86 namespace net = ::boost::asio;
87 using error_code = boost::system::error_code;
88 using system_error = boost::system::system_error;
89 using error_category = boost::system::error_category;
92 template <
typename... Args>
93 using default_map = std::unordered_map<Args...>;
94 using default_mutex = std::mutex;
98 #if PACKIO_STANDALONE_ASIO
99 #if ASIO_VERSION >= 101700
100 using any_io_executor = net::any_io_executor;
102 using any_io_executor = net::executor;
105 #if BOOST_VERSION >= 107400
106 using any_io_executor = net::any_io_executor;
108 using any_io_executor = net::executor;
The packio namespace.
Definition: arg.h:14