TSDuck Version 3.32-2769 (TSDuck - The MPEG Transport Stream Toolkit)
ts::InputRedirector Class Reference

A class to redirect an input stream. More...

Public Member Functions

 InputRedirector (const UString &name, Args &args, std::istream &stream=std::cin, std::ios::openmode mode=std::ios::binary)
 Constructor, the input redirection is automatically started. More...
 ~InputRedirector ()
 Destructor, the input redirection is terminated and restore the previous stream.

Detailed Description

A class to redirect an input stream.

The constructor redirects a specific input stream (std::cin by default) from a given file. The destructor automatically restores the previous input stream.

If the file name is empty, no redirection occurs, making this mechanism quite useful for optional redirection based on command line arguments.

Constructor & Destructor Documentation

◆ InputRedirector()

ts::InputRedirector::InputRedirector ( const UString name,
Args args,
std::istream &  stream = std::cin,
std::ios::openmode  mode = std::ios::binary 

Constructor, the input redirection is automatically started.

[in]nameFile name from which the input is redirected. If empty, the input stream stream is not redirected.
[in,out]argsUsed to report errors and exit application on error.
[in,out]streamThe input stream to redirect, std::cin by default.
[in,out]modeMode to use to open the file, std::ios::binary by default.

The documentation for this class was generated from the following file: