1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
15 #include <Interface_Check.hxx>
16 #include <Interface_EntityIterator.hxx>
17 #include <RWStepRepr_RWCompoundRepresentationItem.hxx>
18 #include <StepData_StepReaderData.hxx>
19 #include <StepData_StepWriter.hxx>
20 #include <StepRepr_CompoundRepresentationItem.hxx>
21 #include <StepRepr_HArray1OfRepresentationItem.hxx>
22 #include <StepRepr_RepresentationItem.hxx>
23 #include <TCollection_HAsciiString.hxx>
25 RWStepRepr_RWCompoundRepresentationItem::RWStepRepr_RWCompoundRepresentationItem () { }
27 void RWStepRepr_RWCompoundRepresentationItem::ReadStep
28 (const Handle(StepData_StepReaderData)& data,
29 const Standard_Integer num,
30 Handle(Interface_Check)& ach,
31 const Handle(StepRepr_CompoundRepresentationItem)& ent) const
33 // --- Number of Parameter Control ---
34 if (!data->CheckNbParams(num,2,ach,"compound_representation_item")) return;
36 // --- inherited field : name ---
38 Handle(TCollection_HAsciiString) aName;
39 //szv#4:S4163:12Mar99 `Standard_Boolean stat1 =` not needed
40 data->ReadString (num,1,"name",ach,aName);
42 // --- own field : item_element
44 Handle(StepRepr_HArray1OfRepresentationItem) aItems;
45 Handle(StepRepr_RepresentationItem) anent2;
46 Standard_Integer nsub2;
47 if (data->ReadSubList (num,2,"item_element",ach,nsub2)) {
48 Standard_Integer nb2 = data->NbParams(nsub2);
49 aItems = new StepRepr_HArray1OfRepresentationItem (1, nb2);
50 for (Standard_Integer i2 = 1; i2 <= nb2; i2 ++) {
51 if (data->ReadEntity(nsub2, i2,"representation_item", ach,
52 STANDARD_TYPE(StepRepr_RepresentationItem), anent2))
53 aItems->SetValue(i2, anent2);
57 ent->Init (aName,aItems);
60 void RWStepRepr_RWCompoundRepresentationItem::WriteStep
61 (StepData_StepWriter& SW,
62 const Handle(StepRepr_CompoundRepresentationItem)& ent) const
64 // --- inherited field : name ---
68 // --- own field : items ---
71 for (Standard_Integer i2 = 1; i2 <= ent->NbItemElement(); i2 ++) {
72 SW.Send(ent->ItemElementValue(i2));
77 void RWStepRepr_RWCompoundRepresentationItem::Share
78 (const Handle(StepRepr_CompoundRepresentationItem)& ent,
79 Interface_EntityIterator& iter) const
81 Standard_Integer i, nb = ent->NbItemElement();
82 for (i = 1; i <= nb; i ++) iter.AddItem (ent->ItemElementValue(i));