class mrpt::io::CPipe

A pipe, portable across different OS.

Pipes can be used as intraprocess (inter-threads) or interprocess communication mechanism. Read more on pipes here: http://www.gnu.org/software/libc/manual/html_node/Pipes-and-FIFOs.html

std::unique_ptr<CPipeReadEndPoint>  read_pipe;
std::unique_ptr<CPipeWriteEndPoint> write_pipe;

CPipe::createPipe(read_pipe,write_pipe);

See also the example: MRPT/samples/threadsPipe/

#include <mrpt/io/CPipe.h>

class CPipe
{
public:
    //
methods

    template <typename ReadPtr, typename WritePtr>
    static void createPipe(
        ReadPtr& outReadPipe,
        WritePtr& outWritePipe
        );

    static void initializePipe(CPipeReadEndPoint& outReadPipe, CPipeWriteEndPoint& outWritePipe);
};

Methods

template <typename ReadPtr, typename WritePtr>
static void createPipe(
    ReadPtr& outReadPipe,
    WritePtr& outWritePipe
    )

Creates a new pipe and returns the read & write end-points as newly allocated objects.

Parameters:

std::exception

On any error during the pipe creation Creates a new pipe and returns the read & write end-points as newly allocated objects.

static void initializePipe(CPipeReadEndPoint& outReadPipe, CPipeWriteEndPoint& outWritePipe)

Creates a new pipe and returns the read & write end-points as newly allocated objects.