Test for 0022778: Bug in BRepMesh
[occt.git] / src / RWStepAP214 / RWStepAP214_RWAppliedSecurityClassificationAssignment.cxx
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
18
19 #include <RWStepAP214_RWAppliedSecurityClassificationAssignment.ixx>
20 #include <StepAP214_HArray1OfSecurityClassificationItem.hxx>
21 #include <StepAP214_SecurityClassificationItem.hxx>
22 #include <StepBasic_SecurityClassification.hxx>
23
24
25 #include <Interface_EntityIterator.hxx>
26
27
28 #include <StepAP214_AppliedSecurityClassificationAssignment.hxx>
29
30
31 RWStepAP214_RWAppliedSecurityClassificationAssignment::RWStepAP214_RWAppliedSecurityClassificationAssignment () {}
32
33 void RWStepAP214_RWAppliedSecurityClassificationAssignment::ReadStep
34         (const Handle(StepData_StepReaderData)& data,
35          const Standard_Integer num,
36          Handle(Interface_Check)& ach,
37          const Handle(StepAP214_AppliedSecurityClassificationAssignment)& ent) const
38 {
39
40
41   // --- Number of Parameter Control ---
42   
43   if (!data->CheckNbParams(num,2,ach,"applied_security_classification_assignment")) return;
44   
45   // --- inherited field : assignedSecurityClassification ---
46   
47   Handle(StepBasic_SecurityClassification) aAssignedSecurityClassification;
48 #ifdef DEB
49   Standard_Boolean stat1 = 
50 #endif
51     data->ReadEntity(num, 1,"assigned_security_classification", ach, STANDARD_TYPE(StepBasic_SecurityClassification), aAssignedSecurityClassification);
52   
53   // --- own field : items ---
54   
55   Handle(StepAP214_HArray1OfSecurityClassificationItem) aItems;
56   StepAP214_SecurityClassificationItem anent2;
57   Standard_Integer nsub2;
58   if (data->ReadSubList (num,2,"items",ach,nsub2)) {
59     Standard_Integer nb2 = data->NbParams(nsub2);
60     aItems = new StepAP214_HArray1OfSecurityClassificationItem (1, nb2);
61     for (Standard_Integer i2 = 1; i2 <= nb2; i2 ++) {
62       Standard_Boolean stat2 = data->ReadEntity
63         (nsub2, i2,"items", ach, anent2); 
64       if (stat2) aItems->SetValue(i2, anent2);
65     }
66   }
67
68   //--- Initialisation of the read entity ---
69
70
71   ent->Init(aAssignedSecurityClassification, aItems);
72 }
73
74
75 void RWStepAP214_RWAppliedSecurityClassificationAssignment::WriteStep
76         (StepData_StepWriter& SW,
77          const Handle(StepAP214_AppliedSecurityClassificationAssignment)& ent) const
78 {
79
80   // --- inherited field assignedSecurityClassification ---
81
82   SW.Send(ent->AssignedSecurityClassification());
83
84   // --- own field : items ---
85
86   SW.OpenSub();
87   for (Standard_Integer i2 = 1;  i2 <= ent->NbItems();  i2 ++) {
88     SW.Send(ent->ItemsValue(i2).Value());
89   }
90   SW.CloseSub();
91 }
92
93
94 void RWStepAP214_RWAppliedSecurityClassificationAssignment::Share(const Handle(StepAP214_AppliedSecurityClassificationAssignment)& ent, Interface_EntityIterator& iter) const
95 {
96
97   iter.GetOneItem(ent->AssignedSecurityClassification());
98
99   Standard_Integer nbElem2 = ent->NbItems();
100   for (Standard_Integer is2=1; is2<=nbElem2; is2 ++) {
101     iter.GetOneItem(ent->ItemsValue(is2).Value());
102   }
103   
104 }
105