CppCommon
1.0.4.1
C++ Common Library
|
#include <pipe.h>
Public Member Functions | |
Pipe () | |
Pipe (const Pipe &)=delete | |
Pipe (Pipe &&pipe)=delete | |
virtual | ~Pipe () |
Pipe & | operator= (const Pipe &)=delete |
Pipe & | operator= (Pipe &&pipe)=delete |
void * | reader () const noexcept |
Get the native read endpoint handler. More... | |
void * | writer () const noexcept |
Get the native write endpoint handler. More... | |
bool | IsPipeOpened () const noexcept |
Is pipe opened for reading or writing? More... | |
bool | IsPipeReadOpened () const noexcept |
Is pipe opened for reading? More... | |
bool | IsPipeWriteOpened () const noexcept |
Is pipe opened for writing? More... | |
size_t | Read (void *buffer, size_t size) override |
Read a bytes buffer from the pipe. More... | |
size_t | Write (const void *buffer, size_t size) override |
Write a byte buffer into the pipe. More... | |
void | CloseRead () |
Close the read pipe endpoint. More... | |
void | CloseWrite () |
Close the write pipe endpoint. More... | |
void | Close () |
Close all pipe endpoints. More... | |
void | swap (Pipe &pipe) noexcept |
Swap two instances. More... | |
std::vector< uint8_t > | ReadAllBytes () |
Read all bytes. More... | |
std::string | ReadAllText () |
Read all text. More... | |
std::vector< std::string > | ReadAllLines () |
Read all text lines. More... | |
virtual size_t | Write (const void *buffer, size_t size)=0 |
Write a byte buffer base method. More... | |
size_t | Write (const std::string &text) |
Write a text string. More... | |
size_t | Write (const std::vector< std::string > &lines) |
Write text lines. More... | |
Public Member Functions inherited from CppCommon::Reader | |
Reader () noexcept=default | |
Reader (const Reader &) noexcept=default | |
Reader (Reader &&) noexcept=default | |
virtual | ~Reader () noexcept=default |
Reader & | operator= (const Reader &) noexcept=default |
Reader & | operator= (Reader &&) noexcept=default |
std::vector< uint8_t > | ReadAllBytes () |
Read all bytes. More... | |
std::string | ReadAllText () |
Read all text. More... | |
std::vector< std::string > | ReadAllLines () |
Read all text lines. More... | |
Public Member Functions inherited from CppCommon::Writer | |
Writer () noexcept=default | |
Writer (const Writer &) noexcept=default | |
Writer (Writer &&) noexcept=default | |
virtual | ~Writer () noexcept=default |
Writer & | operator= (const Writer &) noexcept=default |
Writer & | operator= (Writer &&) noexcept=default |
size_t | Write (const std::string &text) |
Write a text string. More... | |
size_t | Write (const std::vector< std::string > &lines) |
Write text lines. More... | |
virtual void | Flush () |
Flush the writer. More... | |
Friends | |
void | swap (Pipe &pipe1, Pipe &pipe2) noexcept |
Pipe.
A pipe is a section of shared memory that processes use for communication. The process that creates a pipe is the pipe server. A process that connects to a pipe is a pipe client. One process writes information to the pipe, then the other process reads the information from the pipe. This overview describes how to create, manage, and use pipes.
Not thread-safe.
|
delete |
|
delete |
void CppCommon::Pipe::CloseRead | ( | ) |
void CppCommon::Pipe::CloseWrite | ( | ) |
|
noexcept |
|
noexcept |
|
noexcept |
|
overridevirtual |
Read a bytes buffer from the pipe.
If the pipe is not opened for reading the method will raise a system exception!
buffer | - Buffer to read |
size | - Buffer size |
Implements CppCommon::Reader.
std::vector< uint8_t > CppCommon::Reader::ReadAllBytes |
std::vector< std::string > CppCommon::Reader::ReadAllLines |
std::string CppCommon::Reader::ReadAllText |
Read all text.
Definition at line 51 of file reader.cpp.
|
noexcept |
|
noexcept |
size_t CppCommon::Writer::Write |
Write a text string.
text | - Text string |
Definition at line 46 of file writer.cpp.
size_t CppCommon::Writer::Write |
Write text lines.
lines | - Text lines |
Definition at line 52 of file writer.cpp.
|
overridevirtual |
Write a byte buffer into the pipe.
If the pipe is not opened for writing the method will raise a system exception!
buffer | - Buffer to write |
size | - Buffer size |
Implements CppCommon::Writer.
virtual size_t CppCommon::Writer::Write |
Write a byte buffer base method.
buffer | - Buffer to write |
size | - Buffer size |
|
noexcept |