n2p2 - A neural network potential package
|
Logging class for library output. More...
#include <Log.h>
Public Member Functions | |
Log () | |
Constructor. More... | |
Log & | operator<< (std::string const &entry) |
Overload << operator. More... | |
Log & | operator<< (std::vector< std::string > const &entries) |
Overload << operator. More... | |
void | addLogEntry (std::string const &entry) |
Add string as new log entry. More... | |
void | addMultipleLogEntries (std::vector< std::string > const &entries) |
Add multiple log entries at once. More... | |
void | registerCFilePointer (FILE **const &filePointer) |
Register new C-style FILE* pointer for output. More... | |
void | registerStreamPointer (std::ofstream *const &streamPointer) |
Register new C++ ofstream pointer. More... | |
std::vector< std::string > | getLog () const |
Get complete log memory. More... | |
Public Attributes | |
bool | writeToStdout |
Turn on/off output to stdout. More... | |
bool | silent |
Completely silence output. More... | |
Private Attributes | |
std::vector< std::string > | memory |
Memory with all log entries. More... | |
std::vector< FILE ** > | cFilePointers |
Storage for C-style FILE* pointers. More... | |
std::vector< std::ofstream * > | streamPointers |
Storage for C++ ofstream pointers. More... | |
Logging class for library output.
Log entries are saved in internal memory and may be redirected to multiple destinations: existing C-style FILE pointer or existing C++ stream.
Log & Log::operator<< | ( | std::string const & | entry | ) |
Overload << operator.
[in] | entry | New log entry. |
Definition at line 28 of file Log.cpp.
References addLogEntry().
Log & Log::operator<< | ( | std::vector< std::string > const & | entries | ) |
Overload << operator.
[in] | entries | Vector with log entries. |
Definition at line 34 of file Log.cpp.
References addMultipleLogEntries().
void Log::addLogEntry | ( | std::string const & | entry | ) |
Add string as new log entry.
[in] | entry | New log entry. |
Definition at line 40 of file Log.cpp.
References cFilePointers, memory, silent, streamPointers, and writeToStdout.
Referenced by addMultipleLogEntries(), and operator<<().
void Log::addMultipleLogEntries | ( | std::vector< std::string > const & | entries | ) |
Add multiple log entries at once.
[in] | entries | Vector with log entries. |
Definition at line 74 of file Log.cpp.
References addLogEntry().
Referenced by operator<<().
void Log::registerCFilePointer | ( | FILE **const & | filePointer | ) |
Register new C-style FILE* pointer for output.
[in] | filePointer | Address of C-style file pointer (FILE*). |
Definition at line 85 of file Log.cpp.
References cFilePointers.
Referenced by LAMMPS_NS::PairHDNNP::init_style().
void Log::registerStreamPointer | ( | std::ofstream *const & | streamPointer | ) |
Register new C++ ofstream pointer.
[in] | streamPointer | Address of C++ ofstream pointer. |
Definition at line 91 of file Log.cpp.
References streamPointers.
Referenced by main().
vector< string > Log::getLog | ( | ) | const |
bool nnp::Log::writeToStdout |
Turn on/off output to stdout.
Definition at line 85 of file Log.h.
Referenced by addLogEntry(), nnp::InterfaceLammps::initialize(), and main().
bool nnp::Log::silent |
Completely silence output.
Definition at line 87 of file Log.h.
Referenced by addLogEntry(), and nnp::Training::dataSetNormalization().
|
private |
Memory with all log entries.
Definition at line 91 of file Log.h.
Referenced by addLogEntry(), and getLog().
|
private |
Storage for C-style FILE* pointers.
Definition at line 93 of file Log.h.
Referenced by addLogEntry(), and registerCFilePointer().
|
private |
Storage for C++ ofstream pointers.
Definition at line 95 of file Log.h.
Referenced by addLogEntry(), and registerStreamPointer().