b311480e |
1 | // Created on: 2000-01-31 |
2 | // Created by: data exchange team |
973c2be1 |
3 | // Copyright (c) 2000-2014 OPEN CASCADE SAS |
b311480e |
4 | // |
973c2be1 |
5 | // This file is part of Open CASCADE Technology software library. |
b311480e |
6 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
12 | // |
973c2be1 |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
7fd59977 |
15 | |
42cf5bc1 |
16 | |
7fd59977 |
17 | #include <Message_ListOfMsg.hxx> |
42cf5bc1 |
18 | #include <Message_Msg.hxx> |
19 | #include <ShapeExtend_MsgRegistrator.hxx> |
20 | #include <Standard_Transient.hxx> |
21 | #include <Standard_Type.hxx> |
22 | #include <TopoDS_Shape.hxx> |
7fd59977 |
23 | |
24 | //======================================================================= |
25 | //function : ShapeExtend_MsgRegistrator |
26 | //purpose : |
27 | //======================================================================= |
7fd59977 |
28 | ShapeExtend_MsgRegistrator::ShapeExtend_MsgRegistrator() : ShapeExtend_BasicMsgRegistrator() |
29 | { |
30 | } |
31 | |
32 | //======================================================================= |
33 | //function : Send |
34 | //purpose : |
35 | //======================================================================= |
36 | |
37 | void ShapeExtend_MsgRegistrator::Send(const Handle(Standard_Transient)& object, |
38 | const Message_Msg& message, |
39 | const Message_Gravity) |
40 | { |
41 | if (object.IsNull()) { |
0797d9d3 |
42 | #ifdef OCCT_DEBUG |
7fd59977 |
43 | cout << "Warning: ShapeExtend_MsgRegistrator::Send: null object" << endl; |
44 | #endif |
45 | return; |
46 | } |
47 | if (myMapTransient.IsBound (object)) { |
48 | Message_ListOfMsg& list = myMapTransient.ChangeFind (object); |
49 | list.Append (message); |
50 | } |
51 | else { |
52 | Message_ListOfMsg list; |
53 | list.Append (message); |
54 | myMapTransient.Bind (object, list); |
55 | } |
56 | } |
57 | |
58 | //======================================================================= |
59 | //function : Send |
60 | //purpose : |
61 | //======================================================================= |
62 | |
63 | void ShapeExtend_MsgRegistrator::Send(const TopoDS_Shape& shape, |
64 | const Message_Msg& message, |
65 | const Message_Gravity) |
66 | { |
67 | if (shape.IsNull()) { |
0797d9d3 |
68 | #ifdef OCCT_DEBUG |
7fd59977 |
69 | cout << "Warning: ShapeExtend_MsgRegistrator::Send: null shape" << endl; |
70 | #endif |
71 | return; |
72 | } |
73 | if (myMapShape.IsBound (shape)) { |
74 | Message_ListOfMsg& list = myMapShape.ChangeFind (shape); |
75 | list.Append (message); |
76 | } |
77 | else { |
78 | Message_ListOfMsg list; |
79 | list.Append (message); |
80 | myMapShape.Bind (shape, list); |
81 | } |
82 | } |
83 | |