0022048: Visualization, AIS_InteractiveContext - single object selection should alway...
[occt.git] / src / Message / Message_Alert.hxx
1 // Created on: 2017-06-26
2 // Created by: Andrey Betenev
3 // Copyright (c) 2017 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 #ifndef _Message_Alert_HeaderFile
17 #define _Message_Alert_HeaderFile
18
19 #include <Standard_Type.hxx>
20
21 class Message_Alert;
22 DEFINE_STANDARD_HANDLE(Message_Alert, MMgt_TShared)
23
24 //! Base class of the hierarchy of classes describing various situations
25 //! occurring during execution of some algorithm or procedure.
26 //!
27 //! Alert should provide unique text identifier that can be used to distinguish 
28 //! particular type of alerts, e.g. to get text message string describing it. 
29 //! See method GetMessageKey(); by default, dynamic type name is used.
30 //!
31 //! Alert can contain some data. To avoid duplication of data, new alert
32 //! can be merged with another one of the same type. Method SupportsMerge() 
33 //! should return true if merge is supported; method Merge() should do the
34 //! merge if possible and return true in that case and false otherwise.
35 //! 
36 class Message_Alert : public Standard_Transient
37 {
38 public:
39
40   //! Return a C string to be used as a key for generating text user 
41   //! messages describing this alert.
42   //! The messages are generated with help of Message_Msg class, in
43   //! Message_Report::Dump().
44   //! Base implementation returns dynamic type name of the instance.
45   virtual Standard_EXPORT Standard_CString GetMessageKey () const;
46   
47   //! Return true if this type of alert can be merged with other
48   //! of the same type to avoid duplication.
49   //! Basis implementation returns true.
50   virtual Standard_EXPORT Standard_Boolean SupportsMerge () const;
51   
52   //! If possible, merge data contained in this alert to theTarget.
53   //! @return True if merged.
54   //! Base implementation always returns true.
55   virtual Standard_EXPORT Standard_Boolean Merge (const Handle(Message_Alert)& theTarget);
56   
57   // OCCT RTTI
58   DEFINE_STANDARD_RTTIEXT(Message_Alert,Standard_Transient)
59 };
60
61 //! Macro allowing to define simple alert (without data) in single line of code
62 #define DEFINE_SIMPLE_ALERT(Alert) class Alert : public Message_Alert { DEFINE_STANDARD_RTTI_INLINE(Alert,Message_Alert) };
63
64 #endif // _Message_Alert_HeaderFile