Class responsible for all message output. More...
#include <IpJournalist.hpp>
Public Member Functions | |
Constructor / Desructor. | |
Journalist () | |
Constructor. | |
virtual | ~Journalist () |
Destructor... | |
Author Methods. | |
These methods are used by authoring code, or code that wants to report some information. | |
virtual void | Printf (EJournalLevel level, EJournalCategory category, const char *format,...) const |
Method to print a formatted string. | |
virtual void | PrintStringOverLines (EJournalLevel level, EJournalCategory category, Index indent_spaces, Index max_length, const std::string &line) const |
Method to print a long string including indentation. | |
virtual void | PrintfIndented (EJournalLevel level, EJournalCategory category, Index indent_level, const char *format,...) const |
Method to print a formatted string with indentation. | |
virtual void | VPrintf (EJournalLevel level, EJournalCategory category, const char *pformat, va_list ap) const |
Method to print a formatted string using the va_list argument. | |
virtual void | VPrintfIndented (EJournalLevel level, EJournalCategory category, Index indent_level, const char *pformat, va_list ap) const |
Method to print a formatted string with indentation, using the va_list argument. | |
virtual bool | ProduceOutput (EJournalLevel level, EJournalCategory category) const |
Method that returns true if there is a Journal that would write output for the given JournalLevel and JournalCategory. | |
virtual void | FlushBuffer () const |
Method that flushes the current buffer for all Journalists. | |
Reader Methods. | |
These methods are used by the reader. The reader will setup the journalist with each output file and the acceptance criteria for that file. Use these methods to setup the journals (files or other output). These are the internal objects that keep track of the print levels for each category. Then use the internal Journal objects to set specific print levels for each category (or keep defaults). | |
virtual bool | AddJournal (const SmartPtr< Journal > jrnl) |
Add a new journal. | |
virtual SmartPtr< Journal > | AddFileJournal (const std::string &location_name, const std::string &fname, EJournalLevel default_level=J_WARNING, bool file_append=false) |
Add a new FileJournal. | |
virtual SmartPtr< Journal > | GetJournal (const std::string &location_name) |
Get an existing journal. | |
virtual void | DeleteAllJournals () |
Delete all journals currently known by the journalist. | |
Public Member Functions inherited from Ipopt::ReferencedObject | |
ReferencedObject () | |
virtual | ~ReferencedObject () |
Index | ReferenceCount () const |
void | AddRef (const Referencer *referencer) const |
void | ReleaseRef (const Referencer *referencer) const |
Private Member Functions | |
Default Compiler Generated Methods | |
(Hidden to avoid implicit creation/calling). These methods are not implemented and we do not want the compiler to implement them for us, so we declare them private and do not define them. This ensures that they will not be implicitly created/called. | |
Journalist (const Journalist &) | |
Copy Constructor. | |
void | operator= (const Journalist &) |
Default Assignment Operator. | |
Private Attributes | |
std::vector< SmartPtr< Journal > > | journals_ |
Class responsible for all message output.
This class is responsible for all messaging and output. The "printing" code or "author" should send ALL messages to the Journalist, indicating an appropriate category and print level. The journalist then decides, based on reader specified acceptance criteria, which message is actually printed in which journals. This allows the printing code to send everything, while the "reader" can decide what they really want to see.
Authors: Authors use the Journals: You can add as many Journals as you like to the Journalist with the AddJournal or the AddFileJournal methods. Each one represents a different printing location (or file). Then, you can call the "print" methods of the Journalist to output information to each of the journals.
Acceptance Criteria: Each print message should be flagged appropriately with an EJournalCategory and EJournalLevel.
The AddFileJournal method returns a pointer to the newly created Journal object (if successful) so you can set Acceptance criteria for that particular location.
Definition at line 116 of file IpJournalist.hpp.
Ipopt::Journalist::Journalist | ( | ) |
Constructor.
|
virtual |
Destructor...
|
private |
Copy Constructor.
|
virtual |
Method to print a formatted string.
|
virtual |
Method to print a long string including indentation.
The string is printed starting at the current position. If the position (counting started at the current position) exceeds max_length, a new line is inserted, and indent_spaces many spaces are printed before the string is continued. This is for example used during the printing of the option documentation.
|
virtual |
Method to print a formatted string with indentation.
|
virtual |
Method to print a formatted string using the va_list argument.
|
virtual |
Method to print a formatted string with indentation, using the va_list argument.
|
virtual |
Method that returns true if there is a Journal that would write output for the given JournalLevel and JournalCategory.
This is useful if expensive computation would be required for a particular output. The author code can check with this method if the computations are indeed required.
Method that flushes the current buffer for all Journalists.
Calling this method after one optimization run helps to avoid cluttering output with that produced by other parts of the program (e.g. written in Fortran)
Add a new journal.
|
virtual |
Add a new FileJournal.
location_name | string identifier, which can be used to obtain the pointer to the new Journal at a later point using the GetJournal method |
fname | name of the file to which this Journal corresponds; use "stdout" for stdout and use "stderr" for stderr |
default_level | default journal level used to initialize the printing level for all categories |
file_append | whether to append to file or truncate it (since 3.14.13) |
|
virtual |
Get an existing journal.
You can use this method to change the acceptance criteria at runtime.
Delete all journals currently known by the journalist.
|
private |
Default Assignment Operator.
Definition at line 274 of file IpJournalist.hpp.