0024002: Overall code and build procedure refactoring -- automatic
[occt.git] / src / RWStepRepr / RWStepRepr_RWDataEnvironment.cxx
CommitLineData
b311480e 1// Created on: 2002-12-12
2// Created by: data exchange team
973c2be1 3// Copyright (c) 2002-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.2
7fd59977 17
42cf5bc1 18#include <Interface_Check.hxx>
19#include <Interface_EntityIterator.hxx>
20#include <RWStepRepr_RWDataEnvironment.hxx>
21#include <StepData_StepReaderData.hxx>
22#include <StepData_StepWriter.hxx>
23#include <StepRepr_DataEnvironment.hxx>
7fd59977 24#include <StepRepr_HArray1OfPropertyDefinitionRepresentation.hxx>
25#include <StepRepr_PropertyDefinitionRepresentation.hxx>
26
27//=======================================================================
28//function : RWStepRepr_RWDataEnvironment
29//purpose :
30//=======================================================================
7fd59977 31RWStepRepr_RWDataEnvironment::RWStepRepr_RWDataEnvironment ()
32{
33}
34
35//=======================================================================
36//function : ReadStep
37//purpose :
38//=======================================================================
39
40void RWStepRepr_RWDataEnvironment::ReadStep (const Handle(StepData_StepReaderData)& data,
41 const Standard_Integer num,
42 Handle(Interface_Check)& ach,
43 const Handle(StepRepr_DataEnvironment) &ent) const
44{
45 // Check number of parameters
46 if ( ! data->CheckNbParams(num,3,ach,"data_environment") ) return;
47
48 // Own fields of DataEnvironment
49
50 Handle(TCollection_HAsciiString) aName;
51 data->ReadString (num, 1, "name", ach, aName);
52
53 Handle(TCollection_HAsciiString) aDescription;
54 data->ReadString (num, 2, "description", ach, aDescription);
55
56 Handle(StepRepr_HArray1OfPropertyDefinitionRepresentation) aElements;
57 Standard_Integer sub3 = 0;
58 if ( data->ReadSubList (num, 3, "elements", ach, sub3) ) {
59 Standard_Integer nb0 = data->NbParams(sub3);
60 aElements = new StepRepr_HArray1OfPropertyDefinitionRepresentation (1, nb0);
61 Standard_Integer num2 = sub3;
62 for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) {
63 Handle(StepRepr_PropertyDefinitionRepresentation) anIt0;
64 data->ReadEntity (num2, i0, "property_definition_representation", ach, STANDARD_TYPE(StepRepr_PropertyDefinitionRepresentation), anIt0);
65 aElements->SetValue(i0, anIt0);
66 }
67 }
68
69 // Initialize entity
70 ent->Init(aName,
71 aDescription,
72 aElements);
73}
74
75//=======================================================================
76//function : WriteStep
77//purpose :
78//=======================================================================
79
80void RWStepRepr_RWDataEnvironment::WriteStep (StepData_StepWriter& SW,
81 const Handle(StepRepr_DataEnvironment) &ent) const
82{
83
84 // Own fields of DataEnvironment
85
86 SW.Send (ent->Name());
87
88 SW.Send (ent->Description());
89
90 SW.OpenSub();
91 for (Standard_Integer i2=1; i2 <= ent->Elements()->Length(); i2++ ) {
92 Handle(StepRepr_PropertyDefinitionRepresentation) Var0 = ent->Elements()->Value(i2);
93 SW.Send (Var0);
94 }
95 SW.CloseSub();
96}
97
98//=======================================================================
99//function : Share
100//purpose :
101//=======================================================================
102
103void RWStepRepr_RWDataEnvironment::Share (const Handle(StepRepr_DataEnvironment) &ent,
104 Interface_EntityIterator& iter) const
105{
106
107 // Own fields of DataEnvironment
108
109 for (Standard_Integer i1=1; i1 <= ent->Elements()->Length(); i1++ ) {
110 Handle(StepRepr_PropertyDefinitionRepresentation) Var0 = ent->Elements()->Value(i1);
111 iter.AddItem (Var0);
112 }
113}