Open CASCADE Technology  7.1.0.beta
Public Member Functions
Message_Messenger Class Reference

Messenger is API class providing general-purpose interface for libraries that may issue text messages without knowledge of how these messages will be further processed. More...

#include <Message_Messenger.hxx>

Inheritance diagram for Message_Messenger:
Inheritance graph
[legend]

Public Member Functions

 Message_Messenger ()
 Empty constructor; initializes by single printer directed to cout. Note: the default messenger is not empty but directed to cout in order to protect against possibility to forget defining printers. If printing to cout is not needed, clear messenger by GetPrinters().Clear() More...
 
 Message_Messenger (const Handle< Message_Printer > &thePrinter)
 Create messenger with single printer. More...
 
Standard_Boolean AddPrinter (const Handle< Message_Printer > &thePrinter)
 Add a printer to the messenger. The printer will be added only if it is not yet in the list. Returns True if printer has been added. More...
 
Standard_Boolean RemovePrinter (const Handle< Message_Printer > &thePrinter)
 Removes specified printer from the messenger. Returns True if this printer has been found in the list and removed. More...
 
Standard_Integer RemovePrinters (const Handle< Standard_Type > &theType)
 Removes printers of specified type (including derived classes) from the messenger. Returns number of removed printers. More...
 
const Message_SequenceOfPrintersPrinters () const
 Returns current sequence of printers. More...
 
Message_SequenceOfPrintersChangePrinters ()
 Returns sequence of printers The sequence can be modified. More...
 
void Send (const Standard_CString theString, const Message_Gravity theGravity=Message_Warning, const Standard_Boolean putEndl=Standard_True) const
 Dispatch a message to all the printers in the list. Three versions of string representations are accepted for convenience, by default all are converted to ExtendedString. The parameter putEndl specifies whether the new line should be started after this message (default) or not (may have sense in some conditions). More...
 
void Send (const TCollection_AsciiString &theString, const Message_Gravity theGravity=Message_Warning, const Standard_Boolean putEndl=Standard_True) const
 See above. More...
 
void Send (const TCollection_ExtendedString &theString, const Message_Gravity theGravity=Message_Warning, const Standard_Boolean putEndl=Standard_True) const
 See above. More...
 
- Public Member Functions inherited from MMgt_TShared
virtual void Delete () const override
 Memory deallocator for transient classes. More...
 
- Public Member Functions inherited from Standard_Transient
 Standard_Transient ()
 Empty constructor. More...
 
 Standard_Transient (const Standard_Transient &)
 Copy constructor – does nothing. More...
 
Standard_Transientoperator= (const Standard_Transient &)
 Assignment operator, needed to avoid copying reference counter. More...
 
virtual ~Standard_Transient ()
 Destructor must be virtual. More...
 
virtual const opencascade::handle< Standard_Type > & DynamicType () const
 Returns a type descriptor about this object. More...
 
Standard_Boolean IsInstance (const opencascade::handle< Standard_Type > &theType) const
 Returns a true value if this is an instance of Type. More...
 
Standard_Boolean IsInstance (const Standard_CString theTypeName) const
 Returns a true value if this is an instance of TypeName. More...
 
Standard_Boolean IsKind (const opencascade::handle< Standard_Type > &theType) const
 Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism. More...
 
Standard_Boolean IsKind (const Standard_CString theTypeName) const
 Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism. More...
 
Standard_TransientThis () const
 Returns non-const pointer to this object (like const_cast). For protection against creating handle to objects allocated in stack or call from constructor, it will raise exception Standard_ProgramError if reference counter is zero. More...
 
Standard_Integer GetRefCount () const
 Get the reference counter of this object. More...
 
void IncrementRefCounter () const
 Increments the reference counter of this object. More...
 
Standard_Integer DecrementRefCounter () const
 Decrements the reference counter of this object; returns the decremented value. More...
 

Additional Inherited Members

- Public Types inherited from Standard_Transient
typedef void base_type
 Returns a type descriptor about this object. More...
 
- Static Public Member Functions inherited from Standard_Transient
static const char * get_type_name ()
 Returns a type descriptor about this object. More...
 
static const opencascade::handle< Standard_Type > & get_type_descriptor ()
 Returns type descriptor of Standard_Transient class. More...
 

Detailed Description

Messenger is API class providing general-purpose interface for libraries that may issue text messages without knowledge of how these messages will be further processed.

The messenger contains a sequence of "printers" which can be customized by the application, and dispatches every received message to all the printers.

For convenience, a number of operators << are defined with left argument being Handle(Message_Messenger); thus it can be used with syntax similar to C++ streams. Note that all these operators use trace level Warning.

Constructor & Destructor Documentation

Message_Messenger::Message_Messenger ( )

Empty constructor; initializes by single printer directed to cout. Note: the default messenger is not empty but directed to cout in order to protect against possibility to forget defining printers. If printing to cout is not needed, clear messenger by GetPrinters().Clear()

Message_Messenger::Message_Messenger ( const Handle< Message_Printer > &  thePrinter)

Create messenger with single printer.

Member Function Documentation

Standard_Boolean Message_Messenger::AddPrinter ( const Handle< Message_Printer > &  thePrinter)

Add a printer to the messenger. The printer will be added only if it is not yet in the list. Returns True if printer has been added.

Message_SequenceOfPrinters& Message_Messenger::ChangePrinters ( )

Returns sequence of printers The sequence can be modified.

const Message_SequenceOfPrinters& Message_Messenger::Printers ( ) const

Returns current sequence of printers.

Standard_Boolean Message_Messenger::RemovePrinter ( const Handle< Message_Printer > &  thePrinter)

Removes specified printer from the messenger. Returns True if this printer has been found in the list and removed.

Standard_Integer Message_Messenger::RemovePrinters ( const Handle< Standard_Type > &  theType)

Removes printers of specified type (including derived classes) from the messenger. Returns number of removed printers.

void Message_Messenger::Send ( const Standard_CString  theString,
const Message_Gravity  theGravity = Message_Warning,
const Standard_Boolean  putEndl = Standard_True 
) const

Dispatch a message to all the printers in the list. Three versions of string representations are accepted for convenience, by default all are converted to ExtendedString. The parameter putEndl specifies whether the new line should be started after this message (default) or not (may have sense in some conditions).

void Message_Messenger::Send ( const TCollection_AsciiString theString,
const Message_Gravity  theGravity = Message_Warning,
const Standard_Boolean  putEndl = Standard_True 
) const

See above.

void Message_Messenger::Send ( const TCollection_ExtendedString theString,
const Message_Gravity  theGravity = Message_Warning,
const Standard_Boolean  putEndl = Standard_True 
) const

See above.


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