#ifndef BOOST_ASIO_GENERIC_BASIC_ENDPOINT_HPP
#define BOOST_ASIO_GENERIC_BASIC_ENDPOINT_HPP
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif
#include <boost/asio/detail/config.hpp>
#include <boost/asio/generic/detail/endpoint.hpp>
#include <boost/asio/detail/push_options.hpp>
namespace boost {
namespace asio {
namespace generic {
template <typename Protocol>
class basic_endpoint
{
public:
typedef Protocol protocol_type;
#if defined(GENERATING_DOCUMENTATION)
typedef implementation_defined data_type;
#else
typedef boost::asio::detail::socket_addr_type data_type;
#endif
basic_endpoint() noexcept
{
}
basic_endpoint(const void* socket_address,
std::size_t socket_address_size, int socket_protocol = 0)
: impl_(socket_address, socket_address_size, socket_protocol)
{
}
template <typename Endpoint>
basic_endpoint(const Endpoint& endpoint)
: impl_(endpoint.data(), endpoint.size(), endpoint.protocol().protocol())
{
}
basic_endpoint(const basic_endpoint& other)
: impl_(other.impl_)
{
}
basic_endpoint(basic_endpoint&& other)
: impl_(other.impl_)
{
}
basic_endpoint& operator=(const basic_endpoint& other)
{
impl_ = other.impl_;
return *this;
}
basic_endpoint& operator=(basic_endpoint&& other)
{
impl_ = other.impl_;
return *this;
}
protocol_type protocol() const
{
return protocol_type(impl_.family(), impl_.protocol());
}
data_type* data()
{
return impl_.data();
}
const data_type* data() const
{
return impl_.data();
}
std::size_t size() const
{
return impl_.size();
}
void resize(std::size_t new_size)
{
impl_.resize(new_size);
}
std::size_t capacity() const
{
return impl_.capacity();
}
friend bool operator==(const basic_endpoint<Protocol>& e1,
const basic_endpoint<Protocol>& e2)
{
return e1.impl_ == e2.impl_;
}
friend bool operator!=(const basic_endpoint<Protocol>& e1,
const basic_endpoint<Protocol>& e2)
{
return !(e1.impl_ == e2.impl_);
}
friend bool operator<(const basic_endpoint<Protocol>& e1,
const basic_endpoint<Protocol>& e2)
{
return e1.impl_ < e2.impl_;
}
friend bool operator>(const basic_endpoint<Protocol>& e1,
const basic_endpoint<Protocol>& e2)
{
return e2.impl_ < e1.impl_;
}
friend bool operator<=(const basic_endpoint<Protocol>& e1,
const basic_endpoint<Protocol>& e2)
{
return !(e2 < e1);
}
friend bool operator>=(const basic_endpoint<Protocol>& e1,
const basic_endpoint<Protocol>& e2)
{
return !(e1 < e2);
}
private:
boost::asio::generic::detail::endpoint impl_;
};
} } }
#include <boost/asio/detail/pop_options.hpp>
#endif