TSDuck v3.38-3675
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches
ts::InputRedirector Class Reference

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.
 

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 fs::path &  name,
Args args,
std::istream &  stream = std::cin,
std::ios::openmode  mode = std::ios::binary 
)

Constructor, the input redirection is automatically started.

Parameters
[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: