Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.

Class template basic_pipe



// In header: <boost/process/pipe.hpp>

template<typename CharT, typename Traits = std::char_traits<CharT> > 
class basic_pipe {
  // types
  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;     
  typedef unspecified      native_handle;

  // construct/copy/destruct
  explicit basic_pipe(const std::string &);
  basic_pipe(const basic_pipe &);
  basic_pipe(basic_pipe &&);
  basic_pipe & operator=(const basic_pipe &);
  basic_pipe & operator=(basic_pipe &&);

  // public member functions
  native_handle native_source() const;
  native_handle native_sink() const;
  void assign_source(native_handle);
  void assign_sink(native_handle);
  int_type write(const char_type *, int_type);
  int_type read(char_type *, int_type);
  bool is_open();
  void close();


Class implementation of a pipe.

basic_pipe public construct/copy/destruct

  1. basic_pipe();
    Default construct the pipe. Will be opened.
  2. explicit basic_pipe(const std::string & name);
    Construct a named pipe.
  3. basic_pipe(const basic_pipe & p);

    Copy construct the pipe.

    [Note] Note

    Duplicated the handles.

  4. basic_pipe(basic_pipe && lhs);

    Move construct the pipe.

  5. basic_pipe & operator=(const basic_pipe & p);

    Copy assign the pipe.

    [Note] Note

    Duplicated the handles.

  6. basic_pipe & operator=(basic_pipe && lhs);

    Move assign the pipe.

  7. ~basic_pipe();

    Destructor closes the handles.

basic_pipe public member functions

  1. native_handle native_source() const;

    Get the native handle of the source.

  2. native_handle native_sink() const;

    Get the native handle of the sink.

  3. void assign_source(native_handle h);

    Assign a new value to the source

  4. void assign_sink(native_handle h);

    Assign a new value to the sink

  5. int_type write(const char_type * data, int_type count);
    Write data to the pipe.
  6. int_type read(char_type * data, int_type count);
    Read data from the pipe.
  7. bool is_open();
    Check if the pipe is open.
  8. void close();
    Close the pipe.