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