b311480e |
1 | // Created on: 2000-07-03 |
2 | // Created by: Andrey BETENEV |
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. |
b311480e |
15 | |
7fd59977 |
16 | // Generator: ExpToCas (EXPRESS -> CASCADE/XSTEP Translator) V1.1 |
7fd59977 |
17 | |
42cf5bc1 |
18 | #include <Interface_Check.hxx> |
19 | #include <Interface_EntityIterator.hxx> |
20 | #include <RWStepRepr_RWAssemblyComponentUsage.hxx> |
ec357c5c |
21 | #include <StepBasic_ProductDefinition.hxx> |
42cf5bc1 |
22 | #include <StepData_StepReaderData.hxx> |
23 | #include <StepData_StepWriter.hxx> |
24 | #include <StepRepr_AssemblyComponentUsage.hxx> |
25 | #include <StepRepr_ProductDefinitionShape.hxx> |
bedd79c4 |
26 | |
7fd59977 |
27 | //======================================================================= |
28 | //function : RWStepRepr_RWAssemblyComponentUsage |
29 | //purpose : |
30 | //======================================================================= |
7fd59977 |
31 | RWStepRepr_RWAssemblyComponentUsage::RWStepRepr_RWAssemblyComponentUsage () |
32 | { |
33 | } |
34 | |
35 | //======================================================================= |
36 | //function : ReadStep |
37 | //purpose : |
38 | //======================================================================= |
39 | |
40 | void RWStepRepr_RWAssemblyComponentUsage::ReadStep (const Handle(StepData_StepReaderData)& data, |
41 | const Standard_Integer num, |
42 | Handle(Interface_Check)& ach, |
43 | const Handle(StepRepr_AssemblyComponentUsage) &ent) const |
44 | { |
45 | // Check number of parameters |
46 | if ( ! data->CheckNbParams(num,6,ach,"assembly_component_usage") ) return; |
47 | |
48 | // Inherited fields of ProductDefinitionRelationship |
49 | |
50 | Handle(TCollection_HAsciiString) aProductDefinitionRelationship_Id; |
51 | data->ReadString (num, 1, "product_definition_relationship.id", ach, aProductDefinitionRelationship_Id); |
52 | |
53 | Handle(TCollection_HAsciiString) aProductDefinitionRelationship_Name; |
54 | data->ReadString (num, 2, "product_definition_relationship.name", ach, aProductDefinitionRelationship_Name); |
55 | |
56 | Handle(TCollection_HAsciiString) aProductDefinitionRelationship_Description; |
57 | Standard_Boolean hasProductDefinitionRelationship_Description = Standard_True; |
58 | if ( data->IsParamDefined (num,3) ) { |
59 | data->ReadString (num, 3, "product_definition_relationship.description", ach, aProductDefinitionRelationship_Description); |
60 | } |
61 | else { |
62 | hasProductDefinitionRelationship_Description = Standard_False; |
63 | } |
64 | |
65 | Handle(StepBasic_ProductDefinition) aProductDefinitionRelationship_RelatingProductDefinition; |
66 | data->ReadEntity (num, 4, "product_definition_relationship.relating_product_definition", ach, STANDARD_TYPE(StepBasic_ProductDefinition), aProductDefinitionRelationship_RelatingProductDefinition); |
bedd79c4 |
67 | if (aProductDefinitionRelationship_RelatingProductDefinition.IsNull()) |
68 | { |
69 | Handle(StepRepr_ProductDefinitionShape) aProductDefinitionShape; |
70 | data->ReadEntity (num, 4, "product_definition_relationship.relating_product_definition_shape", ach, STANDARD_TYPE(StepRepr_ProductDefinitionShape), aProductDefinitionShape); |
71 | if (!aProductDefinitionShape.IsNull()) |
72 | { |
73 | aProductDefinitionRelationship_RelatingProductDefinition = aProductDefinitionShape->Definition().ProductDefinition(); |
74 | } |
75 | } |
7fd59977 |
76 | |
77 | Handle(StepBasic_ProductDefinition) aProductDefinitionRelationship_RelatedProductDefinition; |
78 | data->ReadEntity (num, 5, "product_definition_relationship.related_product_definition", ach, STANDARD_TYPE(StepBasic_ProductDefinition), aProductDefinitionRelationship_RelatedProductDefinition); |
bedd79c4 |
79 | if (aProductDefinitionRelationship_RelatedProductDefinition.IsNull()) |
80 | { |
81 | Handle(StepRepr_ProductDefinitionShape) aProductDefinitionShape; |
82 | data->ReadEntity (num, 5, "product_definition_relationship.related_product_definition_shape", ach, STANDARD_TYPE(StepRepr_ProductDefinitionShape), aProductDefinitionShape); |
83 | if (!aProductDefinitionShape.IsNull()) |
84 | { |
85 | aProductDefinitionRelationship_RelatedProductDefinition = aProductDefinitionShape->Definition().ProductDefinition(); |
86 | } |
87 | } |
7fd59977 |
88 | |
89 | // Own fields of AssemblyComponentUsage |
90 | |
91 | Handle(TCollection_HAsciiString) aReferenceDesignator; |
92 | Standard_Boolean hasReferenceDesignator = Standard_True; |
93 | if ( data->IsParamDefined (num,6) ) { |
94 | data->ReadString (num, 6, "reference_designator", ach, aReferenceDesignator); |
95 | } |
96 | else { |
97 | hasReferenceDesignator = Standard_False; |
98 | } |
99 | |
100 | // Initialize entity |
101 | ent->Init(aProductDefinitionRelationship_Id, |
102 | aProductDefinitionRelationship_Name, |
103 | hasProductDefinitionRelationship_Description, |
104 | aProductDefinitionRelationship_Description, |
105 | aProductDefinitionRelationship_RelatingProductDefinition, |
106 | aProductDefinitionRelationship_RelatedProductDefinition, |
107 | hasReferenceDesignator, |
108 | aReferenceDesignator); |
109 | } |
110 | |
111 | //======================================================================= |
112 | //function : WriteStep |
113 | //purpose : |
114 | //======================================================================= |
115 | |
116 | void RWStepRepr_RWAssemblyComponentUsage::WriteStep (StepData_StepWriter& SW, |
117 | const Handle(StepRepr_AssemblyComponentUsage) &ent) const |
118 | { |
119 | |
120 | // Inherited fields of ProductDefinitionRelationship |
121 | |
122 | SW.Send (ent->StepBasic_ProductDefinitionRelationship::Id()); |
123 | |
124 | SW.Send (ent->StepBasic_ProductDefinitionRelationship::Name()); |
125 | |
126 | if ( ent->StepBasic_ProductDefinitionRelationship::HasDescription() ) { |
127 | SW.Send (ent->StepBasic_ProductDefinitionRelationship::Description()); |
128 | } |
129 | else SW.SendUndef(); |
130 | |
131 | SW.Send (ent->StepBasic_ProductDefinitionRelationship::RelatingProductDefinition()); |
132 | |
133 | SW.Send (ent->StepBasic_ProductDefinitionRelationship::RelatedProductDefinition()); |
134 | |
135 | // Own fields of AssemblyComponentUsage |
136 | |
137 | if ( ent->HasReferenceDesignator() ) { |
138 | SW.Send (ent->ReferenceDesignator()); |
139 | } |
140 | else SW.SendUndef(); |
141 | } |
142 | |
143 | //======================================================================= |
144 | //function : Share |
145 | //purpose : |
146 | //======================================================================= |
147 | |
148 | void RWStepRepr_RWAssemblyComponentUsage::Share (const Handle(StepRepr_AssemblyComponentUsage) &ent, |
149 | Interface_EntityIterator& iter) const |
150 | { |
151 | |
152 | // Inherited fields of ProductDefinitionRelationship |
153 | |
154 | iter.AddItem (ent->StepBasic_ProductDefinitionRelationship::RelatingProductDefinition()); |
155 | |
156 | iter.AddItem (ent->StepBasic_ProductDefinitionRelationship::RelatedProductDefinition()); |
157 | |
158 | // Own fields of AssemblyComponentUsage |
159 | } |