Teuchos - Trilinos Tools Package Version of the Day
Loading...
Searching...
No Matches
Teuchos_VerbosityLevel.cpp
1// @HEADER
2// *****************************************************************************
3// Teuchos: Common Tools Package
4//
5// Copyright 2004 NTESS and the Teuchos contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
11#include "Teuchos_Tuple.hpp"
12#include "Teuchos_as.hpp"
13
14
28
29
31{
34 "VERB_DEFAULT",
35 "VERB_NONE",
36 "VERB_LOW",
37 "VERB_MEDIUM",
38 "VERB_HIGH",
39 "VERB_EXTREME"
40 );
41 return verbLevelNamesArray();
42}
43
44
55
56
57std::string Teuchos::toString(const EVerbosityLevel verbLevel)
58{
59 switch (verbLevel) {
60 case VERB_DEFAULT:
61 return "VERB_DEFAULT";
62 case VERB_NONE:
63 return "VERB_NONE";
64 case VERB_LOW:
65 return "VERB_LOW";
66 case VERB_MEDIUM:
67 return "VERB_MEDIUM";
68 case VERB_HIGH:
69 return "VERB_HIGH";
70 case VERB_EXTREME:
71 return "VERB_EXTREME";
72 default:
74 true, std::invalid_argument, "Teuchos::toString(const Teuchos::"
75 "EVerbosityLevel): Input argument " << verbLevel << " has an invalid "
76 "value. Valid values are VERB_DEFAULT=" << VERB_DEFAULT << ", VERB_NONE"
77 "=" << VERB_NONE << ", VERB_LOW=" << VERB_LOW << ", VERB_MEDIUM="
78 << VERB_MEDIUM << ", VERB_HIGH=" << VERB_HIGH << ", AND VERB_EXTREME="
79 << VERB_EXTREME << ".");
80 }
81
82 // NOTE (mfh 15 Sep 2014): Most compilers have figured out that the
83 // return statement below is unreachable. Some older compilers
84 // might not realize this. That's why the return statement was put
85 // there, so that those compilers don't warn that this function
86 // doesn't return a value. If it's a choice between one warning and
87 // another, I would prefer the choice that produces less code and
88 // doesn't have unreachable code (which never gets tested).
89
90 //return ""; // Never get here!
91}
92
93
95 const EVerbosityLevel verbLevel,
97 const bool isDefaultLevel
98 )
99{
100 return (
101 ( as<int>(verbLevel) >= as<int>(requestedVerbLevel) )
102 ||
103 ( verbLevel == VERB_DEFAULT && isDefaultLevel )
104 );
105}
106
107
111 const int numLevels
112 )
113{
115 return VERB_DEFAULT;
117 return VERB_EXTREME;
120 return VERB_NONE;
122 return VERB_EXTREME;
123 // If we get here, then intVerbLevel is a valid verbosity level.
125}
Definition of Teuchos::as, for conversions between types.
Smart reference counting pointer class for automatic garbage collection.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
TEUCHOSCORE_LIB_DLL_EXPORT ArrayView< const EVerbosityLevel > getValidVerbLevels()
TEUCHOSCORE_LIB_DLL_EXPORT ArrayView< const char *const > getValidVerbLevelsNamesRawStrings()
TEUCHOSCORE_LIB_DLL_EXPORT ArrayView< const std::string > getValidVerbLevelsNames()
EVerbosityLevel
Verbosity level.
@ VERB_MEDIUM
Generate more output.
@ VERB_HIGH
Generate a high level of output.
@ VERB_EXTREME
Generate the most output possible.
@ VERB_NONE
Generate no output.
@ VERB_DEFAULT
Generate output as defined by the object.
@ VERB_LOW
Generate only a minimal amount of output.
TEUCHOSCORE_LIB_DLL_EXPORT bool includesVerbLevel(const EVerbosityLevel verbLevel, const EVerbosityLevel requestedVerbLevel, const bool isDefaultLevel=false)
Return true if the verbosity level includes the given level.
TEUCHOSCORE_LIB_DLL_EXPORT EVerbosityLevel incrVerbLevel(const EVerbosityLevel inputVerbLevel, const int numLevels)
Return an increased or decreased verbosity level.
constexpr const int EVerbosityLevel_size