39#include "blocxx/BLOCXX_config.h"
46#ifdef BLOCXX_HAVE_UNISTD_H
52#include "blocxx/WinUnnamedPipe.hpp"
55#include <sys/socket.h>
72 return this->
write(&value,
sizeof(
int));
79 int len =
static_cast<int>(strData.
length()+1);
80 if ((rc = this->
writeInt(len)) != -1)
90 return this->
read(value,
sizeof(
int));
99 if ((rc = this->
readInt(&len)) != -1)
104 if ((rc = this->
read(p.
get(), len)) != -1)
123 }
while (readbytes > 0);
133 return WinUnnamedPipe::createUnnamedPipe(doOpen);
145 return WinUnnamedPipe::createStdin();
162 return WinUnnamedPipe::createStdout();
179 return WinUnnamedPipe::createStdinStdout();
201 return WinUnnamedPipe::createStderr();
218 return WinUnnamedPipe::createUnnamedPipeFromDescriptor(inputAndOutput);
235 return WinUnnamedPipe::createUnnamedPipeFromDescriptor(input, output);
247 return WinUnnamedPipe::createConnectedPipes(first, second);
250 if (::socketpair(AF_UNIX, SOCK_STREAM, 0, fds) == -1)
#define BLOCXX_DEFINE_EXCEPTION_WITH_ID(NAME)
Define a new exception class named <NAME>Exception that derives from Exception.
#define BLOCXX_THROW_ERRNO_MSG(exType, msg)
Throw an exception using FILE, LINE, errno and strerror(errno)
#define BLOCXX_INVALID_HANDLE
The AutoPtrVec class provides a simple class for smart pointers to a dynamically allocated array of o...
X * release()
Release ownership of the underlying array.
PURPOSE: The AutoResource class template is an analog of std::auto_ptr for managing arbitrary resourc...
handle_type get() const
Return handle of resource, retaining ownership.
virtual int write(const void *dataOut, int dataOutLen, ErrorAction errorAsException=E_RETURN_ON_ERROR)=0
Write a specified number of bytes to the device that is exposing the IOIFC interface.
virtual int read(void *dataIn, int dataInLen, ErrorAction errorAsException=E_RETURN_ON_ERROR)=0
Read a specified number of bytes from the device that is exposing the IOIFC interface.
This String class is an abstract data type that represents as NULL terminated string of characters.
const char * c_str() const
Abstract interface for an UnnamedPipe.
int readString(String &strData)
Reads a String from the pipe.
static UnnamedPipeRef createStdinStdout()
Create an instance of the concrete class that implements the UnnamedPipe interface connected to stdin...
static void createConnectedPipes(UnnamedPipeRef &first, UnnamedPipeRef &second)
Create a connected pair of pipes.
static UnnamedPipeRef createStdout()
Create an instance of the concrete class that implements the UnnamedPipe interface connected to stdou...
int readInt(int *value)
Reads an int (native binary representation) from the pipe.
static UnnamedPipeRef createUnnamedPipe(EOpen doOpen=E_OPEN)
Create an instance of the concrete class that implements the UnnamedPipe interface.
int writeString(const String &strData)
Writes a String to the pipe.
int writeInt(int value)
Write an int (native binary representation) to the pipe.
static UnnamedPipeRef createStdin()
Create an instance of the concrete class that implements the UnnamedPipe interface connected to stdin...
String readAll()
Read from the pipe and collect into a string, until the other end of the pipe is closed.
static UnnamedPipeRef createUnnamedPipeFromDescriptor(AutoDescriptor inputAndOutput)
Create an instance of the concrete class that implements the UnnamedPipe interface connected bidirect...
static UnnamedPipeRef createStderr()
Create an instance of the concrete class that implements the UnnamedPipe interface connected to stder...
IntrusiveReference< UnnamedPipe > UnnamedPipeRef
AutoResource< AutoDescriptorPolicy > AutoDescriptor
An analog of std::auto_ptr for descriptors.