57 const int status = connection_fd.
read(buffer,
sizeof(buffer)-1);
60 buffer[status] =
'\0';
61 return std::string(buffer);
72 const unsigned int l = message.size();
75 connection_fd.
write(message.data(),l);
90 const unsigned int l = message.size();
109 const int status =
m_fifo_fd->read(buffer,
sizeof(buffer)-1);
112 buffer[status] =
'\0';
113 return std::string(buffer);
115 if (
m_is_blocking ==
false && status == 0)
return std::string(
"");
130 int flags = O_RDONLY;
133 flags = O_RDONLY|O_NONBLOCK;
140 catch(OksSystem::OpenFileIssue &ex) {
161 int flags = O_WRONLY;
164 flags = O_WRONLY|O_NONBLOCK;
171 catch(OksSystem::OpenFileIssue &ex) {
194 flags = O_RDWR|O_NONBLOCK;
201 catch(OksSystem::OpenFileIssue &ex) {
#define ERS_ASSERT_MSG(expression, message)
#define ERS_RANGE_CHECK(min, val, max)
#define ERS_ASSERT(expression)
File descriptor / Socket wrapper.
int read(void *buffer, size_t number) const
int write(const void *buffer, size_t number) const
FIFOConnection(const std::string &name)
void close()
It closes the FIFO file descriptor.
void send(const std::string &message) const
It writes a message to a FIFO.
void send_message(const std::string &message) const
OksSystem::Descriptor * open_rw(bool block=true)
It opens the FIFO in read and write mode.
std::string read_message() const
static const unsigned int MAX_MESSAGE_LEN
void make(mode_t perm=0622) const
OksSystem::Descriptor * m_fifo_fd
int fd() const
It gets the FIFO file descriptor.
OksSystem::Descriptor * open_w(bool block=true)
It opens the FIFO in write-only mode.
std::string read() const
It reads a single message (string) from a FIFO.
OksSystem::Descriptor * open_r(bool block=true)
It opens the FIFO in read-only mode.
bool exists() const
does the file exist */
File(const std::string &name)
const char * c_full_name() const
void make_fifo(mode_t permissions) const
creates a FIFO (named pipe) */
bool is_fifo() const
is the file a named pipe */
void warning(const Issue &issue)