# 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.
v_io_size read Implements oatpp::data::stream::InputStream::read method.
void setInputStreamIOMode Set InputStream I/O mode.
oatpp::data::stream::IOMode getInputStreamIOMode Get InputStream I/O mode.
oatpp::data::stream::Context& getInputStreamContext Get stream context.
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(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.
  • @param action - async specific action. If action is NOT oatpp::async::Action::TYPE_NONE, then caller MUST return this action on coroutine iteration.
  • @return - oatpp::v_io_size.

v_io_size read(void *data, v_buff_size count, async::Action& action) 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::getInputStreamContext

Get stream context.

  • @return

oatpp::data::stream::Context& getInputStreamContext() 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.
v_io_size write Implements oatpp::data::stream::OutputStream::write method.
void setOutputStreamIOMode Set OutputStream I/O mode.
oatpp::data::stream::IOMode getOutputStreamIOMode Set OutputStream I/O mode.
oatpp::data::stream::Context& getOutputStreamContext Get stream context.
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(v_io_size maxAvailableToWrite)

# Pipe::Writer::write

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

  • @param data - data to write to pipe.
  • @param count - data size.
  • @param action - async specific action. If action is NOT oatpp::async::Action::TYPE_NONE, then caller MUST return this action on coroutine iteration.
  • @return - oatpp::v_io_size.

v_io_size write(const void *data, v_buff_size count, async::Action& action) 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::getOutputStreamContext

Get stream context.

  • @return

oatpp::data::stream::Context& getOutputStreamContext() override

# Pipe::Writer::notifyWaitList

Notify coroutine wait-list

void notifyWaitList()