Woman, Life, Freedom


Async BSD Sockets Library
Library protected and public interface header documentation
fifo_sender.h
1#ifndef FIFO_SENDER_H
2#define FIFO_SENDER_H
3
4#include <sys/stat.h>
5#include <string>
6#include <array>
7#include "./communicator.h"
8
9namespace AsyncBsdSocketLib
10{
12 class FifoSender : public Communicator
13 {
14 private:
15 const std::string mPathname;
16
17 public:
18 FifoSender() = delete;
19
22 FifoSender(std::string pathname);
23
24 int Connection() const noexcept override;
25
26 bool TrySetup() noexcept override;
27
32 template <std::size_t N>
33 ssize_t Send(const std::array<uint8_t, N> &buffer) const noexcept
34 {
35 ssize_t _result =
36 write(
38 buffer.data(),
39 N);
40
41 return _result;
42 }
43 };
44}
45
46#endif
Communication method (i.e., network sockets and named pipes)
Definition: communicator.h:10
int FileDescriptor
File descriptor.
Definition: communicator.h:13
FIFO (named pipe) IPC sender (writer)
Definition: fifo_sender.h:13
FifoSender(std::string pathname)
Constructor.
ssize_t Send(const std::array< uint8_t, N > &buffer) const noexcept
Send a byte array to the FIFO pipe.
Definition: fifo_sender.h:33
int Connection() const noexcept override
Connection descriptor for sending and receiving.
bool TrySetup() noexcept override
Try to setup the communicator.