Cantera  2.1.2
Public Member Functions | Protected Attributes | List of all members
Application::Messages Class Reference

Class to carry out messages. More...

#include <application.h>

Collaboration diagram for Application::Messages:
[legend]

Public Member Functions

 Messages ()
 Constructor for the Messages class. More...
 
 Messages (const Messages &r)
 
Messagesoperator= (const Messages &r)
 
void addError (const std::string &r, const std::string &msg)
 Set an error condition in the application class without throwing an exception. More...
 
int getErrorCount ()
 Return the number of errors that have been encountered so far. More...
 
void popError ()
 Discard the last error message. More...
 
std::string lastErrorMessage ()
 Retrieve the last error message in a string. More...
 
void getErrors (std::ostream &f)
 Prints all of the error messages to an ostream. More...
 
void logErrors ()
 Prints all of the error messages using writelog. More...
 
void writelog (const std::string &msg)
 Write a message to the screen. More...
 
void writelogendl ()
 Write an end of line character to the screen and flush output. More...
 
void logerror (const std::string &msg)
 Write an error message and quit. More...
 
void setLogger (Logger *logwriter)
 Install a logger. More...
 
void beginLogGroup (const std::string &title, int loglevel)
 Create a new group for log messages. More...
 
void addLogEntry (const std::string &tag, const std::string &value)
 Add an entry to an HTML log file. More...
 
void addLogEntry (const std::string &tag, doublereal value)
 Add an entry to an HTML log file. More...
 
void addLogEntry (const std::string &tag, int value)
 Add an entry to an HTML log file. More...
 
void addLogEntry (const std::string &msg)
 Add an entry to an HTML log file. More...
 
void endLogGroup (const std::string &title)
 Close the current group of log messages. More...
 
void write_logfile (const std::string &file)
 Write the HTML log file. More...
 

Protected Attributes

std::vector< std::string > errorMessage
 Current list of error messages. More...
 
std::vector< std::string > errorRoutine
 Current error Routine. More...
 
Loggerlogwriter
 Current pointer to the logwriter. More...
 
XML_Nodexmllog
 Current pointer to the top of the XML_Node tree for the current HTML log. More...
 
XML_Nodecurrent
 Pointer to the last current position in the XML_Node tree for the current HTML log. More...
 
int loglevel
 Current value of the loglevel. More...
 
std::vector< int > loglevels
 Vector of loglevels for loggroups that are open. More...
 
std::vector< std::string > loggroups
 Current vector of loggroups that are open. More...
 

Detailed Description

Class to carry out messages.

Definition at line 48 of file application.h.

Constructor & Destructor Documentation

Messages ( )

Constructor for the Messages class.

Constructor for the Messages class which is a subclass of the Application class.

Definition at line 53 of file application.cpp.

References Application::Messages::logwriter.

Member Function Documentation

void writelogendl ( )

Write an end of line character to the screen and flush output.

Definition at line 148 of file application.cpp.

Referenced by Application::writelogendl().

void logerror ( const std::string &  msg)

Write an error message and quit.

The default behavior is to write to the standard error stream, and then call exit(). Note that no end-of-line character is appended to the message, and so if one is desired it must be included in the string. Note that this default behavior will terminate the application Cantera is invoked from (MATLAB, Excel, etc.) If this is not desired, then derive a class and reimplement this method.

Parameters
msgError message to be written to cerr.

Definition at line 138 of file application.cpp.

Referenced by Application::logerror().

void endLogGroup ( const std::string &  title)

Close the current group of log messages.

This is typically called just before leaving a function or method, to close the group of messages that were output from this function. Subsequent messages written with addLogEntry() will appear at the next-higher level in the outline, unless beginLogGroup() is called first to create a new group.

Parameters
titleName of the log group. It defaults to the most recent log group created.
Deprecated:
HTML logs will be removed in Cantera 2.2

Definition at line 215 of file application.cpp.

References AssertThrowMsg, Application::write_logfile(), and Application::writelog().

Referenced by Application::endLogGroup().

void write_logfile ( const std::string &  file)

Write the HTML log file.

Log entries are stored in memory in an XML tree until this function is called, which writes the tree to a file and clears the entries stored in memory. The output file will have the name specified in the 'file' argument. If this argument has no extension, the extension '.html' will be appended. Also, if the file already exists, an integer will be appended to the name so that no existing log file will be overwritten. WITH_HTML_LOGS must be defined.

Parameters
fileName of the file to be written
Deprecated:
HTML logs will be removed in Cantera 2.2

Definition at line 244 of file application.cpp.

References Cantera::int2str(), Cantera::npos, Cantera::warn_deprecated(), and Application::writelog().

Referenced by Application::write_logfile().

Member Data Documentation

std::vector<std::string> errorMessage
protected

Current list of error messages.

Definition at line 261 of file application.h.

Referenced by Application::Messages::popError().

std::vector<std::string> errorRoutine
protected

Current error Routine.

Definition at line 264 of file application.h.

Referenced by Application::Messages::popError().

Logger* logwriter
protected

Current pointer to the logwriter.

Definition at line 267 of file application.h.

Referenced by Application::Messages::Messages().

XML_Node* xmllog
protected

Current pointer to the top of the XML_Node tree for the current HTML log.

Definition at line 270 of file application.h.

XML_Node* current
protected

Pointer to the last current position in the XML_Node tree for the current HTML log.

Definition at line 273 of file application.h.

int loglevel
protected

Current value of the loglevel.

Definition at line 276 of file application.h.

std::vector<int> loglevels
protected

Vector of loglevels for loggroups that are open.

Definition at line 279 of file application.h.

std::vector<std::string> loggroups
protected

Current vector of loggroups that are open.

Definition at line 282 of file application.h.


The documentation for this class was generated from the following files: