Go to the documentation of this file.
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>
22 int 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);
209 void addError(
const std::string& r,
const std::string& msg=
"") {
280 return boost::algorithm::join(
inputDirs, sep);
320 long int readStringRegistryKey(
const std::string& keyName,
const std::string& valueName,
321 std::string& value,
const std::string& defaultValue);
338 void warn_deprecated(
const std::string& method,
const std::string& extra=
"");
343 m_suppress_deprecation_warnings =
true;
344 m_fatal_deprecation_warnings =
false;
350 m_fatal_deprecation_warnings =
true;
355 void warn_user(
const std::string& method,
const std::string& extra=
"");
360 m_suppress_thermo_warnings = suppress;
365 return m_suppress_thermo_warnings;
420 std::map<std::string, std::pair<XML_Node*, int> >
xmlfiles;
425 bool m_suppress_deprecation_warnings;
426 bool m_fatal_deprecation_warnings;
427 bool m_suppress_thermo_warnings;
std::map< std::thread::id, pMessages_t > threadMsgMap_t
Typedef for map between a thread and the message.
void popError()
Discard the last error message.
void suppress_deprecation_warnings()
Globally disable printing of deprecation warnings.
void logErrors()
Prints all of the error messages using writelog.
void warn_deprecated(const std::string &method, const std::string &extra="")
Print a warning indicating that method is deprecated.
void warn_user(const std::string &method, const std::string &extra="")
Print a user warning arising during usage of method.
std::set< std::string > warnings
Vector of deprecation warnings that have been emitted (to suppress duplicates)
Application()
Constructor for class sets up the initial conditions Protected ctor access thru static member functio...
Base class for 'loggers' that write text messages to log files.
XML_Node * get_XML_File(const std::string &file, int debug=0)
Return a pointer to the XML tree for a Cantera input file.
void thread_complete()
Delete and free memory allocated per thread in multithreaded applications.
void getErrors(std::ostream &f)
Prints all of the error messages to an ostream.
ThreadMessages()
Constructor.
static Application * Instance()
Return a pointer to the one and only instance of class Application.
std::string lastErrorMessage()
Retrieve the last error message in a string.
void addError(const std::string &r, const std::string &msg="")
Set an error condition in the application class without throwing an exception.
static void ApplicationDestroy()
Static function that destroys the application class's data.
bool thermo_warnings_suppressed()
Returns true if thermo warnings should be suppressed.
void logErrors()
Prints all of the error messages using writelog.
void setLogger(Logger *logwriter)
Install a logger.
void close_XML_File(const std::string &file)
Close an XML File.
void make_deprecation_warnings_fatal()
Turns deprecation warnings into exceptions.
Class that stores thread messages for each thread, and retrieves them based on the thread id.
void suppress_thermo_warnings(bool suppress=true)
Globally disable printing of warnings about problematic thermo data, e.g.
int getErrorCount()
Return the number of errors that have been encountered so far.
void popError()
Discard the last error message.
void removeThreadMessages()
Remove a local thread message.
void writelogendl()
Write an end of line character to the screen and flush output.
void setLogger(Logger *logwriter)
Install a logger.
std::vector< std::string > errorMessage
Current list of error messages.
Class to hold global data.
virtual ~Application()
Destructor for class deletes global data.
Class XML_Node is a tree-based representation of the contents of an XML file.
void writelogendl()
Write an endl to the screen and flush output.
static Application * s_app
Pointer to the single Application instance.
void addError(const std::string &r, const std::string &msg="")
Set an error condition in the application class without throwing an exception.
std::string lastErrorMessage()
Retrieve the last error message in a string.
XML_Node * get_XML_from_string(const std::string &text)
Read a CTI or CTML string and fill up an XML tree.
std::vector< std::string > inputDirs
Current vector of input directories to search for input files.
int getErrorCount()
Return the number of errors that have been encountered so far.
Messages * operator->()
Provide a pointer dereferencing overloaded operator.
Class to carry out messages.
void writelog(const std::string &msg)
Write a message to the screen.
void writelog(const std::string &msg)
Write a message to the screen.
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 getErrors(std::ostream &f)
Prints all of the error messages to an ostream.
shared_ptr< Messages > pMessages_t
Typedef for thread specific messages.
Namespace for the Cantera kernel.
std::unique_ptr< Logger > logwriter
Current pointer to the logwriter.
threadMsgMap_t m_threadMsgMap
Thread Msg Map.