7fd59977 |
1 | //gka 05.03.99 S4134 upgrade from CD to DIS |
2 | #include <RWStepBasic_RWProduct.ixx> |
3 | #include <StepBasic_HArray1OfProductContext.hxx> |
4 | #include <StepBasic_ProductContext.hxx> |
5 | |
6 | |
7 | #include <Interface_EntityIterator.hxx> |
8 | |
9 | |
10 | #include <StepBasic_Product.hxx> |
11 | |
12 | |
13 | RWStepBasic_RWProduct::RWStepBasic_RWProduct () {} |
14 | |
15 | void RWStepBasic_RWProduct::ReadStep |
16 | (const Handle(StepData_StepReaderData)& data, |
17 | const Standard_Integer num, |
18 | Handle(Interface_Check)& ach, |
19 | const Handle(StepBasic_Product)& ent) const |
20 | { |
21 | |
22 | |
23 | // --- Number of Parameter Control --- |
24 | |
25 | if (!data->CheckNbParams(num,4,ach,"product")) return; |
26 | |
27 | // --- own field : id --- |
28 | |
29 | Handle(TCollection_HAsciiString) aId; |
30 | //szv#4:S4163:12Mar99 `Standard_Boolean stat1 =` not needed |
31 | data->ReadString (num,1,"id",ach,aId); |
32 | |
33 | // --- own field : name --- |
34 | |
35 | Handle(TCollection_HAsciiString) aName; |
36 | //szv#4:S4163:12Mar99 `Standard_Boolean stat2 =` not needed |
37 | data->ReadString (num,2,"name",ach,aName); |
38 | |
39 | // --- own field : description --- |
40 | |
41 | Handle(TCollection_HAsciiString) aDescription; |
42 | if (data->IsParamDefined (num,3)) { //gka 05.03.99 S4134 upgrade from CD to DIS |
43 | //szv#4:S4163:12Mar99 `Standard_Boolean stat3 =` not needed |
44 | data->ReadString (num,3,"description",ach,aDescription); |
45 | } |
46 | // --- own field : frameOfReference --- |
47 | |
48 | Handle(StepBasic_HArray1OfProductContext) aFrameOfReference; |
49 | Handle(StepBasic_ProductContext) anent4; |
50 | Standard_Integer nsub4; |
51 | if (data->ReadSubList (num,4,"frame_of_reference",ach,nsub4)) { |
52 | Standard_Integer nb4 = data->NbParams(nsub4); |
53 | aFrameOfReference = new StepBasic_HArray1OfProductContext (1, nb4); |
54 | for (Standard_Integer i4 = 1; i4 <= nb4; i4 ++) { |
55 | //szv#4:S4163:12Mar99 `Standard_Boolean stat4 =` not needed |
56 | if (data->ReadEntity (nsub4, i4,"product_context", ach, STANDARD_TYPE(StepBasic_ProductContext), anent4)) |
57 | aFrameOfReference->SetValue(i4, anent4); |
58 | } |
59 | } |
60 | |
61 | //--- Initialisation of the read entity --- |
62 | |
63 | |
64 | ent->Init(aId, aName, aDescription, aFrameOfReference); |
65 | } |
66 | |
67 | |
68 | void RWStepBasic_RWProduct::WriteStep |
69 | (StepData_StepWriter& SW, |
70 | const Handle(StepBasic_Product)& ent) const |
71 | { |
72 | |
73 | // --- own field : id --- |
74 | |
75 | SW.Send(ent->Id()); |
76 | |
77 | // --- own field : name --- |
78 | |
79 | SW.Send(ent->Name()); |
80 | |
81 | // --- own field : description --- |
82 | |
83 | SW.Send(ent->Description()); |
84 | |
85 | // --- own field : frameOfReference --- |
86 | |
87 | SW.OpenSub(); |
88 | for (Standard_Integer i4 = 1; i4 <= ent->NbFrameOfReference(); i4 ++) { |
89 | SW.Send(ent->FrameOfReferenceValue(i4)); |
90 | } |
91 | SW.CloseSub(); |
92 | } |
93 | |
94 | |
95 | void RWStepBasic_RWProduct::Share(const Handle(StepBasic_Product)& ent, Interface_EntityIterator& iter) const |
96 | { |
97 | |
98 | Standard_Integer nbElem1 = ent->NbFrameOfReference(); |
99 | for (Standard_Integer is1=1; is1<=nbElem1; is1 ++) { |
100 | iter.GetOneItem(ent->FrameOfReferenceValue(is1)); |
101 | } |
102 | |
103 | } |
104 | |