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>
22int get_modified_time(
const std::string& path);
70 void addError(
const std::string& r,
const std::string& msg=
"");
135 void writelog(
const std::string& msg);
146 void warnlog(
const std::string& warning,
const std::string& msg);
217 void addError(
const std::string& r,
const std::string& msg=
"") {
288 return boost::algorithm::join(
inputDirs, sep);
328 long int readStringRegistryKey(
const std::string& keyName,
const std::string& valueName,
329 std::string& value,
const std::string& defaultValue);
343 void warnlog(
const std::string& warning,
const std::string& msg) {
344 pMessenger->
warnlog(warning, msg);
351 void warn_deprecated(
const std::string& method,
const std::string& extra=
"");
356 m_suppress_deprecation_warnings =
true;
357 m_fatal_deprecation_warnings =
false;
363 m_fatal_deprecation_warnings =
true;
370 void warn(
const std::string& warning,
371 const std::string& method,
const std::string& extra=
"");
376 m_suppress_warnings =
true;
377 m_fatal_warnings =
false;
382 return m_suppress_warnings;
388 m_fatal_warnings =
true;
394 m_suppress_thermo_warnings = suppress;
399 return m_suppress_thermo_warnings;
422 m_use_legacy_rate_constants = legacy;
427 return m_use_legacy_rate_constants;
482 std::map<std::string, std::pair<XML_Node*, int> >
xmlfiles;
487 bool m_suppress_deprecation_warnings;
488 bool m_fatal_deprecation_warnings;
489 bool m_suppress_thermo_warnings;
490 bool m_suppress_warnings;
491 bool m_fatal_warnings;
492 bool m_use_legacy_rate_constants;
Class to carry out messages.
std::vector< std::string > errorMessage
Current list of error messages.
std::unique_ptr< Logger > logwriter
Current pointer to the logwriter.
void writelogendl()
Write an end of line character to the screen and flush output.
Class that stores thread messages for each thread, and retrieves them based on the thread id.
std::map< std::thread::id, pMessages_t > threadMsgMap_t
Typedef for map between a thread and the message.
ThreadMessages()
Constructor.
Messages * operator->()
Provide a pointer dereferencing overloaded operator.
threadMsgMap_t m_threadMsgMap
Thread Msg Map.
void removeThreadMessages()
Remove a local thread message.
Class to hold global data.
bool warnings_suppressed()
Returns true if warnings should be suppressed.
void warn(const std::string &warning, const std::string &method, const std::string &extra="")
Generate a general purpose warning; repeated warnings are not suppressed.
std::set< std::string > warnings
Vector of deprecation warnings that have been emitted (to suppress duplicates)
void use_legacy_rate_constants(bool legacy=true)
Set definition used for rate constant calculation.
XML_Node * get_XML_File(const std::string &file, int debug=0)
Return a pointer to the XML tree for a Cantera input file.
static Application * s_app
Pointer to the single Application instance.
void suppress_deprecation_warnings()
Globally disable printing of deprecation warnings.
void writelog(const std::string &msg)
Write a message to the screen.
std::vector< std::string > inputDirs
Current vector of input directories to search for input files.
void addError(const std::string &r, const std::string &msg="")
Set an error condition in the application class without throwing an exception.
bool thermo_warnings_suppressed()
Returns true if thermo warnings should be suppressed.
void make_warnings_fatal()
Turns Cantera warnings into exceptions.
void setLogger(Logger *logwriter)
Install a logger.
void warnlog(const std::string &warning, const std::string &msg)
Write a warning message to the screen.
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 logErrors()
Prints all of the error messages using writelog.
virtual ~Application()
Destructor for class deletes global data.
XML_Node * get_XML_from_string(const std::string &text)
Read a CTI or CTML string and fill up an XML tree.
std::string lastErrorMessage()
Retrieve the last error message in a string.
bool legacy_rate_constants_used()
Returns true if legacy rate constant definition should be used.
void close_XML_File(const std::string &file)
Close an XML File.
void suppress_warnings()
Globally disable printing of (user) warnings.
void thread_complete()
Delete and free memory allocated per thread in multithreaded applications.
std::map< std::string, std::pair< XML_Node *, int > > xmlfiles
Current vector of XML file trees that have been previously parsed The second element of the value is ...
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.
void warn_deprecated(const std::string &method, const std::string &extra="")
Print a warning indicating that method is deprecated.
int getErrorCount()
Return the number of errors that have been encountered so far.
Application()
Constructor for class sets up the initial conditions Protected ctor access thru static member functio...
void writelogendl()
Write an endl to the screen and flush output.
static void ApplicationDestroy()
Static function that destroys the application class's data.
void popError()
Discard the last error message.
Base class for 'loggers' that write text messages to log files.
Class XML_Node is a tree-based representation of the contents of an XML file.
void addError(const std::string &r, const std::string &msg="")
Set an error condition in the application class without throwing an exception.
void logErrors()
Prints all of the error messages using writelog.
std::string lastErrorMessage()
Retrieve the last error message in a string.
void getErrors(std::ostream &f)
Prints all of the error messages to an ostream.
int getErrorCount()
Return the number of errors that have been encountered so far.
void popError()
Discard the last error message.
void writelog(const std::string &msg)
Write a message to the screen.
void setLogger(Logger *logwriter)
Install a logger.
void warnlog(const std::string &warning, const std::string &msg)
Write a warning message to the screen.
Header for Base class for 'loggers' that write text messages to log files (see Writing messages to th...
Namespace for the Cantera kernel.