b311480e |
1 | // Copyright (c) 1999-2012 OPEN CASCADE SAS |
2 | // |
3 | // The content of this file is subject to the Open CASCADE Technology Public |
4 | // License Version 6.5 (the "License"). You may not use the content of this file |
5 | // except in compliance with the License. Please obtain a copy of the License |
6 | // at http://www.opencascade.org and read it completely before using this file. |
7 | // |
8 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
9 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
10 | // |
11 | // The Original Code and all software distributed under the License is |
12 | // distributed on an "AS IS" basis, without warranty of any kind, and the |
13 | // Initial Developer hereby disclaims all such warranties, including without |
14 | // limitation, any warranties of merchantability, fitness for a particular |
15 | // purpose or non-infringement. Please see the License for the specific terms |
16 | // and conditions governing the rights and limitations under the License. |
17 | |
7fd59977 |
18 | |
19 | #include <RWStepRepr_RWGlobalUncertaintyAssignedContext.ixx> |
20 | #include <StepBasic_HArray1OfUncertaintyMeasureWithUnit.hxx> |
21 | #include <StepBasic_UncertaintyMeasureWithUnit.hxx> |
22 | |
23 | |
24 | #include <Interface_EntityIterator.hxx> |
25 | |
26 | |
27 | #include <StepRepr_GlobalUncertaintyAssignedContext.hxx> |
28 | |
29 | |
30 | RWStepRepr_RWGlobalUncertaintyAssignedContext::RWStepRepr_RWGlobalUncertaintyAssignedContext () {} |
31 | |
32 | void RWStepRepr_RWGlobalUncertaintyAssignedContext::ReadStep |
33 | (const Handle(StepData_StepReaderData)& data, |
34 | const Standard_Integer num, |
35 | Handle(Interface_Check)& ach, |
36 | const Handle(StepRepr_GlobalUncertaintyAssignedContext)& ent) const |
37 | { |
38 | |
39 | |
40 | // --- Number of Parameter Control --- |
41 | |
42 | if (!data->CheckNbParams(num,3,ach,"global_uncertainty_assigned_context")) return; |
43 | |
44 | // --- inherited field : contextIdentifier --- |
45 | |
46 | Handle(TCollection_HAsciiString) aContextIdentifier; |
47 | //szv#4:S4163:12Mar99 `Standard_Boolean stat1 =` not needed |
48 | data->ReadString (num,1,"context_identifier",ach,aContextIdentifier); |
49 | |
50 | // --- inherited field : contextType --- |
51 | |
52 | Handle(TCollection_HAsciiString) aContextType; |
53 | //szv#4:S4163:12Mar99 `Standard_Boolean stat2 =` not needed |
54 | data->ReadString (num,2,"context_type",ach,aContextType); |
55 | |
56 | // --- own field : uncertainty --- |
57 | |
58 | Handle(StepBasic_HArray1OfUncertaintyMeasureWithUnit) aUncertainty; |
59 | Handle(StepBasic_UncertaintyMeasureWithUnit) anent3; |
60 | Standard_Integer nsub3; |
61 | if (data->ReadSubList (num,3,"uncertainty",ach,nsub3)) { |
62 | Standard_Integer nb3 = data->NbParams(nsub3); |
63 | aUncertainty = new StepBasic_HArray1OfUncertaintyMeasureWithUnit (1, nb3); |
64 | for (Standard_Integer i3 = 1; i3 <= nb3; i3 ++) { |
65 | //szv#4:S4163:12Mar99 `Standard_Boolean stat3 =` not needed |
66 | if (data->ReadEntity (nsub3, i3,"uncertainty_measure_with_unit", ach, |
67 | STANDARD_TYPE(StepBasic_UncertaintyMeasureWithUnit), anent3)) |
68 | aUncertainty->SetValue(i3, anent3); |
69 | } |
70 | } |
71 | |
72 | //--- Initialisation of the read entity --- |
73 | |
74 | |
75 | ent->Init(aContextIdentifier, aContextType, aUncertainty); |
76 | } |
77 | |
78 | |
79 | void RWStepRepr_RWGlobalUncertaintyAssignedContext::WriteStep |
80 | (StepData_StepWriter& SW, |
81 | const Handle(StepRepr_GlobalUncertaintyAssignedContext)& ent) const |
82 | { |
83 | |
84 | // --- inherited field contextIdentifier --- |
85 | |
86 | SW.Send(ent->ContextIdentifier()); |
87 | |
88 | // --- inherited field contextType --- |
89 | |
90 | SW.Send(ent->ContextType()); |
91 | |
92 | // --- own field : uncertainty --- |
93 | |
94 | SW.OpenSub(); |
95 | for (Standard_Integer i3 = 1; i3 <= ent->NbUncertainty(); i3 ++) { |
96 | SW.Send(ent->UncertaintyValue(i3)); |
97 | } |
98 | SW.CloseSub(); |
99 | } |
100 | |
101 | |
102 | void RWStepRepr_RWGlobalUncertaintyAssignedContext::Share(const Handle(StepRepr_GlobalUncertaintyAssignedContext)& ent, Interface_EntityIterator& iter) const |
103 | { |
104 | |
105 | Standard_Integer nbElem1 = ent->NbUncertainty(); |
106 | for (Standard_Integer is1=1; is1<=nbElem1; is1 ++) { |
107 | iter.GetOneItem(ent->UncertaintyValue(is1)); |
108 | } |
109 | |
110 | } |
111 | |