Teuchos - Trilinos Tools Package  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | List of all members
Teuchos::TimeMonitorSurrogateImplInserter Class Reference

Injects run-time dependency of a class on TimeMonitor. More...

#include <Teuchos_TimeMonitor.hpp>

Public Member Functions

 TimeMonitorSurrogateImplInserter ()
 Constructor: inject dependency on TimeMonitor into CommandLineProcessor. More...
 

Detailed Description

Injects run-time dependency of a class on TimeMonitor.

Warning
Users should not use this class or rely on it in any way. It is an implementation detail.

Summary

Classes and functions with the name "TimeMonitorSurrogate" in them let CommandLineProcessor 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 (which depends on TeuchosCore), but CommandLineProcessor is in a different subpackage which does not depend on Comm.

The TimeMonitorSurrogateImplInserter class' constructor ensures that CommandLineProcessor gets informed about TimeMonitor even before the program starts executing main(). This happens automatically, without changes to main(), because we declare an instance of this class in the header file. If the TeuchosComm subpackage was built and its libraries were linked in, CommandLineProcessor will know about TimeMonitor.

Note to Teuchos developers

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. TimeMonitorSurrogateImplInserter "injects" the dependency at run time, if the TeuchosComm subpackage was enabled and the application linked with its libraries.

Teuchos developers could imitate the pattern of this class in order to use TimeMonitor's class methods (such as summarize()) from any other class that does not depend on the TeuchosComm subpackage.

Definition at line 830 of file Teuchos_TimeMonitor.hpp.

Constructor & Destructor Documentation

Teuchos::TimeMonitorSurrogateImplInserter::TimeMonitorSurrogateImplInserter ( )
inline

Constructor: inject dependency on TimeMonitor into CommandLineProcessor.

Definition at line 833 of file Teuchos_TimeMonitor.hpp.


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