#include <MessageReporter.h>
Inheritance diagram for hwdet::MessageReporter:
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 | |
MessageReporter * | parent |
Parent reporter. | |
String | name |
Name of the reporter. | |
std::vector< String > | messages |
Message queue. |
This class provides basic logging capabilities for the detector libraries. All messages are stored in the internal buffer and can be later retrieved.
hwdet::MessageReporter::MessageReporter | ( | const String & | rep_name, | |
MessageReporter * | parent_reporter = NULL | |||
) | [inline] |
Constructor.
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.
void hwdet::MessageReporter::ChildReportMessage | ( | const String & | message | ) | [inline, private] |
Report message from child reporter to the parent.
message | Text of the message. Name of current reporter will be prepended automatically. |
String hwdet::MessageReporter::GetLastMessage | ( | void | ) | const [inline] |
Get last reported message.
String hwdet::MessageReporter::GetMessage | ( | size_t | index | ) | const [inline] |
Get message with given index.
index | Index of message in message buffer. Index starts at 0, last message has index getMessageQueueLength() - 1. |
size_t hwdet::MessageReporter::GetMessageQueueLength | ( | void | ) | const [inline] |
Get length of message queue.
String hwdet::MessageReporter::GetName | ( | void | ) | const [inline] |
Get name of MessageReporter.
Reimplemented in hwdet::Distribution.
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.
new_msg | Text of the new message. |
void hwdet::MessageReporter::WriteMessagesToStream | ( | OStream & | stream | ) | [inline] |
Write all messages to output stream.
stream | Stream into which all messages will be written. Messages are separated by newlines. |
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.