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_AlertExtended_HeaderFile
0015 #define _Message_AlertExtended_HeaderFile
0016 
0017 #include <Message_Alert.hxx>
0018 #include <Message_Gravity.hxx>
0019 #include <TCollection_AsciiString.hxx>
0020 
0021 class Message_Attribute;
0022 class Message_Report;
0023 
0024 class Message_CompositeAlerts;
0025 
0026 //! Inherited class of Message_Alert with some additional information.
0027 //! It has Message_Attributes to provide the alert name, and other custom information
0028 //! It has a container of composite alerts, if the alert might provide
0029 //! sub-alerts collecting.
0030 class Message_AlertExtended : public Message_Alert
0031 {
0032 public:
0033   //! Creates new instance of the alert and put it into report with Message_Info gravity.
0034   //! It does nothing if such kind of gravity is not active in the report
0035   //! @param theReport the message report where new alert is placed
0036   //! @param theAttribute container of additional values of the alert
0037   //! @return created alert or NULL if Message_Info is not active in report
0038   Standard_EXPORT static Handle(Message_Alert) AddAlert (const Handle(Message_Report)& theReport,
0039                                                          const Handle(Message_Attribute)& theAttribute,
0040                                                          const Message_Gravity theGravity);
0041 
0042 public:
0043   //! Empty constructor
0044   Message_AlertExtended() : Message_Alert() {}
0045 
0046   //! Return a C string to be used as a key for generating text user messages describing this alert.
0047   //! The messages are generated with help of Message_Msg class, in Message_Report::Dump().
0048   //! Base implementation returns dynamic type name of the instance.
0049   Standard_EXPORT virtual Standard_CString GetMessageKey() const Standard_OVERRIDE;
0050 
0051   //! Returns container of the alert attributes
0052   const Handle(Message_Attribute)& Attribute() const { return myAttribute; }
0053 
0054   //! Sets container of the alert attributes
0055   //! @param theAttributes an attribute values
0056   void SetAttribute (const Handle(Message_Attribute)& theAttribute) { myAttribute = theAttribute; }
0057 
0058   //! Returns class provided hierarchy of alerts if created or create if the parameter is true
0059   //! @param theToCreate if composite alert has not been created for this alert, it should be created
0060   //! @return instance or NULL
0061   Standard_EXPORT Handle(Message_CompositeAlerts) CompositeAlerts (const Standard_Boolean theToCreate = Standard_False);
0062 
0063   //! Return true if this type of alert can be merged with other
0064   //! of the same type to avoid duplication.
0065   //! Hierarchical alerts can not be merged
0066   //! Basis implementation returns true.
0067   Standard_EXPORT virtual Standard_Boolean SupportsMerge() const Standard_OVERRIDE;
0068 
0069   //! If possible, merge data contained in this alert to theTarget.
0070   //! Base implementation always returns false.
0071   //! @return True if merged
0072   Standard_EXPORT virtual Standard_Boolean Merge (const Handle(Message_Alert)& theTarget) Standard_OVERRIDE;
0073 
0074   //! Dumps the content of me into the stream
0075   virtual Standard_EXPORT void DumpJson (Standard_OStream& theOStream,
0076                                          Standard_Integer theDepth = -1) const Standard_OVERRIDE;
0077 
0078   DEFINE_STANDARD_RTTIEXT(Message_AlertExtended, Message_Alert)
0079 
0080 protected:
0081 
0082   Handle(Message_CompositeAlerts) myCompositAlerts; //!< class provided hierarchical structure of alerts
0083   Handle(Message_Attribute) myAttribute; //!< container of the alert attributes
0084 };
0085 
0086 DEFINE_STANDARD_HANDLE(Message_AlertExtended, Message_Alert)
0087 
0088 #endif // _Message_Alert_HeaderFile