Integration of OCCT 6.5.0 from SVN
[occt.git] / src / RWHeaderSection / RWHeaderSection_RWFileName.cxx
CommitLineData
7fd59977 1
2#include <RWHeaderSection_RWFileName.ixx>
3#include <Interface_HArray1OfHAsciiString.hxx>
4
5
6RWHeaderSection_RWFileName::RWHeaderSection_RWFileName () {}
7
8void RWHeaderSection_RWFileName::ReadStep
9 (const Handle(StepData_StepReaderData)& data,
10 const Standard_Integer num,
11 Handle(Interface_Check)& ach,
12 const Handle(HeaderSection_FileName)& ent) const
13{
14
15
16 // --- Number of Parameter Control ---
17
18 if (!data->CheckNbParams(num,7,ach,"file_name has not 7 parameter(s)")) return;
19
20 // --- own field : name ---
21
22 Handle(TCollection_HAsciiString) aName;
23 Standard_Boolean stat1;
24 stat1 = data->ReadString (num,1,"name",ach,aName);
25
26 // --- own field : timeStamp ---
27
28 Handle(TCollection_HAsciiString) aTimeStamp;
29 Standard_Boolean stat2;
30 stat2 = data->ReadString (num,2,"time_stamp",ach,aTimeStamp);
31
32 // --- own field : author ---
33
34 Handle(Interface_HArray1OfHAsciiString) aAuthor;
35 Handle(TCollection_HAsciiString) aAuthorItem;
36 Standard_Integer nsub3;
37 nsub3 = data->SubListNumber(num, 3, Standard_False);
38 if (nsub3 !=0) {
39 Standard_Integer nb3 = data->NbParams(nsub3);
40 aAuthor = new Interface_HArray1OfHAsciiString (1, nb3);
41 for (Standard_Integer i3 = 1; i3 <= nb3; i3 ++) {
42 Standard_Boolean stat3 = data->ReadString
43 (nsub3,i3,"author",ach,aAuthorItem);
44 if (stat3) aAuthor->SetValue(i3,aAuthorItem);
45 }
46 }
47 else {
48 ach->AddFail("Parameter #3 (author) is not a LIST");
49 }
50
51 // --- own field : organization ---
52
53 Handle(Interface_HArray1OfHAsciiString) aOrganization;
54 Handle(TCollection_HAsciiString) aOrganizationItem;
55 Standard_Integer nsub4;
56 nsub4 = data->SubListNumber(num, 4, Standard_False);
57 if (nsub4 !=0) {
58 Standard_Integer nb4 = data->NbParams(nsub4);
59 aOrganization = new Interface_HArray1OfHAsciiString (1, nb4);
60 for (Standard_Integer i4 = 1; i4 <= nb4; i4 ++) {
61 Standard_Boolean stat4 = data->ReadString
62 (nsub4,i4,"organization",ach,aOrganizationItem);
63 if (stat4) aOrganization->SetValue(i4,aOrganizationItem);
64 }
65 }
66 else {
67 ach->AddFail("Parameter #4 (organization) is not a LIST");
68 }
69
70 // --- own field : preprocessorVersion ---
71
72 Handle(TCollection_HAsciiString) aPreprocessorVersion;
73 Standard_Boolean stat5;
74 stat5 = data->ReadString (num,5,"preprocessor_version",ach,aPreprocessorVersion);
75
76 // --- own field : originatingSystem ---
77
78 Handle(TCollection_HAsciiString) aOriginatingSystem;
79 Standard_Boolean stat6;
80 stat6 = data->ReadString (num,6,"originating_system",ach,aOriginatingSystem);
81
82 // --- own field : authorisation ---
83
84 Handle(TCollection_HAsciiString) aAuthorisation;
85 Standard_Boolean stat7;
86 stat7 = data->ReadString (num,7,"authorisation",ach,aAuthorisation);
87
88 //--- Initialisation of the read entity ---
89
90
91 if (!ach->HasFailed()) ent->Init(aName, aTimeStamp, aAuthor, aOrganization, aPreprocessorVersion, aOriginatingSystem, aAuthorisation);
92}
93
94
95void RWHeaderSection_RWFileName::WriteStep
96 (StepData_StepWriter& SW,
97 const Handle(HeaderSection_FileName)& ent) const
98{
99
100 // --- own field : name ---
101
102 SW.Send(ent->Name());
103
104 // --- own field : timeStamp ---
105
106 SW.Send(ent->TimeStamp());
107
108 // --- own field : author ---
109
110 SW.OpenSub();
111 for (Standard_Integer i3 = 1; i3 <= ent->NbAuthor(); i3 ++) {
112 SW.Send(ent->AuthorValue(i3));
113 }
114 SW.CloseSub();
115
116 // --- own field : organization ---
117
118 SW.OpenSub();
119 for (Standard_Integer i4 = 1; i4 <= ent->NbOrganization(); i4 ++) {
120 SW.Send(ent->OrganizationValue(i4));
121 }
122 SW.CloseSub();
123
124 // --- own field : preprocessorVersion ---
125
126 SW.Send(ent->PreprocessorVersion());
127
128 // --- own field : originatingSystem ---
129
130 SW.Send(ent->OriginatingSystem());
131
132 // --- own field : authorisation ---
133
134 SW.Send(ent->Authorisation());
135}