# Ipopt::Journalist Class Reference

Class responsible for all message output. More...

`#include <IpJournalist.hpp>`

Inheritance diagram for Ipopt::Journalist:
[legend]

List of all members.

## 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)
| Add a new FileJournal.
virtual SmartPtr< Journal > | GetJournal (const std::string &location_name)
| Get an existing journal.
virtual void | DeleteAllJournals ()
| Delete all journals curently known by the journalist.
## 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 &)
| Overloaded Equals Operator.
## Private Attributes
std::vector< SmartPtr< Journal > > | journals_

## Detailed Description

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 134 of file IpJournalist.hpp.

## Constructor & Destructor Documentation

Ipopt::Journalist::Journalist | ( |  | ) |

Constructor.

virtual Ipopt::Journalist::~Journalist | ( |  | ) | `[virtual]`

Destructor.

..

Ipopt::Journalist::Journalist | ( | const Journalist & |  | ) | `[private]`

Copy Constructor.

## Member Function Documentation

virtual void Ipopt::Journalist::Printf | ( | EJournalLevel | level,
|  | EJournalCategory | category,
|  | const char * | format,
|  |  | ... |
| ) |  |  | const`[virtual]`

Method to print a formatted string.

virtual void Ipopt::Journalist::PrintStringOverLines | ( | EJournalLevel | level,
|  | EJournalCategory | category,
|  | Index | indent_spaces,
|  | Index | max_length,
|  | const std::string & | line |
| ) |  |  | const`[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 void Ipopt::Journalist::PrintfIndented | ( | EJournalLevel | level,
|  | EJournalCategory | category,
|  | Index | indent_level,
|  | const char * | format,
|  |  | ... |
| ) |  |  | const`[virtual]`

Method to print a formatted string with indentation.

virtual void Ipopt::Journalist::VPrintf | ( | EJournalLevel | level,
|  | EJournalCategory | category,
|  | const char * | pformat,
|  | va_list | ap |
| ) |  |  | const`[virtual]`

Method to print a formatted string using the va_list argument.

virtual void Ipopt::Journalist::VPrintfIndented | ( | EJournalLevel | level,
|  | EJournalCategory | category,
|  | Index | indent_level,
|  | const char * | pformat,
|  | va_list | ap |
| ) |  |  | const`[virtual]`

Method to print a formatted string with indentation, using the va_list argument.

virtual bool Ipopt::Journalist::ProduceOutput | ( | EJournalLevel | level,
|  | EJournalCategory | category |
| ) |  |  | const`[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.

virtual void Ipopt::Journalist::FlushBuffer | ( |  | ) | const`[virtual]`

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)

virtual bool Ipopt::Journalist::AddJournal | ( | const SmartPtr< Journal > | jrnl | ) | `[virtual]`

Add a new journal.

The location_name is a string identifier, which can be used to obtain the pointer to the new Journal at a later point using the GetJournal method. The default_level is used to initialize the * printing level for all categories.

virtual SmartPtr<Journal> Ipopt::Journalist::AddFileJournal | ( | const std::string & | location_name,
|  | const std::string & | fname,
|  | EJournalLevel | default_level = `J_WARNING` |
| ) |  |  | `[virtual]`

Add a new FileJournal.

fname is the name of the * file to which this Journal corresponds. Use fname="stdout" * for stdout, and use fname="stderr" for stderr. This method * returns the Journal pointer so you can set specific acceptance criteria. It returns NULL if there was a problem creating a new Journal.

Parameters:

  | location_name | journal identifier
  | fname | file name
  | default_level | default journal level

virtual SmartPtr<Journal> Ipopt::Journalist::GetJournal | ( | const std::string & | location_name | ) | `[virtual]`

Get an existing journal.

You can use this method to change the acceptance criteria at runtime.

virtual void Ipopt::Journalist::DeleteAllJournals | ( |  | ) | `[virtual]`

Delete all journals curently known by the journalist.

void Ipopt::Journalist::operator= | ( | const Journalist & |  | ) | `[private]`

Overloaded Equals Operator.

## Member Data Documentation

std::vector< SmartPtr<Journal> > Ipopt::Journalist::journals_`[private]`

Definition at line 264 of file IpJournalist.hpp.

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

- src/Common/IpJournalist.hpp

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines