Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-19 09:28:41

0001 // Copyright (c) 2020 OPEN CASCADE SAS
0002 //
0003 // This file is part of Open CASCADE Technology software library.
0004 //
0005 // This library is free software; you can redistribute it and/or modify it under
0006 // the terms of the GNU Lesser General Public License version 2.1 as published
0007 // by the Free Software Foundation, with special exception defined in the file
0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0009 // distribution for complete text of the license and disclaimer of any warranty.
0010 //
0011 // Alternatively, this file may be used under the terms of Open CASCADE
0012 // commercial license or contractual agreement.
0013 
0014 #ifndef _Message_PrinterToReport_HeaderFile
0015 #define _Message_PrinterToReport_HeaderFile
0016 
0017 #include <Message_Printer.hxx>
0018 #include <TCollection_AsciiString.hxx>
0019 
0020 class Message_Report;
0021 
0022 //! Implementation of a message printer associated with Message_Report
0023 //! Send will create a new alert of the report. If string is sent, an alert is created by Eol only.
0024 //! The alerts are sent into set report or default report of Message.
0025 class Message_PrinterToReport : public Message_Printer
0026 {
0027   DEFINE_STANDARD_RTTIEXT(Message_PrinterToReport, Message_Printer)
0028 public:
0029   //! Create printer for redirecting messages into report.
0030   Message_PrinterToReport() = default;
0031 
0032   //! Destructor
0033   ~Message_PrinterToReport() override = default;
0034 
0035   //! Returns the current or default report
0036   Standard_EXPORT const occ::handle<Message_Report>& Report() const;
0037 
0038   //! Sets the printer report
0039   //! @param theReport report for messages processing, if NULL, the default report is used
0040   void SetReport(const occ::handle<Message_Report>& theReport) { myReport = theReport; }
0041 
0042   //! Send a string message with specified trace level.
0043   //! Stream is converted to string value.
0044   //! Default implementation calls first method Send().
0045   Standard_EXPORT void SendStringStream(const Standard_SStream& theStream,
0046                                         const Message_Gravity   theGravity) const override;
0047 
0048   //! Send a string message with specified trace level.
0049   //! The object is converted to string in format: <object kind> : <object pointer>.
0050   //! The parameter theToPutEol specified whether end-of-line should be added to the end of the
0051   //! message. Default implementation calls first method Send().
0052   Standard_EXPORT void SendObject(const occ::handle<Standard_Transient>& theObject,
0053                                   const Message_Gravity                  theGravity) const override;
0054 
0055 protected:
0056   //! Send a string message with specified trace level.
0057   //! This method must be redefined in descendant.
0058   Standard_EXPORT void send(const TCollection_AsciiString& theString,
0059                             const Message_Gravity          theGravity) const override;
0060 
0061   //! Send an alert with metrics active in the current report
0062   Standard_EXPORT void sendMetricAlert(const TCollection_AsciiString& theValue,
0063                                        const Message_Gravity          theGravity) const;
0064 
0065 private:
0066   mutable TCollection_AsciiString myName;
0067   occ::handle<Message_Report>     myReport; //!< the report for sending alerts
0068 };
0069 
0070 #endif // _Message_PrinterToReport_HeaderFile