6#ifndef CT_BASE_APPLICATION_H
7#define CT_BASE_APPLICATION_H
9#include "cantera/base/config.h"
12#include <boost/algorithm/string/join.hpp>
64 void addError(
const string& r,
const string& msg=
"");
168 void addError(
const string& r,
const string& msg=
"") {
239 return boost::algorithm::join(
inputDirs, sep);
250 void loadExtension(
const string& extType,
const string& name);
259 long int readStringRegistryKey(
const string& keyName,
const string& valueName,
260 string& value,
const string& defaultValue);
286 void warnlog(
const string& warning,
const string& msg);
297 m_suppress_deprecation_warnings =
true;
298 m_fatal_deprecation_warnings =
false;
304 m_fatal_deprecation_warnings =
true;
311 void warn(
const string& warning,
const string& method,
const string& extra=
"");
316 m_suppress_warnings =
true;
317 m_fatal_warnings =
false;
322 return m_suppress_warnings;
328 m_fatal_warnings =
true;
334 m_suppress_thermo_warnings = suppress;
339 return m_suppress_thermo_warnings;
353 m_use_legacy_rate_constants = legacy;
358 return m_use_legacy_rate_constants;
383 void setLogger(unique_ptr<Logger> logwriter);
430 bool m_suppress_deprecation_warnings =
false;
431 bool m_fatal_deprecation_warnings =
false;
432 bool m_suppress_thermo_warnings =
false;
433 bool m_suppress_warnings =
false;
434 bool m_fatal_warnings =
false;
435 bool m_use_legacy_rate_constants =
false;
437 set<pair<string, string>> m_loaded_extensions;
Class to carry out messages.
vector< string > errorMessage
Current list of error messages.
Class that stores thread messages for each thread, and retrieves them based on the thread id.
ThreadMessages()
Constructor.
Messages * operator->()
Provide a pointer dereferencing overloaded operator.
threadMsgMap_t m_threadMsgMap
Thread Msg Map.
map< std::thread::id, pMessages_t > threadMsgMap_t
Typedef for map between a thread and the message.
void removeThreadMessages()
Remove a local thread message.
Class to hold global data.
bool warnings_suppressed()
Returns true if warnings should be suppressed.
void use_legacy_rate_constants(bool legacy=true)
Set definition used for rate constant calculation.
static Application * s_app
Pointer to the single Application instance.
void suppress_deprecation_warnings()
Globally disable printing of deprecation warnings.
vector< string > m_pythonSearchVersions
Versions of Python to consider when attempting to load user extensions.
bool thermo_warnings_suppressed()
Returns true if thermo warnings should be suppressed.
void make_warnings_fatal()
Turns Cantera warnings into exceptions.
unique_ptr< Logger > m_logwriter
Current log writer.
void make_deprecation_warnings_fatal()
Turns deprecation warnings into exceptions.
static Application * Instance()
Return a pointer to the one and only instance of class Application.
void addError(const string &r, const string &msg="")
Set an error condition in the application class without throwing an exception.
void logErrors()
Prints all of the error messages using writelog.
void loadExtension(const string &extType, const string &name)
Load an extension implementing user-defined models.
void warn_deprecated(const string &method, const string &extra="")
Print a warning indicating that method is deprecated.
void searchPythonVersions(const string &versions)
Set the versions of Python to try when loading user-defined extensions, in order of preference.
bool legacy_rate_constants_used()
Returns true if legacy rate constant definition is used.
void suppress_warnings()
Globally disable printing of (user) warnings.
vector< string > inputDirs
Current vector of input directories to search for input files.
void thread_complete()
Delete and free memory allocated per thread in multithreaded applications.
set< string > warnings
Set of deprecation warnings that have been emitted (to suppress duplicates)
void suppress_thermo_warnings(bool suppress=true)
Globally disable printing of warnings about problematic thermo data, such as NASA polynomials with di...
shared_ptr< Messages > pMessages_t
Typedef for thread specific messages.
void getErrors(std::ostream &f)
Prints all of the error messages to an ostream.
string lastErrorMessage()
Retrieve the last error message in a string.
int getErrorCount()
Return the number of errors that have been encountered so far.
virtual ~Application()
Destructor for class deletes global data.
Application()
Constructor for class sets up the initial conditions Protected ctor access thru static member functio...
void writelogendl()
Write an end of line character to the logger and flush output.
static void ApplicationDestroy()
Static function that destroys the application class's data.
void warn(const string &warning, const string &method, const string &extra="")
Generate a general purpose warning; repeated warnings are not suppressed.
void popError()
Discard the last error message.
Base class for 'loggers' that write text messages to log files.
void addError(const string &r, const string &msg="")
Set an error condition in the application class without throwing an exception.
void logErrors()
Prints all of the error messages using writelog.
void getErrors(std::ostream &f)
Prints all of the error messages to an ostream.
string lastErrorMessage()
Retrieve the last error message in a string.
int getErrorCount()
Return the number of errors that have been encountered so far.
void popError()
Discard the last error message.
void warnlog(const string &warning, const string &msg)
Write a warning message to the logger.
void setLogger(Logger *logwriter)
Install a logger.
void writelog(const string &msg)
Write a message to the logger.
Header for Base class for 'loggers' that write text messages to log files (see Logging and class Logg...
Namespace for the Cantera kernel.