0024947: Redesign OCCT legacy type system -- automatic
[occt.git] / src / RWStepShape / RWStepShape_RWShapeRepresentationWithParameters.cxx
1 // Created on: 2003-06-04
2 // Created by: Galina KULIKOVA
3 // Copyright (c) 2003-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.2
17
18 #include <RWStepShape_RWShapeRepresentationWithParameters.ixx>
19 #include <StepRepr_HArray1OfRepresentationItem.hxx>
20 #include <StepRepr_RepresentationItem.hxx>
21 #include <StepRepr_RepresentationContext.hxx>
22
23
24 //=======================================================================
25 //function : RWStepShape_RWShapeRepresentationWithParameters
26 //purpose  : 
27 //=======================================================================
28
29 RWStepShape_RWShapeRepresentationWithParameters::RWStepShape_RWShapeRepresentationWithParameters ()
30 {
31 }
32
33 //=======================================================================
34 //function : ReadStep
35 //purpose  : 
36 //=======================================================================
37
38 void RWStepShape_RWShapeRepresentationWithParameters::ReadStep (const Handle(StepData_StepReaderData)& data,
39                                                                const Standard_Integer num,
40                                                                Handle(Interface_Check)& ach,
41                                                                const Handle(StepShape_ShapeRepresentationWithParameters) &ent) const
42 {
43   // Check number of parameters
44   if ( ! data->CheckNbParams(num,3,ach,"shape_representation_with_parameters") ) return;
45
46   // Inherited fields of Representation
47
48   Handle(TCollection_HAsciiString) aRepresentation_Name;
49   data->ReadString (num, 1, "representation.name", ach, aRepresentation_Name);
50
51   Handle(StepRepr_HArray1OfRepresentationItem) aRepresentation_Items;
52   Standard_Integer sub2 = 0;
53   if ( data->ReadSubList (num, 2, "representation.items", ach, sub2) ) {
54     Standard_Integer nb0 = data->NbParams(sub2);
55     aRepresentation_Items = new StepRepr_HArray1OfRepresentationItem (1, nb0);
56     Standard_Integer num2 = sub2;
57     for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) {
58       Handle(StepRepr_RepresentationItem) anIt0;
59       data->ReadEntity (num2, i0, "representation_item", ach, STANDARD_TYPE(StepRepr_RepresentationItem), anIt0);
60       aRepresentation_Items->SetValue(i0, anIt0);
61     }
62   }
63
64   Handle(StepRepr_RepresentationContext) aRepresentation_ContextOfItems;
65   data->ReadEntity (num, 3, "representation.context_of_items", ach, STANDARD_TYPE(StepRepr_RepresentationContext), aRepresentation_ContextOfItems);
66
67   // Initialize entity
68   ent->Init(aRepresentation_Name,
69             aRepresentation_Items,
70             aRepresentation_ContextOfItems);
71 }
72
73 //=======================================================================
74 //function : WriteStep
75 //purpose  : 
76 //=======================================================================
77
78 void RWStepShape_RWShapeRepresentationWithParameters::WriteStep (StepData_StepWriter& SW,
79                                                                 const Handle(StepShape_ShapeRepresentationWithParameters) &ent) const
80 {
81
82   // Inherited fields of Representation
83
84   SW.Send (ent->StepRepr_Representation::Name());
85
86   SW.OpenSub();
87   for (Standard_Integer i1=1; i1 <= ent->StepRepr_Representation::Items()->Length(); i1++ ) {
88     Handle(StepRepr_RepresentationItem) Var0 = ent->StepRepr_Representation::Items()->Value(i1);
89     SW.Send (Var0);
90   }
91   SW.CloseSub();
92
93   SW.Send (ent->StepRepr_Representation::ContextOfItems());
94 }
95
96 //=======================================================================
97 //function : Share
98 //purpose  : 
99 //=======================================================================
100
101 void RWStepShape_RWShapeRepresentationWithParameters::Share (const Handle(StepShape_ShapeRepresentationWithParameters) &ent,
102                                                             Interface_EntityIterator& iter) const
103 {
104
105   // Inherited fields of Representation
106
107   for (Standard_Integer i1=1; i1 <= ent->StepRepr_Representation::Items()->Length(); i1++ ) {
108     Handle(StepRepr_RepresentationItem) Var0 = ent->StepRepr_Representation::Items()->Value(i1);
109     iter.AddItem (Var0);
110   }
111
112   iter.AddItem (ent->StepRepr_Representation::ContextOfItems());
113 }