Make modules and methods non-copyable & non-movable
Modules and methods are never duplicated or moved in a memory. Moving constructors and operators are dead code. Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
@@ -54,8 +54,6 @@ namespace eap
|
||||
///
|
||||
class method
|
||||
{
|
||||
WINSTD_NONCOPYABLE(method)
|
||||
|
||||
public:
|
||||
///
|
||||
/// Constructs a method
|
||||
@@ -64,22 +62,6 @@ namespace eap
|
||||
///
|
||||
method(_In_ module &mod);
|
||||
|
||||
///
|
||||
/// Moves a method
|
||||
///
|
||||
/// \param[in] other Method to move from
|
||||
///
|
||||
method(_Inout_ method &&other) noexcept;
|
||||
|
||||
///
|
||||
/// Moves a method
|
||||
///
|
||||
/// \param[in] other Method to move from
|
||||
///
|
||||
/// \returns Reference to this object
|
||||
///
|
||||
method& operator=(_Inout_ method &&other) noexcept;
|
||||
|
||||
/// \name Session management
|
||||
/// @{
|
||||
|
||||
@@ -220,8 +202,6 @@ namespace eap
|
||||
///
|
||||
class method_tunnel : public method
|
||||
{
|
||||
WINSTD_NONCOPYABLE(method_tunnel)
|
||||
|
||||
public:
|
||||
///
|
||||
/// Constructs a method
|
||||
@@ -231,22 +211,6 @@ namespace eap
|
||||
///
|
||||
method_tunnel(_In_ module &mod, _In_ method *inner);
|
||||
|
||||
///
|
||||
/// Moves a method
|
||||
///
|
||||
/// \param[in] other Method to move from
|
||||
///
|
||||
method_tunnel(_Inout_ method_tunnel &&other) noexcept;
|
||||
|
||||
///
|
||||
/// Moves a method
|
||||
///
|
||||
/// \param[in] other Method to move from
|
||||
///
|
||||
/// \returns Reference to this object
|
||||
///
|
||||
method_tunnel& operator=(_Inout_ method_tunnel &&other) noexcept;
|
||||
|
||||
/// \name Session management
|
||||
/// @{
|
||||
|
||||
@@ -309,8 +273,6 @@ namespace eap
|
||||
///
|
||||
class method_eap : public method_tunnel
|
||||
{
|
||||
WINSTD_NONCOPYABLE(method_eap)
|
||||
|
||||
public:
|
||||
///
|
||||
/// Constructs a method
|
||||
@@ -321,22 +283,6 @@ namespace eap
|
||||
///
|
||||
method_eap(_In_ module &mod, _In_ winstd::eap_type_t eap_method, _In_ method *inner);
|
||||
|
||||
///
|
||||
/// Moves a method
|
||||
///
|
||||
/// \param[in] other Method to move from
|
||||
///
|
||||
method_eap(_Inout_ method_eap &&other) noexcept;
|
||||
|
||||
///
|
||||
/// Moves a method
|
||||
///
|
||||
/// \param[in] other Method to move from
|
||||
///
|
||||
/// \returns Reference to this object
|
||||
///
|
||||
method_eap& operator=(_Inout_ method_eap &&other) noexcept;
|
||||
|
||||
/// \name Session management
|
||||
/// @{
|
||||
|
||||
|
@@ -57,8 +57,6 @@ namespace eap
|
||||
///
|
||||
class module
|
||||
{
|
||||
WINSTD_NONCOPYABLE(module)
|
||||
|
||||
public:
|
||||
///
|
||||
/// Constructs a module for the given EAP type
|
||||
@@ -726,8 +724,6 @@ namespace eap
|
||||
///
|
||||
class peer : public module
|
||||
{
|
||||
WINSTD_NONCOPYABLE(peer)
|
||||
|
||||
public:
|
||||
///
|
||||
/// Constructs a EAP peer module for the given EAP type
|
||||
|
@@ -34,22 +34,6 @@ eap::method::method(_In_ module &mod) :
|
||||
}
|
||||
|
||||
|
||||
eap::method::method(_Inout_ method &&other) noexcept :
|
||||
m_module(other.m_module)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::method& eap::method::operator=(_Inout_ method &&other) noexcept
|
||||
{
|
||||
if (this != std::addressof(other)) {
|
||||
assert(std::addressof(m_module) == std::addressof(other.m_module)); // Move method within same module only!
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
void eap::method::begin_session(
|
||||
_In_ DWORD dwFlags,
|
||||
_In_ const EapAttributes *pAttributeArray,
|
||||
@@ -126,24 +110,6 @@ eap::method_tunnel::method_tunnel(_In_ module &mod, _In_ method *inner) :
|
||||
}
|
||||
|
||||
|
||||
eap::method_tunnel::method_tunnel(_Inout_ method_tunnel &&other) noexcept :
|
||||
m_inner(std::move(other.m_inner)),
|
||||
method (std::move(other ))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::method_tunnel& eap::method_tunnel::operator=(_Inout_ method_tunnel &&other) noexcept
|
||||
{
|
||||
if (this != std::addressof(other)) {
|
||||
(method&)*this = std::move(other );
|
||||
m_inner = std::move(other.m_inner);
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
void eap::method_tunnel::begin_session(
|
||||
_In_ DWORD dwFlags,
|
||||
_In_ const EapAttributes *pAttributeArray,
|
||||
@@ -240,28 +206,6 @@ eap::method_eap::method_eap(_In_ module &mod, _In_ winstd::eap_type_t eap_method
|
||||
}
|
||||
|
||||
|
||||
eap::method_eap::method_eap(_Inout_ method_eap &&other) noexcept :
|
||||
m_eap_method ( other.m_eap_method ),
|
||||
m_id (std::move(other.m_id )),
|
||||
m_send_nak (std::move(other.m_send_nak )),
|
||||
method_tunnel(std::move(other ))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::method_eap& eap::method_eap::operator=(_Inout_ method_eap &&other) noexcept
|
||||
{
|
||||
if (this != std::addressof(other)) {
|
||||
assert(m_eap_method == other.m_eap_method); // Move method within same EAP method type only!
|
||||
(method_tunnel&)*this = std::move(other );
|
||||
m_id = std::move(other.m_id );
|
||||
m_send_nak = std::move(other.m_send_nak);
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
void eap::method_eap::begin_session(
|
||||
_In_ DWORD dwFlags,
|
||||
_In_ const EapAttributes *pAttributeArray,
|
||||
|
Reference in New Issue
Block a user