![]() |
TSDuck v3.44-4659
MPEG Transport Stream Toolkit
|
Temporarily modify the Report of a ReporterBase object. More...
#include <tsReporterGuard.h>
Public Member Functions | |
| ReporterGuard (ReporterBase &base, Report *replacement) | |
| Constructor. | |
| ~ReporterGuard () | |
| Destructor. | |
Temporarily modify the Report of a ReporterBase object.
This "guard" class uses the RAII pattern (Resource Acquisition Is Initialization) to replace the Report of a ReporterBase object during its initialization and restores the previous Report in its destructor. Somehow, ReporterGuard acts on ReporterBase as std::lock_guard acts on std::mutex.
| ts::ReporterGuard::ReporterGuard | ( | ReporterBase & | base, |
| Report * | replacement | ||
| ) |
Constructor.
| [in] | base | ReporterBase object for which the report is modified. |
| [in] | replacement | Temporary Report to set on base. Use nullptr to drop reported messages. |
| ts::ReporterGuard::~ReporterGuard | ( | ) |
Destructor.
The Report that was used in base before the constructor of this object is restored.