Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

Message Class Reference

The Message class. More...

#include <GaudiKernel/Message.h>

List of all members.

Public Methods

 Message ()
 Default constructor. More...

 Message ( const char* src, int type, const char* msg )
 Constructor. More...

 Message ( const std::string& src, int type, const std::string& msg )
 Constructor. More...

 ~Message ()
 Default destructor. More...

const std::string& getMessage () const
 Get the message string. More...

void setMessage ( const std::string& msg )
 Set the message string. More...

int getType () const
 Get the message type. More...

void setType ( int msg_type )
 Set the message type. More...

const std::string& getSource () const
 Get the message source. More...

void setSource ( const std::string& src )
 Set the message source. More...

const std::string& getFormat () const
 Get the format string. More...

void setFormat ( const std::string& msg ) const
 Set the format string. More...

bool operator< ( const Message& test )
 Needed to build maps. More...


Protected Methods

void invalidFormat () const
 Called when an invalid format string is encountered. More...

void makeFormattedMsg ( const std::string& format ) const
 Format the message. More...

void decodeFormat ( const std::string& format ) const
 Decode format. More...

void sizeField ( const std::string& text ) const
 Truncate or pad the output string to the field width as necessary. More...

void setWidth ( const std::string& formatArg ) const
 Set the width of a stream. More...


Protected Attributes

std::string m_message
 The message. More...

std::string m_source
 The source. More...

std::string m_format
 The format string. More...

int m_type
 The type. More...

std::string m_formatted_msg
 Formatted message. More...

char m_fill
 The current fill character. More...

int m_width
 The current field width. More...

bool m_left
 Justification. More...


Static Protected Attributes

const char FORMAT_PREFIX
 The character used to prefix formatting commands. More...

const char JUSTIFY_LEFT
 The character used to indicate start of left text justification. More...

const char JUSTIFY_RIGHT
 The character used to indicate start of right text justification. More...

const char MESSAGE
 The character used to indicate that the message should be printed. More...

const char TYPE
 The character used to indicate that the message type should be printed. More...

const char SOURCE
 The character used to indicate that the message source should be printed. More...

const char FILL
 The character used to indicate that the previous character is to be used for padding out fields if the text is not long enough. More...

const char WIDTH
 The character used to indicate that the previous decimal characters should be taken as the field width. More...

const char* DEFAULT_FORMAT = "% F%18W%S%7W%R%T %0W%M"
 The default message format. More...


Friends

std::ostream& operator<< ( std::ostream& stream, const Message& msg )
 Insert the message into a stream. More...

bool operator== ( const Message& a, const Message& b )
 Insert the message into a stream. More...


Detailed Description

The Message class.

This class is used to contain messages which can then be formatted and sent to a message service

Author(s):
Iain Last

Definition at line 15 of file Message.h.


Constructor & Destructor Documentation

Message::Message ( )
 

Default constructor.

Definition at line 30 of file Message.cpp.

Message::Message ( const char * src,
int type,
const char * msg )
 

Constructor.

Definition at line 42 of file Message.cpp.

Message::Message ( const std::string & src,
int type,
const std::string & msg )
 

Constructor.

Definition at line 54 of file Message.cpp.

Message::~Message ( ) [inline]
 

Default destructor.

Definition at line 27 of file Message.h.


Member Function Documentation

void Message::decodeFormat ( const std::string & format ) const [protected]
 

Decode format.

Definition at line 237 of file Message.cpp.

Referenced by makeFormattedMsg().

const std::string & Message::getFormat ( ) const
 

Get the format string.

Definition at line 171 of file Message.cpp.

const std::string & Message::getMessage ( ) const
 

Get the message string.

Definition at line 66 of file Message.cpp.

const std::string & Message::getSource ( ) const
 

Get the message source.

Definition at line 110 of file Message.cpp.

int Message::getType ( ) const
 

Get the message type.

Definition at line 88 of file Message.cpp.

void Message::invalidFormat ( ) const [protected]
 

Called when an invalid format string is encountered.

Definition at line 299 of file Message.cpp.

Referenced by decodeFormat(), makeFormattedMsg(), and setWidth().

void Message::makeFormattedMsg ( const std::string & format ) const [protected]
 

Format the message.

Definition at line 197 of file Message.cpp.

Referenced by invalidFormat(), and operator<<().

bool Message::operator< ( const Message & b )
 

Needed to build maps.

Definition at line 145 of file Message.cpp.

void Message::setFormat ( const std::string & format ) const
 

Set the format string.

Definition at line 183 of file Message.cpp.

void Message::setMessage ( const std::string & msg )
 

Set the message string.

Definition at line 77 of file Message.cpp.

void Message::setSource ( const std::string & src )
 

Set the message source.

Definition at line 121 of file Message.cpp.

void Message::setType ( int msg_type )
 

Set the message type.

Definition at line 99 of file Message.cpp.

void Message::setWidth ( const std::string & formatArg ) const [protected]
 

Set the width of a stream.

Definition at line 311 of file Message.cpp.

Referenced by decodeFormat().

void Message::sizeField ( const std::string & text ) const [protected]
 

Truncate or pad the output string to the field width as necessary.

Definition at line 342 of file Message.cpp.

Referenced by decodeFormat().


Friends And Related Function Documentation

std::ostream & operator<< ( std::ostream & stream,
const Message & msg ) [friend]
 

Insert the message into a stream.

Definition at line 132 of file Message.cpp.

bool operator== ( const Message & a,
const Message & b ) [friend]
 

Insert the message into a stream.

Definition at line 158 of file Message.cpp.


Member Data Documentation

const char * Message::DEFAULT_FORMAT = "% F%18W%S%7W%R%T %0W%M" [static, protected]
 

The default message format.

Definition at line 22 of file Message.cpp.

const char Message::FILL [static, protected]
 

The character used to indicate that the previous character is to be used for padding out fields if the text is not long enough.

Definition at line 19 of file Message.cpp.

const char Message::FORMAT_PREFIX [static, protected]
 

The character used to prefix formatting commands.

Definition at line 13 of file Message.cpp.

const char Message::JUSTIFY_LEFT [static, protected]
 

The character used to indicate start of left text justification.

Definition at line 14 of file Message.cpp.

const char Message::JUSTIFY_RIGHT [static, protected]
 

The character used to indicate start of right text justification.

Definition at line 15 of file Message.cpp.

const char Message::MESSAGE [static, protected]
 

The character used to indicate that the message should be printed.

Definition at line 16 of file Message.cpp.

const char Message::SOURCE [static, protected]
 

The character used to indicate that the message source should be printed.

Definition at line 18 of file Message.cpp.

const char Message::TYPE [static, protected]
 

The character used to indicate that the message type should be printed.

Definition at line 17 of file Message.cpp.

const char Message::WIDTH [static, protected]
 

The character used to indicate that the previous decimal characters should be taken as the field width.

Definition at line 20 of file Message.cpp.

char Message::m_fill [mutable, protected]
 

The current fill character.

Definition at line 94 of file Message.h.

std::string Message::m_format [mutable, protected]
 

The format string.

Definition at line 85 of file Message.h.

std::string Message::m_formatted_msg [mutable, protected]
 

Formatted message.

Definition at line 91 of file Message.h.

bool Message::m_left [mutable, protected]
 

Justification.

Definition at line 100 of file Message.h.

std::string Message::m_message [protected]
 

The message.

Definition at line 79 of file Message.h.

std::string Message::m_source [protected]
 

The source.

Definition at line 82 of file Message.h.

int Message::m_type [protected]
 

The type.

Definition at line 88 of file Message.h.

int Message::m_width [mutable, protected]
 

The current field width.

Definition at line 97 of file Message.h.


The documentation for this class was generated from the following files:
Generated at Wed Nov 21 12:22:14 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000