0026936: Drawbacks of inlining in new type system in OCCT 7.0 -- manual
[occt.git] / src / RWStepAP242 / RWStepAP242_RWGeometricItemSpecificUsage.cxx
CommitLineData
28a73c1f 1// Created on: 2015-07-07
2// Created by: Irina KRYLOVA
3// Copyright (c) 2015 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#include <RWStepAP242_RWGeometricItemSpecificUsage.hxx>
17#include <Interface_EntityIterator.hxx>
18#include <StepData_StepReaderData.hxx>
19#include <StepData_StepWriter.hxx>
20#include <StepAP242_GeometricItemSpecificUsage.hxx>
21#include <StepRepr_HArray1OfRepresentationItem.hxx>
22#include <StepRepr_Representation.hxx>
23
24
25RWStepAP242_RWGeometricItemSpecificUsage::RWStepAP242_RWGeometricItemSpecificUsage () {}
26
27void RWStepAP242_RWGeometricItemSpecificUsage::ReadStep
28 (const Handle(StepData_StepReaderData)& data,
29 const Standard_Integer num,
30 Handle(Interface_Check)& ach,
31 const Handle(StepAP242_GeometricItemSpecificUsage)& ent) const
32{
33
34
35 // --- Number of Parameter Control ---
36
37 if (!data->CheckNbParams(num,5,ach,"geometric_item_specific_usage")) return;
38
39 // Inherited fields of ItemIdentifiedRepresentationUsage
40
41 Handle(TCollection_HAsciiString) aName;
42 data->ReadString (num,1,"item_identified_representation_usage.name",ach,aName);
43
44 Handle(TCollection_HAsciiString) aDescription;
45 if (data->IsParamDefined (num,2)) {
46 data->ReadString (num,2,"item_identified_representation_usage.description",ach,aDescription);
47 }
48
49 StepAP242_ItemIdentifiedRepresentationUsageDefinition aDefinition;
50 data->ReadEntity(num,3,"item_identified_representation_usage.definition",ach,aDefinition);
51
52 Handle(StepRepr_Representation) aRepresentation;
53 data->ReadEntity (num,4,"item_identified_representation_usage.used_representation",ach,STANDARD_TYPE(StepRepr_Representation), aRepresentation);
54
55 Handle(StepRepr_HArray1OfRepresentationItem) anItems;
56 Handle(StepRepr_RepresentationItem) anEnt;
57 Standard_Integer nbSub;
58 Interface_ParamType aType = data->ParamType(num, 5);
59 if (aType == Interface_ParamIdent) {
60 data->ReadEntity(num, 5,"item_identified_representation_usage.identified_item", ach, STANDARD_TYPE(StepRepr_RepresentationItem), anEnt);
61 anItems = new StepRepr_HArray1OfRepresentationItem (1, 1);
62 anItems->SetValue(1, anEnt);
63 }
64 else if (data->ReadSubList (num,5,"item_identified_representation_usage.identified_item",ach,nbSub)) {
65 Standard_Integer nbElements = data->NbParams(nbSub);
66 anItems = new StepRepr_HArray1OfRepresentationItem (1, nbElements);
67 for (Standard_Integer i = 1; i <= nbElements; i++) {
68 if (data->ReadEntity(nbSub, i,"representation_item", ach,
69 STANDARD_TYPE(StepRepr_RepresentationItem), anEnt))
70 anItems->SetValue(i, anEnt);
71 }
72 }
73
74 //--- Initialisation of the read entity ---
75
76 ent->Init(aName, aDescription, aDefinition, aRepresentation, anItems);
77}
78
79void RWStepAP242_RWGeometricItemSpecificUsage::WriteStep
80 (StepData_StepWriter& SW,
81 const Handle(StepAP242_GeometricItemSpecificUsage)& ent) const
82{
83 // Inherited fields of ItemIdentifiedRepresentationUsage
84
85 SW.Send(ent->Name());
86
87 SW.Send(ent->Description());
88
89 SW.Send(ent->Definition().Value());
90
91 SW.Send(ent->UsedRepresentation());
92
93 if (ent->NbIdentifiedItem() == 1)
94 SW.Send(ent->IdentifiedItemValue(1));
95 else {
96 SW.OpenSub();
97 for (Standard_Integer i = 1; i <= ent->NbIdentifiedItem(); i++) {
98 SW.Send(ent->IdentifiedItemValue(i));
99 }
100 SW.CloseSub();
101 }
102}
103
104void RWStepAP242_RWGeometricItemSpecificUsage::Share(
105 const Handle(StepAP242_GeometricItemSpecificUsage)& ent,
106 Interface_EntityIterator& iter) const
107{
108 // Inherited fields of ItemIdentifiedRepresentationUsage
109
110 iter.AddItem(ent->Definition().Value());
111 Standard_Integer i, nb = ent->NbIdentifiedItem();
112 for (i = 1; i <= nb; i++)
113 iter.AddItem (ent->IdentifiedItemValue(i));
114}
115