zmqpp  4.1.2
C++ bindings for 0mq (libzmq)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
compatibility.hpp
Go to the documentation of this file.
1 /*
2  * This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this
4  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5  *
6  * This file is part of zmqpp.
7  * Copyright (c) 2011-2015 Contributors as noted in the AUTHORS file.
8  */
9 
30 #ifndef ZMQPP_COMPATIBILITY_HPP_
31 #define ZMQPP_COMPATIBILITY_HPP_
32 
33 #include <zmq.h>
34 
35 // Currently we require at least 0mq version 2.2.x
36 #define ZMQPP_REQUIRED_ZMQ_MAJOR 2
37 #define ZMQPP_REQUIRED_ZMQ_MINOR 2
38 
39 #if (ZMQ_VERSION_MAJOR < ZMQPP_REQUIRED_ZMQ_MAJOR) || ((ZMQ_VERSION_MAJOR == ZMQPP_REQUIRED_ZMQ_MAJOR) && (ZMQ_VERSION_MINOR < ZMQPP_REQUIRED_ZMQ_MINOR))
40 #error zmqpp requires a later version of 0mq
41 #endif
42 
43 // Experimental feature support
44 #if (ZMQ_VERSION_MAJOR == 3) && (ZMQ_VERSION_MINOR == 0)
45 #define ZMQ_EXPERIMENTAL_LABELS
46 #endif
47 
48 // Deal with older versions of gcc
49 #if defined(__GNUC__) && !defined(__clang__)
50 #if __GNUC__ == 4
51 
52 // Deal with older gcc not supporting C++0x typesafe enum class name {} comparison
53 #if __GNUC_MINOR__ < 4
54 #define ZMQPP_COMPARABLE_ENUM enum
55 #endif
56 
57 #if __GNUC_MINOR__ == 4
58 #if __GNUC_PATCHLEVEL__ < 1
59 #undef ZMQPP_COMPARABLE_ENUM
60 #define ZMQPP_COMPARABLE_ENUM enum
61 #endif // if __GNUC_PATCHLEVEL__ < 1
62 #endif // if __GNUC_MINOR__ == 4
63 
64 // Deal with older gcc not supporting C++0x lambda function
65 #if __GNUC_MINOR__ < 5
66 #define ZMQPP_IGNORE_LAMBDA_FUNCTION_TESTS
67 #define ZMQPP_EXPLICITLY_DELETED
68 #endif // if __GNUC_MINOR__ < 5
69 
70 // Deal with older gcc not supporting C++0x nullptr
71 #if __GNUC_MINOR__ < 6
72 #define nullptr NULL
73 #define NOEXCEPT
74 #endif // if __GNUC_MINOR__ < 6
75 
76 #endif // if __GNUC_ == 4
77 #endif // if defined(__GNUC__) && !defined(__clang__)
78 
79 #if defined(_MSC_VER)
80 #define NOEXCEPT throw()
81 #if _MSC_VER < 1900
82 # define ZMQPP_NO_CONSTEXPR
83 #endif
84 #if _MSC_VER < 1800
85 #define ZMQPP_EXPLICITLY_DELETED
86 #endif // if _MSC_VER < 1800
87 #if _MSC_VER < 1600
88 #define nullptr NULL
89 #define ZMQPP_IGNORE_LAMBDA_FUNCTION_TESTS
90 #define ZMQPP_COMPARABLE_ENUM enum
91 #endif // if _MSC_VER < 1600
92 #endif // if defined(_MSC_VER)
93 
94 // Generic state, assume a modern compiler
95 #ifndef ZMQPP_COMPARABLE_ENUM
96 #define ZMQPP_COMPARABLE_ENUM enum class
97 #endif
98 
99 #ifndef ZMQPP_EXPLICITLY_DELETED
100 #define ZMQPP_EXPLICITLY_DELETED = delete
101 #endif
102 
103 #ifndef NOEXCEPT
104 #define NOEXCEPT noexcept
105 #endif
106 
107 // There are a couple of methods that take a raw socket in form of a 'file descriptor'. Under POSIX
108 // this is simply an int. But under Windows this type must be a SOCKET. In order to hide this
109 // platform detail we create a raw_socket_t which is a SOCKET under Windows and an int on all the
110 // other platforms. This is practically the same as libzmq does with its zmq_pollitem_t struct.
111 namespace zmqpp
112 {
113 #ifdef _WIN32
114  typedef SOCKET raw_socket_t;
115 #else
116  typedef int raw_socket_t;
117 #endif
118 }
119 
120 
121 #endif /* ZMQPP_COMPATIBILITY_HPP_ */
122 
C++ wrapper around zmq.
Definition: actor.cpp:29
int raw_socket_t
Definition: compatibility.hpp:116