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.
14 #include <RWStepAP214_RWAutoDesignDocumentReference.ixx>
16 #include <StepBasic_Document.hxx>
17 #include <TCollection_HAsciiString.hxx>
18 #include <StepAP214_HArray1OfAutoDesignReferencingItem.hxx>
19 #include <StepAP214_AutoDesignReferencingItem.hxx>
22 RWStepAP214_RWAutoDesignDocumentReference::RWStepAP214_RWAutoDesignDocumentReference () { }
24 void RWStepAP214_RWAutoDesignDocumentReference::ReadStep
25 (const Handle(StepData_StepReaderData)& data,
26 const Standard_Integer num,
27 Handle(Interface_Check)& ach,
28 const Handle(StepAP214_AutoDesignDocumentReference)& ent) const
30 // --- Number of Parameter Control ---
32 if (!data->CheckNbParams(num,3,ach,"auto_deesign_document_reference")) return;
34 // --- inherited field : assigned_document
36 Handle(StepBasic_Document) adoc;
38 (num, 1,"assigned_document", ach, STANDARD_TYPE(StepBasic_Document), adoc);
40 // --- inherited field : source ---
42 Handle(TCollection_HAsciiString) asource;
43 data->ReadString (num,2,"source",ach,asource);
46 // --- own field : items ---
48 Handle(StepAP214_HArray1OfAutoDesignReferencingItem) aItems;
49 StepAP214_AutoDesignReferencingItem anItem;
50 Standard_Integer nsub3;
51 if (data->ReadSubList (num,3,"items",ach,nsub3)) {
52 Standard_Integer nb3 = data->NbParams(nsub3);
53 aItems = new StepAP214_HArray1OfAutoDesignReferencingItem (1, nb3);
54 for (Standard_Integer i3 = 1; i3 <= nb3; i3 ++) {
55 Standard_Boolean stat3 = data->ReadEntity
56 (nsub3, i3,"item", ach, anItem);
57 if (stat3) aItems->SetValue(i3, anItem);
61 //--- Initialisation of the read entity ---
63 ent->Init (adoc,asource,aItems);
66 void RWStepAP214_RWAutoDesignDocumentReference::WriteStep
67 (StepData_StepWriter& SW,
68 const Handle(StepAP214_AutoDesignDocumentReference)& ent) const
71 // --- inherited field : assigned_document ---
73 SW.Send(ent->AssignedDocument());
75 // --- inherited field : source ---
77 SW.Send(ent->Source());
79 // --- own field : items ---
82 for (Standard_Integer i3 = 1; i3 <= ent->NbItems(); i3 ++) {
83 SW.Send(ent->ItemsValue(i3).Value());
89 void RWStepAP214_RWAutoDesignDocumentReference::Share(const Handle(StepAP214_AutoDesignDocumentReference)& ent, Interface_EntityIterator& iter) const
91 iter.AddItem (ent->AssignedDocument());
92 for (Standard_Integer i3 = 1; i3 <= ent->NbItems(); i3 ++)
93 iter.AddItem (ent->ItemsValue(i3).Value());