Teuchos - Trilinos Tools Package
Version of the Day
|
Interface by which CommandLineProcessor may use TimeMonitor. More...
#include <Teuchos_CommandLineProcessor.hpp>
Public Member Functions | |
virtual | ~TimeMonitorSurrogate () |
! brief. More... | |
virtual void | summarize (std::ostream &out=std::cout)=0 |
Summarize timings over all process(es) to the given output stream. More... | |
Interface by which CommandLineProcessor may use TimeMonitor.
This class provides an interface by which CommandLineProcessor may optionally call TimeMonitor::summarize(), without needing to know that the TimeMonitor class exists. This allows Teuchos to put CommandLineProcessor in a separate package from TimeMonitor. We want to do this because TimeMonitor depends on Comm, and is therefore in the TeuchosComm subpackage, but CommandLineProcessor does not depend on Comm, and is therefore in a different subpackage. This design lets CommandLineProcessor automatically support showing summary timings just by having the TeuchosComm subpackage enabled and having its libaries linked in.
The TimeMonitorSurrogateImplInserter class in the TeuchosComm subpackage will ensure that CommandLineProcessor gets informed about TimeMonitor even before the program starts executing main(). This happens automatically; you don't need to change the main() function.
This is an instance of the Dependency injection design pattern. CommandLineProcessor is not supposed to know about TimeMonitor, because CommandLineProcessor's subpackage does not depend on TimeMonitor's subpackage. Thus, CommandLineProcessor interacts with TimeMonitor through the TimeMonitorSurrogate interface.
Definition at line 634 of file Teuchos_CommandLineProcessor.hpp.
|
inlinevirtual |
! brief.
Definition at line 637 of file Teuchos_CommandLineProcessor.hpp.
|
pure virtual |
Summarize timings over all process(es) to the given output stream.