...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::process::basic_pipebuf
// In header: <boost/process/pipe.hpp> template<typename CharT, typename Traits = std::char_traits<CharT> > struct basic_pipebuf : public std::basic_streambuf< CharT, Traits > { // types typedef basic_pipe< CharT, Traits > pipe_type; typedef CharT char_type; typedef Traits traits_type; typedef Traits::int_type int_type; typedef Traits::pos_type pos_type; typedef Traits::off_type off_type; // construct/copy/destruct basic_pipebuf(); basic_pipebuf(const basic_pipebuf &) = default; basic_pipebuf(basic_pipebuf &&) = default; basic_pipebuf(pipe_type &&); basic_pipebuf(const pipe_type &); basic_pipebuf & operator=(const basic_pipebuf &) = delete; basic_pipebuf & operator=(basic_pipebuf &&) = default; basic_pipebuf & operator=(pipe_type &&); basic_pipebuf & operator=(const pipe_type &); ~basic_pipebuf(); // public member functions int_type overflow(int_type = traits_type::eof()); int sync(); int_type underflow(); void pipe(pipe_type &&); void pipe(const pipe_type &); pipe_type & pipe(); const pipe_type & pipe() const; pipe_type && pipe(); bool is_open() const; basic_pipebuf< CharT, Traits > * open(); basic_pipebuf< CharT, Traits > * open(const std::string &); basic_pipebuf< CharT, Traits > * close(); // private member functions bool _write_impl(); // public data members static constexpr int default_buffer_size; };
Implementation of the stream buffer for a pipe.
basic_pipebuf
public
construct/copy/destructbasic_pipebuf();Default constructor, will also construct the pipe.
basic_pipebuf(const basic_pipebuf &) = default;Copy Constructor.
basic_pipebuf(basic_pipebuf &&) = default;Move Constructor.
basic_pipebuf(pipe_type && p);Move construct from a pipe.
basic_pipebuf(const pipe_type & p);Construct from a pipe.
basic_pipebuf & operator=(const basic_pipebuf &) = delete;Copy assign.
basic_pipebuf & operator=(basic_pipebuf &&) = default;Move assign.
basic_pipebuf & operator=(pipe_type && p);Move assign a pipe.
basic_pipebuf & operator=(const pipe_type & p);Copy assign a pipe.
~basic_pipebuf();Destructor -> writes the frest of the data.
basic_pipebuf
public member functionsint_type overflow(int_type ch = traits_type::eof());Writes characters to the associated output sequence from the put area.
int sync();Synchronizes the buffers with the associated character sequence.
int_type underflow();Reads characters from the associated input sequence to the get area.
void pipe(pipe_type && p);Set the pipe of the streambuf.
void pipe(const pipe_type & p);Set the pipe of the streambuf.
pipe_type & pipe();Get a reference to the pipe.
const pipe_type & pipe() const;Get a const reference to the pipe.
pipe_type && pipe();Get a rvalue reference to the pipe. Qualified as rvalue.
bool is_open() const;Check if the pipe is open.
basic_pipebuf< CharT, Traits > * open();Open a new pipe.
basic_pipebuf< CharT, Traits > * open(const std::string & name);Open a new named pipe.
basic_pipebuf< CharT, Traits > * close();Flush the buffer & close the pipe.