MCPcopy Create free account
hub / github.com/THUNLP-MT/MEAN / pstream_common

Class pstream_common

evaluation/TMscore.cpp:472–529  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

470 /// Class template for common base class.
471 template <typename CharT, typename Traits = std::char_traits<CharT> >
472 class pstream_common
473 : virtual public std::basic_ios<CharT, Traits>
474 , virtual public pstreams
475 {
476 protected:
477 typedef basic_pstreambuf<CharT, Traits> streambuf_type;
478
479 typedef pstreams::pmode pmode;
480 typedef pstreams::argv_type argv_type;
481
482 /// Default constructor.
483 pstream_common();
484
485 /// Constructor that initialises the stream by starting a process.
486 pstream_common(const std::string& cmd, pmode mode);
487
488 /// Constructor that initialises the stream by starting a process.
489 pstream_common(const std::string& file, const argv_type& argv, pmode mode);
490
491 /// Pure virtual destructor.
492 virtual
493 ~pstream_common() = 0;
494
495 /// Start a process.
496 void
497 do_open(const std::string& cmd, pmode mode);
498
499 /// Start a process.
500 void
501 do_open(const std::string& file, const argv_type& argv, pmode mode);
502
503 public:
504 /// Close the pipe.
505 void
506 close();
507
508 /// Report whether the stream's buffer has been initialised.
509 bool
510 is_open() const;
511
512 /// Return the command used to initialise the stream.
513 const std::string&
514 command() const;
515
516 /// Return a pointer to the stream buffer.
517 streambuf_type*
518 rdbuf() const;
519
520#if REDI_EVISCERATE_PSTREAMS
521 /// Obtain FILE pointers for each of the process' standard streams.
522 std::size_t
523 fopen(FILE*& in, FILE*& out, FILE*& err);
524#endif
525
526 protected:
527 std::string command_; ///< The command used to start the process.
528 streambuf_type buf_; ///< The stream buffer.
529 };

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected