Ipopt::Journalist Class Reference

Class responsible for all message output. More...

#include <IpJournalist.hpp>

Inheritance diagram for Ipopt::Journalist:
Inheritance graph
[legend]
Collaboration diagram for Ipopt::Journalist:
Collaboration graph
[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.



void Printf (EJournalLevel level, EJournalCategory category, const char *format,...) const
 Method to print a formatted string.
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.
void PrintfIndented (EJournalLevel level, EJournalCategory category, Index indent_level, const char *format,...) const
 Method to print a formatted string with indentation.
void VPrintf (EJournalLevel level, EJournalCategory category, const char *pformat, va_list ap) const
 Method to print a formatted string using the va_list argument.
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.
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.
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).



bool AddJournal (const SmartPtr< Journal > jrnl)
 Add a new journal.
SmartPtr< JournalAddFileJournal (const std::string &location_name, const std::string &fname, EJournalLevel default_level=J_WARNING)
 Add a new FileJournal.
SmartPtr< JournalGetJournal (const std::string &location_name)
 Get an existing journal.

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 124 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

void Ipopt::Journalist::Printf ( EJournalLevel  level,
EJournalCategory  category,
const char *  format,
  ... 
) const

Method to print a formatted string.

void Ipopt::Journalist::PrintStringOverLines ( EJournalLevel  level,
EJournalCategory  category,
Index  indent_spaces,
Index  max_length,
const std::string &  line 
) const

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.

void Ipopt::Journalist::PrintfIndented ( EJournalLevel  level,
EJournalCategory  category,
Index  indent_level,
const char *  format,
  ... 
) const

Method to print a formatted string with indentation.

void Ipopt::Journalist::VPrintf ( EJournalLevel  level,
EJournalCategory  category,
const char *  pformat,
va_list  ap 
) const

Method to print a formatted string using the va_list argument.

void Ipopt::Journalist::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.

bool Ipopt::Journalist::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.

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.

void Ipopt::Journalist::FlushBuffer (  )  const

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)

bool Ipopt::Journalist::AddJournal ( const SmartPtr< Journal jrnl  ) 

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.

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

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:
fname identifier
SmartPtr<Journal> Ipopt::Journalist::GetJournal ( const std::string &  location_name  ) 

Get an existing journal.

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

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

Overloaded Equals Operator.


Member Data Documentation

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

Definition at line 251 of file IpJournalist.hpp.


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

Generated on 15 Mar 2015 for Coin-All by  doxygen 1.6.1