0031668: Visualization - WebGL sample doesn't work on Emscripten 1.39
[occt.git] / src / RWStepBasic / RWStepBasic_RWProductDefinitionRelationship.cxx
1 // Created on: 2000-07-03
2 // Created by: Andrey BETENEV
3 // Copyright (c) 2000-2014 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 // Generator:   ExpToCas (EXPRESS -> CASCADE/XSTEP Translator) V1.1
17
18 #include <Interface_Check.hxx>
19 #include <Interface_EntityIterator.hxx>
20 #include <RWStepBasic_RWProductDefinitionRelationship.hxx>
21 #include <StepBasic_ProductDefinitionOrReference.hxx>
22 #include <StepBasic_ProductDefinitionRelationship.hxx>
23 #include <StepData_StepReaderData.hxx>
24 #include <StepData_StepWriter.hxx>
25
26 //=======================================================================
27 //function : RWStepBasic_RWProductDefinitionRelationship
28 //purpose  : 
29 //=======================================================================
30 RWStepBasic_RWProductDefinitionRelationship::RWStepBasic_RWProductDefinitionRelationship ()
31 {
32 }
33
34 //=======================================================================
35 //function : ReadStep
36 //purpose  : 
37 //=======================================================================
38
39 void RWStepBasic_RWProductDefinitionRelationship::ReadStep (const Handle(StepData_StepReaderData)& data,
40                                                             const Standard_Integer num,
41                                                             Handle(Interface_Check)& ach,
42                                                             const Handle(StepBasic_ProductDefinitionRelationship) &ent) const
43 {
44   // Check number of parameters
45   if ( ! data->CheckNbParams(num,5,ach,"product_definition_relationship") ) return;
46
47   // Own fields of ProductDefinitionRelationship
48
49   Handle(TCollection_HAsciiString) aId;
50   data->ReadString (num, 1, "id", ach, aId);
51
52   Handle(TCollection_HAsciiString) aName;
53   data->ReadString (num, 2, "name", ach, aName);
54
55   Handle(TCollection_HAsciiString) aDescription;
56   Standard_Boolean hasDescription = Standard_True;
57   if ( data->IsParamDefined (num,3) ) {
58     data->ReadString (num, 3, "description", ach, aDescription);
59   }
60   else {
61     hasDescription = Standard_False;
62   }
63
64   StepBasic_ProductDefinitionOrReference aRelatingProductDefinition;
65   data->ReadEntity (num, 4, "relating_product_definition", ach, aRelatingProductDefinition);
66
67   StepBasic_ProductDefinitionOrReference aRelatedProductDefinition;
68   data->ReadEntity (num, 5, "related_product_definition", ach, aRelatedProductDefinition);
69
70   // Initialize entity
71   ent->Init(aId,
72             aName,
73             hasDescription,
74             aDescription,
75             aRelatingProductDefinition,
76             aRelatedProductDefinition);
77 }
78
79 //=======================================================================
80 //function : WriteStep
81 //purpose  : 
82 //=======================================================================
83
84 void RWStepBasic_RWProductDefinitionRelationship::WriteStep (StepData_StepWriter& SW,
85                                                              const Handle(StepBasic_ProductDefinitionRelationship) &ent) const
86 {
87
88   // Own fields of ProductDefinitionRelationship
89
90   SW.Send (ent->Id());
91
92   SW.Send (ent->Name());
93
94   if ( ent->HasDescription() ) {
95     SW.Send (ent->Description());
96   }
97   else SW.SendUndef();
98
99   SW.Send (ent->RelatingProductDefinitionAP242().Value());
100
101   SW.Send (ent->RelatedProductDefinitionAP242().Value());
102 }
103
104 //=======================================================================
105 //function : Share
106 //purpose  : 
107 //=======================================================================
108
109 void RWStepBasic_RWProductDefinitionRelationship::Share (const Handle(StepBasic_ProductDefinitionRelationship) &ent,
110                                                          Interface_EntityIterator& iter) const
111 {
112
113   // Own fields of ProductDefinitionRelationship
114
115   iter.AddItem (ent->RelatingProductDefinitionAP242().Value());
116
117   iter.AddItem (ent->RelatedProductDefinitionAP242().Value());
118 }