Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 2017-06-26
0002 // Created by: Andrey Betenev
0003 // Copyright (c) 2017 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _Message_Alert_HeaderFile
0017 #define _Message_Alert_HeaderFile
0018 
0019 #include <Standard_Type.hxx>
0020 
0021 DEFINE_STANDARD_HANDLE(Message_Alert, Standard_Transient)
0022 
0023 //! Base class of the hierarchy of classes describing various situations
0024 //! occurring during execution of some algorithm or procedure.
0025 //!
0026 //! Alert should provide unique text identifier that can be used to distinguish 
0027 //! particular type of alerts, e.g. to get text message string describing it. 
0028 //! See method GetMessageKey(); by default, dynamic type name is used.
0029 //!
0030 //! Alert can contain some data. To avoid duplication of data, new alert
0031 //! can be merged with another one of the same type. Method SupportsMerge() 
0032 //! should return true if merge is supported; method Merge() should do the
0033 //! merge if possible and return true in that case and false otherwise.
0034 class Message_Alert : public Standard_Transient
0035 {
0036 public:
0037 
0038   //! Return a C string to be used as a key for generating text user 
0039   //! messages describing this alert.
0040   //! The messages are generated with help of Message_Msg class, in
0041   //! Message_Report::Dump().
0042   //! Base implementation returns dynamic type name of the instance.
0043   virtual Standard_EXPORT Standard_CString GetMessageKey () const;
0044   
0045   //! Return true if this type of alert can be merged with other
0046   //! of the same type to avoid duplication.
0047   //! Basis implementation returns true.
0048   virtual Standard_EXPORT Standard_Boolean SupportsMerge () const;
0049   
0050   //! If possible, merge data contained in this alert to theTarget.
0051   //! @return True if merged.
0052   //! Base implementation always returns true.
0053   virtual Standard_EXPORT Standard_Boolean Merge (const Handle(Message_Alert)& theTarget);
0054   
0055   //! Dumps the content of me into the stream
0056   virtual Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
0057 
0058   // OCCT RTTI
0059   DEFINE_STANDARD_RTTIEXT(Message_Alert,Standard_Transient)
0060 };
0061 
0062 //! Macro allowing to define simple alert (without data) in single line of code
0063 #define DEFINE_SIMPLE_ALERT(Alert) class Alert : public Message_Alert { DEFINE_STANDARD_RTTI_INLINE(Alert,Message_Alert) };
0064 
0065 #endif // _Message_Alert_HeaderFile