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