zmqpp 4.1.2
C++ bindings for 0mq (libzmq)
Loading...
Searching...
No Matches
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// Include export file if on windows, generated by cmake only
36#if _WIN32
37 #include "zmqpp_export.h"
38#else
39 #define ZMQPP_EXPORT
40#endif
41
42// Currently we require at least 0mq version 2.2.x
43#define ZMQPP_REQUIRED_ZMQ_MAJOR 2
44#define ZMQPP_REQUIRED_ZMQ_MINOR 2
45
46#if (ZMQ_VERSION_MAJOR < ZMQPP_REQUIRED_ZMQ_MAJOR) || ((ZMQ_VERSION_MAJOR == ZMQPP_REQUIRED_ZMQ_MAJOR) && (ZMQ_VERSION_MINOR < ZMQPP_REQUIRED_ZMQ_MINOR))
47#error zmqpp requires a later version of 0mq
48#endif
49
50// Experimental feature support
51#if (ZMQ_VERSION_MAJOR == 3) && (ZMQ_VERSION_MINOR == 0)
52#define ZMQ_EXPERIMENTAL_LABELS
53#endif
54
55// Deal with older versions of gcc
56#if defined(__GNUC__) && !defined(__clang__)
57#if __GNUC__ == 4
58
59// Deal with older gcc not supporting C++0x typesafe enum class name {} comparison
60#if __GNUC_MINOR__ < 4
61#define ZMQPP_COMPARABLE_ENUM enum
62#endif
63
64#if __GNUC_MINOR__ == 4
65#if __GNUC_PATCHLEVEL__ < 1
66#undef ZMQPP_COMPARABLE_ENUM
67#define ZMQPP_COMPARABLE_ENUM enum
68#endif // if __GNUC_PATCHLEVEL__ < 1
69#endif // if __GNUC_MINOR__ == 4
70
71// Deal with older gcc not supporting C++0x lambda function
72#if __GNUC_MINOR__ < 5
73#define ZMQPP_IGNORE_LAMBDA_FUNCTION_TESTS
74#define ZMQPP_EXPLICITLY_DELETED
75#endif // if __GNUC_MINOR__ < 5
76
77// Deal with older gcc not supporting C++0x nullptr
78#if __GNUC_MINOR__ < 6
79#define nullptr NULL
80#define NOEXCEPT
81#endif // if __GNUC_MINOR__ < 6
82
83#endif // if __GNUC_ == 4
84#endif // if defined(__GNUC__) && !defined(__clang__)
85
86#if defined(_MSC_VER)
87#define NOEXCEPT throw()
88#if _MSC_VER < 1900
89# define ZMQPP_NO_CONSTEXPR
90#endif
91#if _MSC_VER < 1800
92#define ZMQPP_EXPLICITLY_DELETED
93#endif // if _MSC_VER < 1800
94#if _MSC_VER < 1600
95#define nullptr NULL
96#define ZMQPP_IGNORE_LAMBDA_FUNCTION_TESTS
97#define ZMQPP_COMPARABLE_ENUM enum
98#endif // if _MSC_VER < 1600
99#endif // if defined(_MSC_VER)
100
101// Generic state, assume a modern compiler
102#ifndef ZMQPP_COMPARABLE_ENUM
103#define ZMQPP_COMPARABLE_ENUM enum class
104#endif
105
106#ifndef ZMQPP_EXPLICITLY_DELETED
107#define ZMQPP_EXPLICITLY_DELETED = delete
108#endif
109
110#if __cplusplus >= 201300 // c++14 version. This number worked
111 // on g++ 4.9 when compiling with -std=c++14
112#define ZMQPP_DEPRECATED(reason) [[deprecated(#reason)]]
113#elif __GNUC__
114#define ZMQPP_DEPRECATED(reason) __attribute__ ((deprecated))
115#elif defined(_MSC_VER)
116#define ZMQPP_DEPRECATED(reason) __declspec(deprecated(#reason))
117#else
118#define ZMQPP_DEPRECATED(reason)
119#endif
120
121#ifndef NOEXCEPT
122#define NOEXCEPT noexcept
123#endif
124
125// There are a couple of methods that take a raw socket in form of a 'file descriptor'. Under POSIX
126// this is simply an int. But under Windows this type must be a SOCKET. In order to hide this
127// platform detail we create a raw_socket_t which is a SOCKET under Windows and an int on all the
128// other platforms. This is practically the same as libzmq does with its zmq_pollitem_t struct.
129namespace zmqpp
130{
131#ifdef _WIN32
132 typedef SOCKET raw_socket_t;
133#else
134 typedef int raw_socket_t;
135#endif
136}
137
138#endif /* ZMQPP_COMPATIBILITY_HPP_ */
139
C++ wrapper around zmq.
Definition actor.cpp:30
int raw_socket_t
Definition compatibility.hpp:134