HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_BoostAsio.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: UT_BoostAsio.h
7  *
8  * COMMENTS:
9  *
10  */
11 
12 #ifndef __UT_BOOSTASIO_H__
13 #define __UT_BOOSTASIO_H__
14 
15 #include "UT_API.h"
16 
17 #include <SYS/SYS_Pragma.h>
18 
19 // Enable this if you need to track asio handlers.
20 #if UT_ASSERT_LEVEL > 0
21 //#define BOOST_ASIO_ENABLE_HANDLER_TRACKING
22 #endif
23 
24 // This is required for Windows. We are treating a warning that boost asio
25 // generates as an error which causes the build to fail.
28 
29 #include <hboost/asio.hpp>
30 
32 
33 // This is a poor mans version of handler tracking. When boost gets bumped up
34 // to a version that has handler tracking swap this out for the boost asio
35 // handler tracking macros.
36 #ifdef BOOST_ASIO_ENABLE_HANDLER_TRACKING
37 #define ASIO_HANDLER_LOCATION \
38  UTdebugFormat("{}", __func__);
39 #else
40 #define ASIO_HANDLER_LOCATION
41 #endif
42 
43 // TCP type alias
44 using ASIO_TCPSocket = hboost::asio::ip::tcp::socket;
45 using ASIO_TCPEndpoint = hboost::asio::ip::tcp::endpoint;
46 using ASIO_TCPAcceptor = hboost::asio::ip::tcp::acceptor;
47 using ASIO_TCPResolver = hboost::asio::ip::tcp::resolver;
48 
49 // UDP type alias
50 using ASIO_UDPSocket = hboost::asio::ip::udp::socket;
51 using ASIO_UDPEndpoint = hboost::asio::ip::udp::endpoint;
52 using ASIO_UDPResolver = hboost::asio::ip::udp::resolver;
53 
54 // IP Address alias
55 using ASIO_IPAddress = hboost::asio::ip::address;
56 using ASIO_IPAddressV4 = hboost::asio::ip::address_v4;
57 using ASIO_IPAddressV6 = hboost::asio::ip::address_v6;
58 using ASIO_IPNetworkV4 = hboost::asio::ip::network_v4;
59 using ASIO_IPNetworkV6 = hboost::asio::ip::network_v6;
60 
61 // Buffers
62 using ASIO_ConstBuffer = hboost::asio::const_buffer;
63 using ASIO_MutableBuffer = hboost::asio::mutable_buffer;
64 using ASIO_StreamBuffer = hboost::asio::streambuf;
65 template <typename T, typename Allocator = std::allocator<T>>
66 using ASIO_DynamicVectorBuffer = hboost::asio::dynamic_vector_buffer<T, Allocator>;
67 
68 // Timers
69 using ASIO_DeadlineTimer = hboost::asio::deadline_timer;
70 using ASIO_SystemTimer = hboost::asio::system_timer;
71 
72 using ASIO_IOStrand = hboost::asio::io_context::strand;
73 
74 using ASIO_IOContext = hboost::asio::io_context;
75 template <typename ExecutorT>
76 using ASIO_ExecutorWorkGuard = hboost::asio::executor_work_guard<ExecutorT>;
77 
78 using ASIO_AnyExecutor = hboost::asio::any_io_executor;
79 
80 // Houdini Main IO context.
81 UT_API ASIO_IOContext::executor_type UThoudiniIOExecutor();
82 
83 // Extensions to the boost.asio library (i.e. sendfile support).
84 #include "UT_BoostAsioExt.h"
85 
86 #endif // __UT_BOOSTASIO_H__
87 
hboost::asio::ip::tcp::socket ASIO_TCPSocket
Definition: UT_BoostAsio.h:44
#define SYS_PRAGMA_PUSH_WARN()
Definition: SYS_Pragma.h:34
#define SYS_PRAGMA_DISABLE_OVERLOADED_VIRTUAL()
Definition: SYS_Pragma.h:59
hboost::asio::const_buffer ASIO_ConstBuffer
Definition: UT_BoostAsio.h:62
hboost::asio::mutable_buffer ASIO_MutableBuffer
Definition: UT_BoostAsio.h:63
hboost::asio::ip::udp::socket ASIO_UDPSocket
Definition: UT_BoostAsio.h:50
#define UT_API
Definition: UT_API.h:14
hboost::asio::ip::address_v4 ASIO_IPAddressV4
Definition: UT_BoostAsio.h:56
hboost::asio::deadline_timer ASIO_DeadlineTimer
Definition: UT_BoostAsio.h:69
hboost::asio::ip::network_v6 ASIO_IPNetworkV6
Definition: UT_BoostAsio.h:59
hboost::asio::ip::network_v4 ASIO_IPNetworkV4
Definition: UT_BoostAsio.h:58
hboost::asio::ip::udp::resolver ASIO_UDPResolver
Definition: UT_BoostAsio.h:52
hboost::asio::dynamic_vector_buffer< T, Allocator > ASIO_DynamicVectorBuffer
Definition: UT_BoostAsio.h:66
hboost::asio::executor_work_guard< ExecutorT > ASIO_ExecutorWorkGuard
Definition: UT_BoostAsio.h:76
hboost::asio::ip::udp::endpoint ASIO_UDPEndpoint
Definition: UT_BoostAsio.h:51
#define SYS_PRAGMA_POP_WARN()
Definition: SYS_Pragma.h:35
UT_API ASIO_IOContext::executor_type UThoudiniIOExecutor()
hboost::asio::io_context ASIO_IOContext
Definition: UT_BoostAsio.h:74
hboost::asio::ip::address_v6 ASIO_IPAddressV6
Definition: UT_BoostAsio.h:57
hboost::asio::ip::tcp::endpoint ASIO_TCPEndpoint
Definition: UT_BoostAsio.h:45
hboost::asio::system_timer ASIO_SystemTimer
Definition: UT_BoostAsio.h:70
hboost::asio::ip::tcp::acceptor ASIO_TCPAcceptor
Definition: UT_BoostAsio.h:46
hboost::asio::ip::tcp::resolver ASIO_TCPResolver
Definition: UT_BoostAsio.h:47
hboost::asio::streambuf ASIO_StreamBuffer
Definition: UT_BoostAsio.h:64
hboost::asio::ip::address ASIO_IPAddress
Definition: UT_BoostAsio.h:55
hboost::asio::io_context::strand ASIO_IOStrand
Definition: UT_BoostAsio.h:72
hboost::asio::any_io_executor ASIO_AnyExecutor
Definition: UT_BoostAsio.h:78