Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:16

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_CompositeAlerts_HeaderFile
0015 #define _Message_CompositeAlerts_HeaderFile
0016 
0017 #include <Message_Alert.hxx>
0018 #include <Message_Gravity.hxx>
0019 #include <Message_ListOfAlert.hxx>
0020 #include <Standard_Transient.hxx>
0021 
0022 //! Class providing container of alerts
0023 class Message_CompositeAlerts : public Standard_Transient
0024 {
0025   DEFINE_STANDARD_RTTIEXT(Message_CompositeAlerts, Standard_Transient)
0026 public:
0027   //! Empty constructor
0028   Message_CompositeAlerts() {}
0029 
0030   //! Returns list of collected alerts with specified gravity
0031   Standard_EXPORT const Message_ListOfAlert& Alerts (const Message_Gravity theGravity) const;
0032 
0033   //! Add alert with specified gravity. If the alert supports merge it will be merged.
0034   //! @param theGravity an alert gravity
0035   //! @param theAlert an alert to be added as a child alert
0036   //! @return true if the alert is added or merged
0037   Standard_EXPORT Standard_Boolean AddAlert (Message_Gravity theGravity,
0038                                              const Handle(Message_Alert)& theAlert);
0039 
0040   //! Removes alert with specified gravity.
0041   //! @param theGravity an alert gravity
0042   //! @param theAlert an alert to be removed from the children
0043   //! @return true if the alert is removed
0044   Standard_EXPORT Standard_Boolean RemoveAlert (Message_Gravity theGravity,
0045                                                 const Handle(Message_Alert)& theAlert);
0046 
0047   //! Returns true if the alert belong the list of the child alerts.
0048   //! @param theAlert an alert to be checked as a child alert
0049   //! @return true if the alert is found in a container of children
0050   Standard_EXPORT Standard_Boolean HasAlert (const Handle(Message_Alert)& theAlert);
0051 
0052   //! Returns true if specific type of alert is recorded with specified gravity
0053   //! @param theType an alert type
0054   //! @param theGravity an alert gravity
0055   //! @return true if the alert is found in a container of children
0056   Standard_EXPORT Standard_Boolean HasAlert (const Handle(Standard_Type)& theType,
0057                                              Message_Gravity theGravity);
0058 
0059   //! Clears all collected alerts
0060   Standard_EXPORT void Clear();
0061 
0062   //! Clears collected alerts with specified gravity
0063   //! @param theGravity an alert gravity
0064   Standard_EXPORT void Clear (Message_Gravity theGravity);
0065 
0066   //! Clears collected alerts with specified type
0067   //! @param theType an alert type
0068   Standard_EXPORT void Clear (const Handle(Standard_Type)& theType);
0069 
0070   //! Dumps the content of me into the stream
0071   Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
0072 
0073 protected:
0074   // store messages in a lists sorted by gravity;
0075   // here we rely on knowledge that Message_Fail is the last element of the enum
0076   Message_ListOfAlert myAlerts[Message_Fail + 1]; //!< container of child alert for each type of gravity
0077 };
0078 
0079 DEFINE_STANDARD_HANDLE(Message_CompositeAlerts, Standard_Transient)
0080 
0081 #endif // _Message_CompositeAlerts_HeaderFile