imaging::Cmessage Class Reference
[Core Module]

Implementation of MessageInterface. More...

#include <Cmessage.hpp>

Inheritance diagram for imaging::Cmessage:


List of all members.

Public Types


Public Member Functions

void set_verbose_level (size_t level)
const size_t verbose_level () const
void operator() (const std::string &message, const int priority_level, int intend=0)
void operator() (int intend)

Static Public Attributes

static Cmessage out

Detailed Description

Implementation of MessageInterface.

This class provides an implementation of the imaging2 log message interface. The class defines the static member CMessage::out is declared. Cmessage formats them accordingly and prints them to the standard output.

The user can adjust the verbose level. This function is specific to Cmessage and not part of MessageInterface. Ideally the user includes core/Cmessage.hpp in as little files as possible and mainly relies on core/MessageInterface.hpp for displaying log messages.

Here is an example on how Cmessage can be used:

  #include <core/Cmessage.hpp> 
  using imaging;
  int main ( int argc, char **argv )
    // configure Cmessage::cmessage_out to display ALL messages
    // this function is specific to Cmessage
    // from now on only MessageInterface is required
    MessageInterface::out("Start program.", MessageInterface::IMPORTANT);
    // user enters data
    MessageInterface::out("User entered:", MessageInterface::LESS_IMPORTANT, +1);
    MessageInterface::out(data, MessageInterface::LESS_IMPORTANT, +1);
    // check if data is valid
    MessageInterface::out("Wrong data entered!", MessageInterface::DEBUG_ONLY);
    MessageInterface::out("User is an idiot!", MessageInterface::DEBUG_ONLY);
    MessageInterface::out("Finished program.", MessageInterface::IMPORTANT);

Under the condition that MessageInterface::out is configured to display all messages (including those of type MessageInterface::DEBUG_ONLY) the above code will produce the following result:

  Start program.
    User entered:
    ...the data...
      Wrong data entered!
      User is an idiot!
  Finished program.

Member Enumeration Documentation

Different verbose levels which determine which messages are actually displayed.

DEBUG_MESSAGES  Display all messages including debug messages.
ALL_MESSAGES  Display all messages but no debug messages.
LITTLE_MESSAGES  Display only important messages.
NO_MESSAGES  Display no messages.

Member Function Documentation

void imaging::Cmessage::set_verbose_level ( size_t  level  ) 

Sets the current verbose level of the message object. This is e.g. useful, if the user wants to temporarily increase the verbose level.

const size_t imaging::Cmessage::verbose_level (  )  const [inline]

Returns the current verbose level.

void imaging::Cmessage::operator() ( const std::string &  message,
const int  priority_level,
int  intend = 0 
) [virtual]

Prints message. The priority and the level of intendation relative to the global intendation are determined by priority_level and intend. The specified intendentation is valid for this message only does not change the global intendation.

Implements imaging::MessageInterface.

void imaging::Cmessage::operator() ( int  intend  )  [virtual]

Changes the global intendentation by intend.

Implements imaging::MessageInterface.

References imaging::max().

Member Data Documentation

Global log message output object.

Reimplemented from imaging::MessageInterface.

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

Generated on Tue Feb 10 10:01:31 2009 for imaging2 by  doxygen 1.5.5