Pipe.hpp

This File On Github
Ask A Question

API: latest
module: oatpp
#include "oatpp/network/virtual_/Pipe.hpp"

Pipe

Virtual pipe implementation. Can be used for unidirectional data transfer between different threads of the same process.
Under the hood it uses oatpp::data::buffer::SynchronizedFIFOBuffer over the oatpp::data::buffer::IOBuffer.

namespace oatpp { namespace network { namespace virtual_ { 
  class Pipe : public oatpp::base::Countable {}
}}}

Methods

Return Type Name Summary
[none] Pipe Constructor.
std::shared_ptr<Pipe> createShared Create shared pipe.
[none] ~Pipe Virtual destructor.
Writer* getWriter Get pointer to Pipe::Writer for this pipe.
Reader* getReader Get pointer to Pipe::Reader for this pipe.
void close Mark pipe as closed.

Pipe::Pipe

Constructor.

Pipe()

Pipe::createShared

Create shared pipe.

  • @return - std::shared_ptr to Pipe.

static std::shared_ptr<Pipe> createShared()

Pipe::~Pipe

Virtual destructor.

virtual ~Pipe()

Pipe::getWriter

Get pointer to Pipe::Writer for this pipe. There can be only one Pipe::Writer per pipe.

Writer* getWriter()

Pipe::getReader

Get pointer to Pipe::Reader for this pipe. There can be only one Pipe::Reader per pipe.

Reader* getReader()

Pipe::close

Mark pipe as closed.

void close()

Pipe::Reader

Pipe Reader. Extends oatpp::data::stream::InputStream. Provides read interface for the pipe. Can work in both blocking and nonblocking regime.

namespace oatpp { namespace network { namespace virtual_ { 
  class Pipe : public oatpp::base::Countable {
    class Reader : public oatpp::data::stream::InputStream {}
  };
}}}

Methods

Return Type Name Summary
void setMaxAvailableToRead Limit the available amount of bytes to read from pipe.
data::v_io_size read Implements oatpp::data::stream::InputStream::read() method.
oatpp::async::Action suggestInputStreamAction Implementation of InputStream must suggest async actions for I/O results.
void setInputStreamIOMode Set InputStream I/O mode.
oatpp::data::stream::IOMode getInputStreamIOMode Get InputStream I/O mode.
void notifyWaitList Notify coroutine wait-list

Pipe::Reader::setMaxAvailableToRead

Limit the available amount of bytes to read from pipe.
This method is used for testing purposes only.
set to -1 in order to ignore this value.

  • @param maxAvailableToRead - maximum available amount of bytes to read.

void setMaxAvailableToRead(data::v_io_size maxAvailableToRead)

Pipe::Reader::read

Implements oatpp::data::stream::InputStream::read() method. Read data from pipe.

  • @param data - buffer to read data to.
  • @param count - max count of bytes to read.
  • @return - oatpp::data::v_io_size.

data::v_io_size read(void *data, data::v_io_size count) override

Pipe::Reader::suggestInputStreamAction

Implementation of InputStream must suggest async actions for I/O results. Suggested Action is used for scheduling coroutines in async::Executor.

oatpp::async::Action suggestInputStreamAction(data::v_io_size ioResult) override

Pipe::Reader::setInputStreamIOMode

Set InputStream I/O mode.

  • @param ioMode

void setInputStreamIOMode(oatpp::data::stream::IOMode ioMode) override

Pipe::Reader::getInputStreamIOMode

Get InputStream I/O mode.

  • @return

oatpp::data::stream::IOMode getInputStreamIOMode() override

Pipe::Reader::notifyWaitList

Notify coroutine wait-list

void notifyWaitList()

Pipe::Writer

Pipe writer. Extends oatpp::data::stream::OutputStream. Provides write interface for the pipe. Can work in both blocking and nonblocking regime.

namespace oatpp { namespace network { namespace virtual_ { 
  class Pipe : public oatpp::base::Countable {
    class Writer : public oatpp::data::stream::OutputStream {}
  };
}}}

Methods

Return Type Name Summary
void setMaxAvailableToWrite Limit the available space for data writes in pipe.
data::v_io_size write Implements oatpp::data::stream::OutputStream::write() method.
oatpp::async::Action suggestOutputStreamAction Implementation of OutputStream must suggest async actions for I/O results.
void setOutputStreamIOMode Set OutputStream I/O mode.
oatpp::data::stream::IOMode getOutputStreamIOMode Set OutputStream I/O mode.
void notifyWaitList Notify coroutine wait-list

Pipe::Writer::setMaxAvailableToWrite

Limit the available space for data writes in pipe.
This method is used for testing purposes only.
set to -1 in order to ignore this value.

  • @param maxAvailableToWrite - maximum available amount of bytes to write.

void setMaxAvailableToWrite(data::v_io_size maxAvailableToWrite)

Pipe::Writer::write

Implements oatpp::data::stream::OutputStream::write() method. Write data to pipe.

data::v_io_size write(const void *data, data::v_io_size count) override

Pipe::Writer::suggestOutputStreamAction

Implementation of OutputStream must suggest async actions for I/O results. Suggested Action is used for scheduling coroutines in async::Executor.

oatpp::async::Action suggestOutputStreamAction(data::v_io_size ioResult) override

Pipe::Writer::setOutputStreamIOMode

Set OutputStream I/O mode.

  • @param ioMode

void setOutputStreamIOMode(oatpp::data::stream::IOMode ioMode) override

Pipe::Writer::getOutputStreamIOMode

Set OutputStream I/O mode.

  • @return

oatpp::data::stream::IOMode getOutputStreamIOMode() override

Pipe::Writer::notifyWaitList

Notify coroutine wait-list

void notifyWaitList()