Skip to content
Start free evaluation

pdcomm::modbus::Handle

Class

Move-only owner of one ::pdcomm_modbus_handle.

class Handle

Declared in: #include <pdcomm/modbus/pdcomm_modbus.hpp>

The destructor releases a non-zero handle with pdcomm_modbus_release() and ignores the result. A moved-from object holds zero and releases nothing.

Members

Handle

Constructor

Moves ownership; other becomes empty.

Handle(Handle &&other) noexcept

Declared in: #include <pdcomm/modbus/pdcomm_modbus.hpp>

Parameters

NameDescription
otherOwner to move from.

Handle

Constructor

Copying is disabled: a handle has exactly one owner.

Handle(const Handle &) = delete

Declared in: #include <pdcomm/modbus/pdcomm_modbus.hpp>

Handle

Constructor

Takes ownership of a handle.

explicit Handle(pdcomm_modbus_handle value = 0)

Declared in: #include <pdcomm/modbus/pdcomm_modbus.hpp>

Parameters

NameDescription
valueHandle to own, or zero for an empty owner.

get

Method

Returns the owned handle without giving up ownership.

pdcomm_modbus_handle get() const

Declared in: #include <pdcomm/modbus/pdcomm_modbus.hpp>

Returns

The handle, or zero when empty.

operator=

Method

Releases the current handle, then takes ownership from other.

Handle &operator=(Handle &&other) noexcept

Declared in: #include <pdcomm/modbus/pdcomm_modbus.hpp>

Parameters

NameDescription
otherOwner to move from; it becomes empty.

Returns

This owner.

operator=

Method

Copy assignment is disabled: a handle has exactly one owner.

Handle &operator=(const Handle &) = delete

Declared in: #include <pdcomm/modbus/pdcomm_modbus.hpp>

~Handle

Method

Releases the owned handle, if any.

~Handle()

Declared in: #include <pdcomm/modbus/pdcomm_modbus.hpp>