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

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. More...
 
 MessageCollector (const MessageCollector &)=default
 Forbid copy constructor and assignment operator for others since often derived instances are passed; better use createClone(). More...
 
MessageCollectoroperator= (const MessageCollector &)=default
 

Protected Attributes

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

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::DicomConfigurableMessageFilterBaseRefCounted, and ml::DicomMessageCollector.

◆ 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==()

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

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: