TSDuck v3.40-4033
MPEG Transport Stream Toolkit
|
A class to redirect an input stream. More...
#include <tsInputRedirector.h>
Public Member Functions | |
InputRedirector (const fs::path &name, Args &args, std::istream &stream=std::cin, std::ios::openmode mode=std::ios::binary) | |
Constructor, the input redirection is automatically started. | |
~InputRedirector () | |
Destructor, the input redirection is terminated and restore the previous stream. | |
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.
ts::InputRedirector::InputRedirector | ( | const fs::path & | name, |
Args & | args, | ||
std::istream & | stream = std::cin , |
||
std::ios::openmode | mode = std::ios::binary |
||
) |
Constructor, the input redirection is automatically started.
[in] | name | File name from which the input is redirected. If empty, the input stream stream is not redirected. |
[in,out] | args | Used to report errors and exit application on error. |
[in,out] | stream | The input stream to redirect, std::cin by default. |
[in,out] | mode | Mode to use to open the file, std::ios::binary by default. |