Woman, Life, Freedom


Async BSD Sockets Library
Library protected and public interface header documentation
AsyncBsdSocketLib::FifoSender Class Reference

FIFO (named pipe) IPC sender (writer) More...

#include <fifo_sender.h>

Inheritance diagram for AsyncBsdSocketLib::FifoSender:
AsyncBsdSocketLib::Communicator

Public Member Functions

 FifoSender (std::string pathname)
 Constructor. More...
 
int Connection () const noexcept override
 Connection descriptor for sending and receiving. More...
 
bool TrySetup () noexcept override
 Try to setup the communicator. More...
 
template<std::size_t N>
ssize_t Send (const std::array< uint8_t, N > &buffer) const noexcept
 Send a byte array to the FIFO pipe. More...
 
- Public Member Functions inherited from AsyncBsdSocketLib::Communicator
int Descriptor () const noexcept
 File descriptor. More...
 
virtual bool TryClose () noexcept
 Try to close the communicator. More...
 

Additional Inherited Members

- Protected Attributes inherited from AsyncBsdSocketLib::Communicator
int FileDescriptor
 File descriptor.
 

Detailed Description

FIFO (named pipe) IPC sender (writer)

Constructor & Destructor Documentation

◆ FifoSender()

AsyncBsdSocketLib::FifoSender::FifoSender ( std::string  pathname)

Constructor.

Parameters
pathnameFIFO file path

Member Function Documentation

◆ Connection()

int AsyncBsdSocketLib::FifoSender::Connection ( ) const
overridevirtualnoexcept

Connection descriptor for sending and receiving.

Returns
A non-negative value if there is a valid connection; otherwise -1

Implements AsyncBsdSocketLib::Communicator.

◆ Send()

template<std::size_t N>
ssize_t AsyncBsdSocketLib::FifoSender::Send ( const std::array< uint8_t, N > &  buffer) const
inlinenoexcept

Send a byte array to the FIFO pipe.

Template Parameters
NSend buffer size
Parameters
bufferSend buffer byte array
Returns
Size of sent bytes (-1 in case of sending failed)

◆ TrySetup()

bool AsyncBsdSocketLib::FifoSender::TrySetup ( )
overridevirtualnoexcept

Try to setup the communicator.

Returns
True if the communicator is successfully set up; otherwise false

Implements AsyncBsdSocketLib::Communicator.