Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::runtime::NamedPipe Class Reference

#include <named_pipe.hpp>

Public Member Functions

 NamedPipe ()=default
 ~NamedPipe ()
bool create_server (std::string_view name)
 Create and open a pipe as server (creates the pipe).
bool connect_client (std::string_view name)
 Connect to an existing pipe as client.
int write (const uint8_t *data, size_t length)
 Write data to the pipe. Returns bytes written, or -1 on error.
int write (std::string_view data)
int read (uint8_t *buffer, size_t buffer_size)
 Read data from the pipe. Returns bytes read, or -1 on error. 0 = EOF.
std::optional< std::string > read_string (size_t max_size=65536)
 Read all available data as a string.
void close ()
 Close the pipe.
bool is_open () const
 Whether the pipe is open.
 NamedPipe (const NamedPipe &)=delete
NamedPipe & operator= (const NamedPipe &)=delete
 NamedPipe (NamedPipe &&other) noexcept
NamedPipe & operator= (NamedPipe &&other) noexcept

Constructor & Destructor Documentation

◆ NamedPipe() [1/3]

pulp::runtime::NamedPipe::NamedPipe ( )
default

◆ ~NamedPipe()

pulp::runtime::NamedPipe::~NamedPipe ( )

◆ NamedPipe() [2/3]

pulp::runtime::NamedPipe::NamedPipe ( const NamedPipe & )
delete

◆ NamedPipe() [3/3]

pulp::runtime::NamedPipe::NamedPipe ( NamedPipe && other)
noexcept

Member Function Documentation

◆ close()

void pulp::runtime::NamedPipe::close ( )

Close the pipe.

◆ connect_client()

bool pulp::runtime::NamedPipe::connect_client ( std::string_view name)

Connect to an existing pipe as client.

◆ create_server()

bool pulp::runtime::NamedPipe::create_server ( std::string_view name)

Create and open a pipe as server (creates the pipe).

On POSIX, name is a filesystem path and the implementation owns a paired reply FIFO beside it. On Windows, it's a pipe name. POSIX FIFOs are created owner-only (0600): a peer must run as the same user, so a cross-account helper needs a different transport.

◆ is_open()

bool pulp::runtime::NamedPipe::is_open ( ) const

Whether the pipe is open.

◆ operator=() [1/2]

NamedPipe & pulp::runtime::NamedPipe::operator= ( const NamedPipe & )
delete

◆ operator=() [2/2]

NamedPipe & pulp::runtime::NamedPipe::operator= ( NamedPipe && other)
noexcept

◆ read()

int pulp::runtime::NamedPipe::read ( uint8_t * buffer,
size_t buffer_size )

Read data from the pipe. Returns bytes read, or -1 on error. 0 = EOF.

◆ read_string()

std::optional< std::string > pulp::runtime::NamedPipe::read_string ( size_t max_size = 65536)

Read all available data as a string.

◆ write() [1/2]

int pulp::runtime::NamedPipe::write ( const uint8_t * data,
size_t length )

Write data to the pipe. Returns bytes written, or -1 on error.

◆ write() [2/2]

int pulp::runtime::NamedPipe::write ( std::string_view data)

The documentation for this class was generated from the following file:
  • /home/runner/work/pulp/pulp/core/runtime/include/pulp/runtime/named_pipe.hpp