![]() |
Contur 2
Educational OS kernel simulator
|
Unidirectional byte-stream IPC channel with bounded capacity. More...
#include <pipe.h>
Public Member Functions | |
| Pipe (std::string name, std::size_t capacity=1024) | |
| Creates a pipe with a logical name and capacity. | |
| ~Pipe () override | |
| Destroys pipe channel. | |
| Pipe (const Pipe &)=delete | |
| Copy construction is disabled. | |
| Pipe & | operator= (const Pipe &)=delete |
| Copy assignment is disabled. | |
| Pipe (Pipe &&) noexcept | |
| Move-constructs pipe state. | |
| Pipe & | operator= (Pipe &&) noexcept |
| Move-assigns pipe state. | |
| Result< std::size_t > | write (std::span< const std::byte > data) override |
| Writes bytes into the pipe buffer. | |
| Result< std::size_t > | read (std::span< std::byte > buffer) override |
| Reads bytes from the pipe buffer in FIFO order. | |
| void | close () override |
| Closes the pipe and clears buffered data. | |
| bool | isOpen () const noexcept override |
| Returns whether the pipe is open. | |
| std::string_view | name () const noexcept override |
| Pipe name. | |
| std::size_t | capacity () const noexcept |
| Maximum number of bytes that can be buffered. | |
| std::size_t | size () const noexcept |
| Current number of buffered bytes. | |
| Public Member Functions inherited from contur::IIpcChannel | |
| virtual | ~IIpcChannel ()=default |
Private Attributes | |
| std::unique_ptr< Impl > | impl_ |
Unidirectional byte-stream IPC channel with bounded capacity.
Pipe stores bytes in FIFO order. Reads consume bytes from the front.
|
explicit |
Creates a pipe with a logical name and capacity.
| name | Channel name used by registries and diagnostics. |
| capacity | Maximum number of buffered bytes. |
References capacity(), and name().
Referenced by operator=(), operator=(), Pipe(), and Pipe().
|
override |
Destroys pipe channel.
|
delete |
Copy construction is disabled.
References Pipe().
|
noexcept |
Move-constructs pipe state.
References Pipe().
|
nodiscardnoexcept |
Maximum number of bytes that can be buffered.
References capacity().
Referenced by capacity(), and Pipe().
|
overridevirtual |
Closes the pipe and clears buffered data.
Implements contur::IIpcChannel.
References close().
Referenced by close().
|
nodiscardoverridevirtualnoexcept |
Returns whether the pipe is open.
Implements contur::IIpcChannel.
References isOpen().
Referenced by isOpen().
|
nodiscardoverridevirtualnoexcept |
Copy assignment is disabled.
References Pipe().
|
nodiscardoverridevirtual |
Reads bytes from the pipe buffer in FIFO order.
Implements contur::IIpcChannel.
References read().
Referenced by read().
|
nodiscardnoexcept |
|
nodiscardoverridevirtual |
Writes bytes into the pipe buffer.
Implements contur::IIpcChannel.
References write().
Referenced by write().