973c2be1 |
1 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
2 | // |
973c2be1 |
3 | // This file is part of Open CASCADE Technology software library. |
b311480e |
4 | // |
d5f74e42 |
5 | // This library is free software; you can redistribute it and/or modify it under |
6 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
7 | // by the Free Software Foundation, with special exception defined in the file |
8 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
9 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
10 | // |
973c2be1 |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
b311480e |
13 | |
42cf5bc1 |
14 | |
15 | #include <Interface_Check.hxx> |
16 | #include <Interface_Graph.hxx> |
17 | #include <Interface_InterfaceError.hxx> |
18 | #include <Interface_InterfaceModel.hxx> |
19 | #include <Interface_Protocol.hxx> |
ec357c5c |
20 | #include <Standard_Transient.hxx> |
42cf5bc1 |
21 | #include <Standard_Type.hxx> |
7fd59977 |
22 | |
25e59720 |
23 | IMPLEMENT_STANDARD_RTTIEXT(Interface_Protocol,Standard_Transient) |
92efcf78 |
24 | |
7fd59977 |
25 | // Gestion du Protocol actif : tres simple, une variable statique |
7fd59977 |
26 | static Handle(Interface_Protocol)& theactive() |
27 | { |
28 | static Handle(Interface_Protocol) theact; |
29 | return theact; |
30 | } |
31 | |
32 | |
33 | //======================================================================= |
34 | //function : Active |
35 | //purpose : |
36 | //======================================================================= |
37 | |
38 | Handle(Interface_Protocol) Interface_Protocol::Active () |
39 | { |
40 | return theactive(); |
41 | } |
42 | |
43 | |
44 | //======================================================================= |
45 | //function : SetActive |
46 | //purpose : |
47 | //======================================================================= |
48 | |
49 | void Interface_Protocol::SetActive(const Handle(Interface_Protocol)& aprotocol) |
50 | { |
51 | theactive() = aprotocol; |
52 | } |
53 | |
54 | |
55 | //======================================================================= |
56 | //function : ClearActive |
57 | //purpose : |
58 | //======================================================================= |
59 | |
60 | void Interface_Protocol::ClearActive () |
61 | { |
62 | theactive().Nullify(); |
63 | } |
64 | |
65 | |
66 | // === Typage (formules fournies par defaut) |
67 | |
68 | |
69 | //======================================================================= |
70 | //function : CaseNumber |
71 | //purpose : |
72 | //======================================================================= |
73 | |
74 | Standard_Integer Interface_Protocol::CaseNumber |
75 | (const Handle(Standard_Transient)& obj) const |
76 | { |
77 | if (obj.IsNull()) return 0; |
78 | return TypeNumber(Type(obj)); |
79 | } |
80 | |
81 | |
82 | //======================================================================= |
83 | //function : IsDynamicType |
84 | //purpose : |
85 | //======================================================================= |
86 | |
87 | Standard_Boolean Interface_Protocol::IsDynamicType |
88 | (const Handle(Standard_Transient)& /*obj*/) const |
89 | { |
90 | return Standard_True; |
91 | } |
92 | |
93 | |
94 | //======================================================================= |
95 | //function : NbTypes |
96 | //purpose : |
97 | //======================================================================= |
98 | |
99 | Standard_Integer Interface_Protocol::NbTypes |
100 | (const Handle(Standard_Transient)& /*obj*/) const |
101 | { |
102 | return 1; |
103 | } |
104 | |
105 | |
106 | //======================================================================= |
107 | //function : Type |
108 | //purpose : |
109 | //======================================================================= |
110 | |
111 | Handle(Standard_Type) Interface_Protocol::Type |
112 | (const Handle(Standard_Transient)& obj, |
113 | const Standard_Integer /*nt*/) const |
114 | { |
115 | if (obj.IsNull()) return STANDARD_TYPE(Standard_Transient); |
116 | return obj->DynamicType(); |
117 | } |
118 | |
119 | |
120 | //======================================================================= |
121 | //function : GlobalCheck |
122 | //purpose : |
123 | //======================================================================= |
124 | |
125 | Standard_Boolean Interface_Protocol::GlobalCheck(const Interface_Graph& /*graph*/, |
126 | Handle(Interface_Check)& /*ach*/) const |
127 | { |
128 | return Standard_True; |
129 | } |