1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
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
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.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
15 #include <Interface_Check.hxx>
16 #include <Interface_EntityIterator.hxx>
17 #include <RWStepBasic_RWLocalTime.hxx>
18 #include <StepBasic_CoordinatedUniversalTimeOffset.hxx>
19 #include <StepBasic_LocalTime.hxx>
20 #include <StepData_StepReaderData.hxx>
21 #include <StepData_StepWriter.hxx>
23 RWStepBasic_RWLocalTime::RWStepBasic_RWLocalTime () {}
25 void RWStepBasic_RWLocalTime::ReadStep
26 (const Handle(StepData_StepReaderData)& data,
27 const Standard_Integer num,
28 Handle(Interface_Check)& ach,
29 const Handle(StepBasic_LocalTime)& ent) const
33 // --- Number of Parameter Control ---
35 if (!data->CheckNbParams(num,4,ach,"local_time")) return;
37 // --- own field : hourComponent ---
39 Standard_Integer aHourComponent;
40 //szv#4:S4163:12Mar99 `Standard_Boolean stat1 =` not needed
41 data->ReadInteger (num,1,"hour_component",ach,aHourComponent);
43 // --- own field : minuteComponent ---
45 Standard_Integer aMinuteComponent;
46 Standard_Boolean hasAminuteComponent = Standard_True;
47 if (data->IsParamDefined(num,2)) {
48 //szv#4:S4163:12Mar99 `Standard_Boolean stat2 =` not needed
49 data->ReadInteger (num,2,"minute_component",ach,aMinuteComponent);
52 hasAminuteComponent = Standard_False;
56 // --- own field : secondComponent ---
58 Standard_Real aSecondComponent;
59 Standard_Boolean hasAsecondComponent = Standard_True;
60 if (data->IsParamDefined(num,3)) {
61 //szv#4:S4163:12Mar99 `Standard_Boolean stat3 =` not needed
62 data->ReadReal (num,3,"second_component",ach,aSecondComponent);
65 hasAsecondComponent = Standard_False;
66 aSecondComponent = 0.;
69 // --- own field : zone ---
71 Handle(StepBasic_CoordinatedUniversalTimeOffset) aZone;
72 //szv#4:S4163:12Mar99 `Standard_Boolean stat4 =` not needed
73 data->ReadEntity(num, 4,"zone", ach, STANDARD_TYPE(StepBasic_CoordinatedUniversalTimeOffset), aZone);
75 //--- Initialisation of the read entity ---
78 ent->Init(aHourComponent, hasAminuteComponent, aMinuteComponent, hasAsecondComponent, aSecondComponent, aZone);
82 void RWStepBasic_RWLocalTime::WriteStep
83 (StepData_StepWriter& SW,
84 const Handle(StepBasic_LocalTime)& ent) const
87 // --- own field : hourComponent ---
89 SW.Send(ent->HourComponent());
91 // --- own field : minuteComponent ---
93 Standard_Boolean hasAminuteComponent = ent->HasMinuteComponent();
94 if (hasAminuteComponent) {
95 SW.Send(ent->MinuteComponent());
101 // --- own field : secondComponent ---
103 Standard_Boolean hasAsecondComponent = ent->HasSecondComponent();
104 if (hasAsecondComponent) {
105 SW.Send(ent->SecondComponent());
111 // --- own field : zone ---
113 SW.Send(ent->Zone());
117 void RWStepBasic_RWLocalTime::Share(const Handle(StepBasic_LocalTime)& ent, Interface_EntityIterator& iter) const
120 iter.GetOneItem(ent->Zone());