|
|
|||
File indexing completed on 2026-09-27 09:18:24
0001 // Copyright (c) 2019 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_Level_HeaderFile 0015 #define _Message_Level_HeaderFile 0016 0017 #include <Message.hxx> 0018 #include <Message_AlertExtended.hxx> 0019 #include <Message_Gravity.hxx> 0020 #include <Message_Messenger.hxx> 0021 #include <TCollection_AsciiString.hxx> 0022 0023 #include <Standard.hxx> 0024 0025 //! This class is an instance of Sentry to create a level in a message report 0026 //! Constructor of the class add new (active) level in the report, destructor removes it 0027 //! While the level is active in the report, new alerts are added below the level root alert. 0028 //! 0029 //! The first added alert is a root alert, other are added below the root alert 0030 //! 0031 //! If alert has Message_AttributeMeter attribute, active metrics of the default report are stored 0032 //! in the attribute: start value of metric on adding alert, stop on adding another alert or closing 0033 //! (delete) the level in the report. 0034 //! 0035 //! Processing of this class is implemented in Message_Report, it is used only inside it. 0036 //! Levels using should be only through using OCCT_ADD_MESSAGE_LEVEL_SENTRY only. No other code is 0037 //! required outside. 0038 class Message_Level 0039 { 0040 public: 0041 //! Constructor. 0042 //! One string key is used for all alert meters. 0043 //! The perf meter is not started automatically, it will be done in AddAlert() method 0044 Standard_EXPORT Message_Level( 0045 const TCollection_AsciiString& theName = TCollection_AsciiString::EmptyString()); 0046 0047 //! Assures stopping upon destruction 0048 Standard_EXPORT ~Message_Level(); 0049 0050 //! Returns root alert of the level 0051 //! @return alert instance or NULL 0052 const occ::handle<Message_AlertExtended>& RootAlert() const { return myRootAlert; } 0053 0054 //! Sets the root alert. Starts collects alert metrics if active. 0055 //! @param theAlert an alert 0056 Standard_EXPORT void SetRootAlert(const occ::handle<Message_AlertExtended>& theAlert, 0057 const bool isRequiredToStart); 0058 0059 //! Adds new alert on the level. Stops the last alert metric, appends the alert and starts the 0060 //! alert metrics collecting. Sets root alert beforehand this method using, if the root is NULL, 0061 //! it does nothing. 0062 //! @param theGravity an alert gravity 0063 //! @param theAlert an alert 0064 //! @return true if alert is added 0065 Standard_EXPORT bool AddAlert(const Message_Gravity theGravity, 0066 const occ::handle<Message_Alert>& theAlert); 0067 0068 private: 0069 //! Remove the current level from the report. It stops metric collecting for the last and the root 0070 //! alerts. 0071 Standard_EXPORT void remove(); 0072 0073 private: 0074 occ::handle<Message_AlertExtended> myRootAlert; //!< root alert 0075 occ::handle<Message_AlertExtended> myLastAlert; //!< last added alert on the root alert 0076 }; 0077 0078 //! @def MESSAGE_NEW_LEVEL 0079 //! Creates a new level instance of Sentry. This row should be inserted before messages using in the 0080 //! method. 0081 #define OCCT_ADD_MESSAGE_LEVEL_SENTRY(theMessage) Message_Level aLevel(theMessage); 0082 0083 #endif // _Message_Level_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|