1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
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
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.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
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>
20 #include <Standard_Transient.hxx>
21 #include <Standard_Type.hxx>
23 IMPLEMENT_STANDARD_RTTIEXT(Interface_Protocol,Standard_Transient)
25 // Gestion du Protocol actif : tres simple, une variable statique
26 static Handle(Interface_Protocol)& theactive()
28 static Handle(Interface_Protocol) theact;
33 //=======================================================================
36 //=======================================================================
38 Handle(Interface_Protocol) Interface_Protocol::Active ()
44 //=======================================================================
45 //function : SetActive
47 //=======================================================================
49 void Interface_Protocol::SetActive(const Handle(Interface_Protocol)& aprotocol)
51 theactive() = aprotocol;
55 //=======================================================================
56 //function : ClearActive
58 //=======================================================================
60 void Interface_Protocol::ClearActive ()
62 theactive().Nullify();
66 // === Typage (formules fournies par defaut)
69 //=======================================================================
70 //function : CaseNumber
72 //=======================================================================
74 Standard_Integer Interface_Protocol::CaseNumber
75 (const Handle(Standard_Transient)& obj) const
77 if (obj.IsNull()) return 0;
78 return TypeNumber(Type(obj));
82 //=======================================================================
83 //function : IsDynamicType
85 //=======================================================================
87 Standard_Boolean Interface_Protocol::IsDynamicType
88 (const Handle(Standard_Transient)& /*obj*/) const
94 //=======================================================================
97 //=======================================================================
99 Standard_Integer Interface_Protocol::NbTypes
100 (const Handle(Standard_Transient)& /*obj*/) const
106 //=======================================================================
109 //=======================================================================
111 Handle(Standard_Type) Interface_Protocol::Type
112 (const Handle(Standard_Transient)& obj,
113 const Standard_Integer /*nt*/) const
115 if (obj.IsNull()) return STANDARD_TYPE(Standard_Transient);
116 return obj->DynamicType();
120 //=======================================================================
121 //function : GlobalCheck
123 //=======================================================================
125 Standard_Boolean Interface_Protocol::GlobalCheck(const Interface_Graph& /*graph*/,
126 Handle(Interface_Check)& /*ach*/) const
128 return Standard_True;