2
// posix_fd_set_adapter.hpp
3
// ~~~~~~~~~~~~~~~~~~~~~~~~
5
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
7
// Distributed under the Boost Software License, Version 1.0. (See accompanying
8
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
11
#ifndef ASIO_DETAIL_POSIX_FD_SET_ADAPTER_HPP
12
#define ASIO_DETAIL_POSIX_FD_SET_ADAPTER_HPP
14
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
16
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
18
#include "asio/detail/push_options.hpp"
20
#include "asio/detail/socket_types.hpp"
22
#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
27
// Adapts the FD_SET type to meet the Descriptor_Set concept's requirements.
28
class posix_fd_set_adapter
31
posix_fd_set_adapter()
32
: max_descriptor_(invalid_socket)
34
using namespace std; // Needed for memset on Solaris.
38
void set(socket_type descriptor)
40
if (max_descriptor_ == invalid_socket || descriptor > max_descriptor_)
41
max_descriptor_ = descriptor;
42
FD_SET(descriptor, &fd_set_);
45
bool is_set(socket_type descriptor) const
47
return FD_ISSET(descriptor, &fd_set_) != 0;
55
socket_type max_descriptor() const
57
return max_descriptor_;
62
socket_type max_descriptor_;
68
#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
70
#include "asio/detail/pop_options.hpp"
72
#endif // ASIO_DETAIL_POSIX_FD_SET_ADAPTER_HPP