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