MeVisLab Toolbox Reference
ml::MessageCollector Class Reference

Class to collect messages of different types. More...

#include <mlMessageCollector.h>

Inheritance diagram for ml::MessageCollector:
ml::DicomMessageCollector ml::DicomConfigurableMessageFilterBaseRefCounted

Public Member Functions

 MessageCollector ()
 Construction with empty messages.
 
virtual ~MessageCollector ()
 Virtual destructor.
 
bool operator== (const MessageCollector &otherObj) const
 Returns true on member equality, otherwise false.
 
virtual bool hasInfo () const
 Returns true if the info member is not empty, otherwise false.
 
virtual void appendInfo (const std::string &stringToAppend)
 Append an info string; can be overwritten for replacement of the appendInfo functionality.
 
virtual void appendInfo (std::stringstream &streamToAppend)
 Append an info stream; indirectly uses appendInfo(const std::string &) for appending.
 
virtual void setInfos (const std::string &stringToSet)
 Sets the current info string.
 
virtual void setInfos (std::stringstream &streamToSet)
 Set an info stream.
 
virtual const std::string & getInfos () const
 Get the current info string.
 
virtual void postInfos (const std::string &funcName)
 If there are infos then they are posted with one call of ML_PRINT_INFO.
 
virtual bool hasIssue () const
 Returns true if the issue member is not empty, otherwise false.
 
virtual void appendIssue (const std::string &stringToAppend)
 Append an issue string; can be overwritten for replacement of the appendIssue functionality.
 
virtual void appendIssue (std::stringstream &streamToAppend)
 Append an issue stream; indirectly uses appendIssue(const std::string &) for appending..
 
virtual void setIssues (const std::string &stringToSet)
 Sets the current issue string.
 
virtual void setIssues (std::stringstream &streamToSet)
 Set an issue stream.
 
virtual const std::string & getIssues () const
 Get the current issue string.
 
virtual void postIssues (const std::string &funcName, const std::string &reason)
 If there are issues then they are posted with one call of ML_PRINT_WARNING.
 
virtual bool hasError () const
 Returns true if error messaqe member is not empty, otherwise false.
 
virtual void appendError (const std::string &stringToAppend)
 Append an error string; can be overwritten for replacement of the appendError functionality.
 
virtual void appendError (std::stringstream &streamToAppend)
 Append an error stream; indirectly uses appendError(const std::string &) for appending..
 
virtual void setErrors (const std::string &stringToSet)
 Sets the current error string.
 
virtual void setErrors (std::stringstream &streamToSet)
 Set an error stream.
 
virtual const std::string & getErrors () const
 Get the current error string.
 
virtual void postErrors (const std::string &funcName, const std::string &reason)
 If there are errors then they are posted with one call of ML_PRINT_ERROR.
 
virtual bool hasMessages () const
 Returns true if any message is not empty, otherwise false.
 
virtual std::string getAllMessages () const
 Get the current message + issue + error string.
 
virtual void clearMessages ()
 Clears all messages to empty strings, the handle is not changed.
 
virtual void postMessages (const std::string &funcName, const std::string &reason)
 If there are any messages then post them with their appropriate post methods.
 
virtual void convertAllMessagesToErrors ()
 Append all messages to error messages and then clears them.
 
virtual void appendMessagesFrom (const MessageCollector &other)
 Append all corresponding messages from other.
 
std::string getFiltered (const std::string &stringToFilter) const
 Returns an empty string if _filterMatches returns true, otherwise stringToFilter is returned; otherwise it returns an empty string.
 
virtual MessageCollectorcreateClone ()
 Create a duplicate from *this.
 

Protected Member Functions

virtual bool _filterMatches (const std::string &) const
 A filter method just returning false in this class; derived classes may implement filters reacting with other return values on message.
 
 MessageCollector (const MessageCollector &)=default
 Forbid copy constructor and assignment operator for others since often derived instances are passed; better use createClone().
 
MessageCollectoroperator= (const MessageCollector &)=default
 

Protected Attributes

std::string _infos
 Collects any information.
 
std::string _issues
 Collects issue information.
 
std::string _errors
 Collects error information.
 

Detailed Description

Class to collect messages of different types.

Definition at line 20 of file mlMessageCollector.h.

Constructor & Destructor Documentation

◆ MessageCollector() [1/2]

ml::MessageCollector::MessageCollector ( )

Construction with empty messages.

◆ ~MessageCollector()

virtual ml::MessageCollector::~MessageCollector ( )
virtual

Virtual destructor.

◆ MessageCollector() [2/2]

ml::MessageCollector::MessageCollector ( const MessageCollector & )
protecteddefault

Forbid copy constructor and assignment operator for others since often derived instances are passed; better use createClone().

Member Function Documentation

◆ _filterMatches()

virtual bool ml::MessageCollector::_filterMatches ( const std::string & ) const
inlineprotectedvirtual

A filter method just returning false in this class; derived classes may implement filters reacting with other return values on message.

Reimplemented in ml::DicomConfigurableMessageFilterBaseRefCounted.

Definition at line 113 of file mlMessageCollector.h.

◆ appendError() [1/2]

virtual void ml::MessageCollector::appendError ( const std::string & stringToAppend)
virtual

Append an error string; can be overwritten for replacement of the appendError functionality.

Reimplemented in ml::DicomConfigurableMessageFilterBaseRefCounted.

◆ appendError() [2/2]

virtual void ml::MessageCollector::appendError ( std::stringstream & streamToAppend)
virtual

Append an error stream; indirectly uses appendError(const std::string &) for appending..

◆ appendInfo() [1/2]

virtual void ml::MessageCollector::appendInfo ( const std::string & stringToAppend)
virtual

Append an info string; can be overwritten for replacement of the appendInfo functionality.

Reimplemented in ml::DicomConfigurableMessageFilterBaseRefCounted.

◆ appendInfo() [2/2]

virtual void ml::MessageCollector::appendInfo ( std::stringstream & streamToAppend)
virtual

Append an info stream; indirectly uses appendInfo(const std::string &) for appending.

◆ appendIssue() [1/2]

virtual void ml::MessageCollector::appendIssue ( const std::string & stringToAppend)
virtual

Append an issue string; can be overwritten for replacement of the appendIssue functionality.

Reimplemented in ml::DicomConfigurableMessageFilterBaseRefCounted.

◆ appendIssue() [2/2]

virtual void ml::MessageCollector::appendIssue ( std::stringstream & streamToAppend)
virtual

Append an issue stream; indirectly uses appendIssue(const std::string &) for appending..

◆ appendMessagesFrom()

virtual void ml::MessageCollector::appendMessagesFrom ( const MessageCollector & other)
virtual

Append all corresponding messages from other.

◆ clearMessages()

virtual void ml::MessageCollector::clearMessages ( )
virtual

Clears all messages to empty strings, the handle is not changed.

◆ convertAllMessagesToErrors()

virtual void ml::MessageCollector::convertAllMessagesToErrors ( )
virtual

Append all messages to error messages and then clears them.

◆ createClone()

virtual MessageCollector * ml::MessageCollector::createClone ( )
virtual

Create a duplicate from *this.

Reimplemented in ml::DicomMessageCollector, and ml::DicomConfigurableMessageFilterBaseRefCounted.

◆ getAllMessages()

virtual std::string ml::MessageCollector::getAllMessages ( ) const
virtual

Get the current message + issue + error string.

◆ getErrors()

virtual const std::string & ml::MessageCollector::getErrors ( ) const
virtual

Get the current error string.

◆ getFiltered()

std::string ml::MessageCollector::getFiltered ( const std::string & stringToFilter) const

Returns an empty string if _filterMatches returns true, otherwise stringToFilter is returned; otherwise it returns an empty string.

◆ getInfos()

virtual const std::string & ml::MessageCollector::getInfos ( ) const
virtual

Get the current info string.

◆ getIssues()

virtual const std::string & ml::MessageCollector::getIssues ( ) const
virtual

Get the current issue string.

◆ hasError()

virtual bool ml::MessageCollector::hasError ( ) const
virtual

Returns true if error messaqe member is not empty, otherwise false.

◆ hasInfo()

virtual bool ml::MessageCollector::hasInfo ( ) const
virtual

Returns true if the info member is not empty, otherwise false.

◆ hasIssue()

virtual bool ml::MessageCollector::hasIssue ( ) const
virtual

Returns true if the issue member is not empty, otherwise false.

◆ hasMessages()

virtual bool ml::MessageCollector::hasMessages ( ) const
virtual

Returns true if any message is not empty, otherwise false.

◆ operator=()

MessageCollector & ml::MessageCollector::operator= ( const MessageCollector & )
protecteddefault

◆ operator==()

bool ml::MessageCollector::operator== ( const MessageCollector & otherObj) const

Returns true on member equality, otherwise false.

◆ postErrors()

virtual void ml::MessageCollector::postErrors ( const std::string & funcName,
const std::string & reason )
virtual

If there are errors then they are posted with one call of ML_PRINT_ERROR.

Parameters
funcNameThe String to be used as FUNC_NAME parameter for the ML_PRINT_ERROR macro.
reasonThe String to be used as REASON parameter for the ML_PRINT_ERROR macro.

◆ postInfos()

virtual void ml::MessageCollector::postInfos ( const std::string & funcName)
virtual

If there are infos then they are posted with one call of ML_PRINT_INFO.

Parameters
funcNameThe String to be used as FUNC_NAME parameter for the ML_PRINT_INFO macro.

◆ postIssues()

virtual void ml::MessageCollector::postIssues ( const std::string & funcName,
const std::string & reason )
virtual

If there are issues then they are posted with one call of ML_PRINT_WARNING.

Parameters
funcNameThe String to be used as FUNC_NAME parameter for the ML_PRINT_WARNING macro.
reasonThe String to be used as REASON parameter for the ML_PRINT_WARNING macro.

◆ postMessages()

virtual void ml::MessageCollector::postMessages ( const std::string & funcName,
const std::string & reason )
virtual

If there are any messages then post them with their appropriate post methods.

Parameters
funcNameThe String to be used as FUNC_NAME parameter for the ML_PRINT macro.
reasonThe String to be used as REASON parameter for the ML_PRINT macro.

◆ setErrors() [1/2]

virtual void ml::MessageCollector::setErrors ( const std::string & stringToSet)
virtual

Sets the current error string.

◆ setErrors() [2/2]

virtual void ml::MessageCollector::setErrors ( std::stringstream & streamToSet)
virtual

Set an error stream.

◆ setInfos() [1/2]

virtual void ml::MessageCollector::setInfos ( const std::string & stringToSet)
virtual

Sets the current info string.

◆ setInfos() [2/2]

virtual void ml::MessageCollector::setInfos ( std::stringstream & streamToSet)
virtual

Set an info stream.

◆ setIssues() [1/2]

virtual void ml::MessageCollector::setIssues ( const std::string & stringToSet)
virtual

Sets the current issue string.

◆ setIssues() [2/2]

virtual void ml::MessageCollector::setIssues ( std::stringstream & streamToSet)
virtual

Set an issue stream.

Member Data Documentation

◆ _errors

std::string ml::MessageCollector::_errors
protected

Collects error information.

Definition at line 122 of file mlMessageCollector.h.

◆ _infos

std::string ml::MessageCollector::_infos
protected

Collects any information.

Definition at line 116 of file mlMessageCollector.h.

◆ _issues

std::string ml::MessageCollector::_issues
protected

Collects issue information.

Definition at line 119 of file mlMessageCollector.h.


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