0024023: Revamp the OCCT Handle -- ambiguity
[occt.git] / src / RWHeaderSection / RWHeaderSection_RWFileName.cxx
CommitLineData
973c2be1 1// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 2//
973c2be1 3// This file is part of Open CASCADE Technology software library.
b311480e 4//
d5f74e42 5// This library is free software; you can redistribute it and/or modify it under
6// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 7// by the Free Software Foundation, with special exception defined in the file
8// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9// distribution for complete text of the license and disclaimer of any warranty.
b311480e 10//
973c2be1 11// Alternatively, this file may be used under the terms of Open CASCADE
12// commercial license or contractual agreement.
7fd59977 13
14#include <RWHeaderSection_RWFileName.ixx>
15#include <Interface_HArray1OfHAsciiString.hxx>
16
17
18RWHeaderSection_RWFileName::RWHeaderSection_RWFileName () {}
19
20void RWHeaderSection_RWFileName::ReadStep
21 (const Handle(StepData_StepReaderData)& data,
22 const Standard_Integer num,
23 Handle(Interface_Check)& ach,
24 const Handle(HeaderSection_FileName)& ent) const
25{
26
27
28 // --- Number of Parameter Control ---
29
30 if (!data->CheckNbParams(num,7,ach,"file_name has not 7 parameter(s)")) return;
31
32 // --- own field : name ---
33
34 Handle(TCollection_HAsciiString) aName;
96a95605 35 data->ReadString (num,1,"name",ach,aName);
7fd59977 36
37 // --- own field : timeStamp ---
38
39 Handle(TCollection_HAsciiString) aTimeStamp;
96a95605 40 data->ReadString (num,2,"time_stamp",ach,aTimeStamp);
7fd59977 41
42 // --- own field : author ---
43
44 Handle(Interface_HArray1OfHAsciiString) aAuthor;
45 Handle(TCollection_HAsciiString) aAuthorItem;
46 Standard_Integer nsub3;
47 nsub3 = data->SubListNumber(num, 3, Standard_False);
48 if (nsub3 !=0) {
49 Standard_Integer nb3 = data->NbParams(nsub3);
50 aAuthor = new Interface_HArray1OfHAsciiString (1, nb3);
51 for (Standard_Integer i3 = 1; i3 <= nb3; i3 ++) {
52 Standard_Boolean stat3 = data->ReadString
53 (nsub3,i3,"author",ach,aAuthorItem);
54 if (stat3) aAuthor->SetValue(i3,aAuthorItem);
55 }
56 }
57 else {
58 ach->AddFail("Parameter #3 (author) is not a LIST");
59 }
60
61 // --- own field : organization ---
62
63 Handle(Interface_HArray1OfHAsciiString) aOrganization;
64 Handle(TCollection_HAsciiString) aOrganizationItem;
65 Standard_Integer nsub4;
66 nsub4 = data->SubListNumber(num, 4, Standard_False);
67 if (nsub4 !=0) {
68 Standard_Integer nb4 = data->NbParams(nsub4);
69 aOrganization = new Interface_HArray1OfHAsciiString (1, nb4);
70 for (Standard_Integer i4 = 1; i4 <= nb4; i4 ++) {
71 Standard_Boolean stat4 = data->ReadString
72 (nsub4,i4,"organization",ach,aOrganizationItem);
73 if (stat4) aOrganization->SetValue(i4,aOrganizationItem);
74 }
75 }
76 else {
77 ach->AddFail("Parameter #4 (organization) is not a LIST");
78 }
79
80 // --- own field : preprocessorVersion ---
81
82 Handle(TCollection_HAsciiString) aPreprocessorVersion;
96a95605 83 data->ReadString (num,5,"preprocessor_version",ach,aPreprocessorVersion);
7fd59977 84
85 // --- own field : originatingSystem ---
86
87 Handle(TCollection_HAsciiString) aOriginatingSystem;
96a95605 88 data->ReadString (num,6,"originating_system",ach,aOriginatingSystem);
7fd59977 89
90 // --- own field : authorisation ---
91
92 Handle(TCollection_HAsciiString) aAuthorisation;
96a95605 93 data->ReadString (num,7,"authorisation",ach,aAuthorisation);
7fd59977 94
95 //--- Initialisation of the read entity ---
96
97
98 if (!ach->HasFailed()) ent->Init(aName, aTimeStamp, aAuthor, aOrganization, aPreprocessorVersion, aOriginatingSystem, aAuthorisation);
99}
100
101
102void RWHeaderSection_RWFileName::WriteStep
103 (StepData_StepWriter& SW,
104 const Handle(HeaderSection_FileName)& ent) const
105{
106
107 // --- own field : name ---
108
109 SW.Send(ent->Name());
110
111 // --- own field : timeStamp ---
112
113 SW.Send(ent->TimeStamp());
114
115 // --- own field : author ---
116
117 SW.OpenSub();
118 for (Standard_Integer i3 = 1; i3 <= ent->NbAuthor(); i3 ++) {
119 SW.Send(ent->AuthorValue(i3));
120 }
121 SW.CloseSub();
122
123 // --- own field : organization ---
124
125 SW.OpenSub();
126 for (Standard_Integer i4 = 1; i4 <= ent->NbOrganization(); i4 ++) {
127 SW.Send(ent->OrganizationValue(i4));
128 }
129 SW.CloseSub();
130
131 // --- own field : preprocessorVersion ---
132
133 SW.Send(ent->PreprocessorVersion());
134
135 // --- own field : originatingSystem ---
136
137 SW.Send(ent->OriginatingSystem());
138
139 // --- own field : authorisation ---
140
141 SW.Send(ent->Authorisation());
142}