Simulated network (LAN) device.
More...
#include <network_device.h>
|
| std::unique_ptr< Impl > | impl_ |
Simulated network (LAN) device.
Writes enqueue data into an internal send buffer. Reads dequeue from a receive buffer (loopback / echo mode for simulation).
Definition at line 19 of file network_device.h.
◆ NetworkDevice() [1/3]
| contur::NetworkDevice::NetworkDevice |
( |
std::size_t | bufferCapacity = 256 | ) |
|
|
explicit |
Constructs a network device with the given buffer capacity.
- Parameters
-
| bufferCapacity | Maximum number of values in the send/receive buffer. |
◆ ~NetworkDevice()
| contur::NetworkDevice::~NetworkDevice |
( |
| ) |
|
|
override |
◆ NetworkDevice() [2/3]
| contur::NetworkDevice::NetworkDevice |
( |
const NetworkDevice & | | ) |
|
|
delete |
◆ NetworkDevice() [3/3]
| contur::NetworkDevice::NetworkDevice |
( |
NetworkDevice && | | ) |
|
|
noexcept |
◆ bufferSize()
| std::size_t contur::NetworkDevice::bufferSize |
( |
| ) |
const |
|
nodiscardnoexcept |
Returns the number of values currently in the buffer.
◆ hasData()
| bool contur::NetworkDevice::hasData |
( |
| ) |
const |
|
nodiscardnoexcept |
Returns true if the buffer has unread data.
◆ id()
| DeviceId contur::NetworkDevice::id |
( |
| ) |
const |
|
nodiscardoverridevirtualnoexcept |
◆ isReady()
| bool contur::NetworkDevice::isReady |
( |
| ) |
const |
|
nodiscardoverridevirtualnoexcept |
Returns true if the device is ready for I/O operations.
Implements contur::IDevice.
◆ name()
| std::string_view contur::NetworkDevice::name |
( |
| ) |
const |
|
nodiscardoverridevirtualnoexcept |
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ read()
Reads a value from the device.
- Returns
- The read value, or an error if the device is not ready or read is unsupported.
Implements contur::IDevice.
◆ write()
Writes a value to the device.
- Parameters
-
- Returns
- Success or an error if the device is not ready or write is unsupported.
Implements contur::IDevice.
◆ impl_
| std::unique_ptr<Impl> contur::NetworkDevice::impl_ |
|
private |
◆ NETWORK_DEVICE_ID
| DeviceId contur::NetworkDevice::NETWORK_DEVICE_ID = 2 |
|
staticconstexpr |
The documentation for this class was generated from the following file: