hwdet::MessageReporter Class Reference

Class which provides simple way to report messages. More...

#include <MessageReporter.h>

Inheritance diagram for hwdet::MessageReporter:

hwdet::Detector hwdet::WindowsDetector

Public Member Functions

 MessageReporter (const String &rep_name, MessageReporter *parent_reporter=NULL)
 Constructor.
virtual ~MessageReporter (void)
 Virtual destructor.
String GetLastMessage (void) const
 Get last reported message.
String GetName (void) const
 Get name of MessageReporter.
String GetMessage (size_t index) const
 Get message with given index.
size_t GetMessageQueueLength (void) const
 Get length of message queue.
void WriteMessagesToStream (OStream &stream)
 Write all messages to output stream.

Protected Member Functions

void ReportMessage (const String &new_msg)
 Add new message to the queue.

Private Member Functions

void ChildReportMessage (const String &message)

Private Attributes

MessageReporterparent
 Parent reporter.
String name
 Name of the reporter.
std::vector< Stringmessages
 Message queue.

Detailed Description

Class which provides simple way to report messages.

This class provides basic logging capabilities for the detector libraries. All messages are stored in the internal buffer and can be later retrieved.


Constructor & Destructor Documentation

hwdet::MessageReporter::MessageReporter ( const String rep_name,
MessageReporter parent_reporter = NULL 
) [inline]

Constructor.

Parameters:
rep_name Name of current MessageReporter. This is provided only for convenience.
parent_reporter Pointer to the message reporter to which messages generated by this reporter will be dispatched. If this is NULL, messages are written directly to the standard output.

virtual hwdet::MessageReporter::~MessageReporter ( void   )  [inline, virtual]

Virtual destructor.


Member Function Documentation

void hwdet::MessageReporter::ChildReportMessage ( const String message  )  [inline, private]

Report message from child reporter to the parent.

Parameters:
message Text of the message. Name of current reporter will be prepended automatically.

String hwdet::MessageReporter::GetLastMessage ( void   )  const [inline]

Get last reported message.

Returns:
Last message reported using reportMessage function. Returns empty string if no messages are in the buffer.

String hwdet::MessageReporter::GetMessage ( size_t  index  )  const [inline]

Get message with given index.

Parameters:
index Index of message in message buffer. Index starts at 0, last message has index getMessageQueueLength() - 1.
Returns:
Message at given position in message buffer. Newer messages are at the end of the buffer.

size_t hwdet::MessageReporter::GetMessageQueueLength ( void   )  const [inline]

Get length of message queue.

Returns:
Length of the message queue.

String hwdet::MessageReporter::GetName ( void   )  const [inline]

Get name of MessageReporter.

Returns:
String with name of MessageReporter.

void hwdet::MessageReporter::ReportMessage ( const String new_msg  )  [inline, protected]

Add new message to the queue.

This function will add given message to themessage queue. This function is not meant to be used from outside of the class, so any class which needs to report messages has to be derived from MessageReporter.

Parameters:
new_msg Text of the new message.

void hwdet::MessageReporter::WriteMessagesToStream ( OStream stream  )  [inline]

Write all messages to output stream.

Parameters:
stream Stream into which all messages will be written. Messages are separated by newlines.


Field Documentation

std::vector< String > hwdet::MessageReporter::messages [private]

Message queue.

String hwdet::MessageReporter::name [private]

Name of the reporter.

MessageReporter* hwdet::MessageReporter::parent [private]

Parent reporter.


The documentation for this class was generated from the following file:
Generated on Tue Dec 19 17:43:53 2006 for Detector for Windows by  doxygen 1.4.7