edfef7b79bd0a91896e58d85443ab11aff1eab99
[occt.git] / src / IGESDefs / IGESDefs_Protocol.cxx
1 // Copyright (c) 1999-2012 OPEN CASCADE SAS
2 //
3 // The content of this file is subject to the Open CASCADE Technology Public
4 // License Version 6.5 (the "License"). You may not use the content of this file
5 // except in compliance with the License. Please obtain a copy of the License
6 // at http://www.opencascade.org and read it completely before using this file.
7 //
8 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
9 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
10 //
11 // The Original Code and all software distributed under the License is
12 // distributed on an "AS IS" basis, without warranty of any kind, and the
13 // Initial Developer hereby disclaims all such warranties, including without
14 // limitation, any warranties of merchantability, fitness for a particular
15 // purpose or non-infringement. Please see the License for the specific terms
16 // and conditions governing the rights and limitations under the License.
17
18 #include <IGESDefs_Protocol.ixx>
19
20 #include <IGESDefs_AssociativityDef.hxx>
21 #include <IGESDefs_MacroDef.hxx>
22 #include <IGESDefs_UnitsData.hxx>
23 #include <IGESDefs_AttributeDef.hxx>
24 #include <IGESDefs_TabularData.hxx>
25 #include <IGESDefs_GenericData.hxx>
26 #include <IGESDefs_AttributeTable.hxx>
27
28 #include  <IGESGraph.hxx>
29 #include  <IGESGraph_Protocol.hxx>
30
31 static int deja = 0;
32 static Handle(Standard_Type) atype1,atype2,atype3,atype4,atype5,atype6,atype7;
33
34     IGESDefs_Protocol::IGESDefs_Protocol ()
35 {
36   if (deja) return;  deja = 1;
37   atype1 = STANDARD_TYPE(IGESDefs_AssociativityDef);
38   atype2 = STANDARD_TYPE(IGESDefs_AttributeDef);
39   atype3 = STANDARD_TYPE(IGESDefs_AttributeTable);
40   atype4 = STANDARD_TYPE(IGESDefs_GenericData);
41   atype5 = STANDARD_TYPE(IGESDefs_MacroDef);
42   atype6 = STANDARD_TYPE(IGESDefs_TabularData);
43   atype7 = STANDARD_TYPE(IGESDefs_UnitsData);
44 }
45
46     Standard_Integer IGESDefs_Protocol::NbResources () const
47       {  return 1;  }
48
49     Handle(Interface_Protocol) IGESDefs_Protocol::Resource
50   (const Standard_Integer num) const
51 {
52   Handle(Interface_Protocol) res = IGESGraph::Protocol();
53   return res;
54 }
55
56     Standard_Integer IGESDefs_Protocol::TypeNumber
57   (const Handle(Standard_Type)& atype) const
58 {   
59   if      (atype == atype1) return 1;
60   else if (atype == atype2) return 2;
61   else if (atype == atype3) return 3;
62   else if (atype == atype4) return 4;
63   else if (atype == atype5) return 5;
64   else if (atype == atype6) return 6;
65   else if (atype == atype7) return 7;
66   return 0;
67 }