Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-16 09:17:55

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 //! Base class of the hierarchy of classes describing various situations
0022 //! occurring during execution of some algorithm or procedure.
0023 //!
0024 //! Alert should provide unique text identifier that can be used to distinguish
0025 //! particular type of alerts, e.g. to get text message string describing it.
0026 //! See method GetMessageKey(); by default, dynamic type name is used.
0027 //!
0028 //! Alert can contain some data. To avoid duplication of data, new alert
0029 //! can be merged with another one of the same type. Method SupportsMerge()
0030 //! should return true if merge is supported; method Merge() should do the
0031 //! merge if possible and return true in that case and false otherwise.
0032 class Message_Alert : public Standard_Transient
0033 {
0034 public:
0035   //! Return a C string to be used as a key for generating text user
0036   //! messages describing this alert.
0037   //! The messages are generated with help of Message_Msg class, in
0038   //! Message_Report::Dump().
0039   //! Base implementation returns dynamic type name of the instance.
0040   virtual Standard_EXPORT const char* GetMessageKey() const;
0041 
0042   //! Return true if this type of alert can be merged with other
0043   //! of the same type to avoid duplication.
0044   //! Basis implementation returns true.
0045   virtual Standard_EXPORT bool SupportsMerge() const;
0046 
0047   //! If possible, merge data contained in this alert to theTarget.
0048   //! @return True if merged.
0049   //! Base implementation always returns true.
0050   virtual Standard_EXPORT bool Merge(const occ::handle<Message_Alert>& theTarget);
0051 
0052   //! Dumps the content of me into the stream
0053   virtual Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const;
0054 
0055   // OCCT RTTI
0056   DEFINE_STANDARD_RTTIEXT(Message_Alert, Standard_Transient)
0057 };
0058 
0059 //! Macro allowing to define simple alert (without data) in single line of code
0060 #define DEFINE_SIMPLE_ALERT(Alert)                                                                 \
0061   class Alert : public Message_Alert                                                               \
0062   {                                                                                                \
0063     DEFINE_STANDARD_RTTI_INLINE(Alert, Message_Alert)                                              \
0064   };
0065 
0066 #endif // _Message_Alert_HeaderFile