0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying...
[occt.git] / src / RWStepBasic / RWStepBasic_RWProductCategory.cxx
1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
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.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14
15 #include <Interface_Check.hxx>
16 #include <RWStepBasic_RWProductCategory.hxx>
17 #include <StepBasic_ProductCategory.hxx>
18 #include <StepData_StepReaderData.hxx>
19 #include <StepData_StepWriter.hxx>
20
21 RWStepBasic_RWProductCategory::RWStepBasic_RWProductCategory () {}
22
23 void RWStepBasic_RWProductCategory::ReadStep
24         (const Handle(StepData_StepReaderData)& data,
25          const Standard_Integer num,
26          Handle(Interface_Check)& ach,
27          const Handle(StepBasic_ProductCategory)& ent) const
28 {
29
30
31         // --- Number of Parameter Control ---
32
33         if (!data->CheckNbParams(num,2,ach,"product_category")) return;
34
35         // --- own field : name ---
36
37         Handle(TCollection_HAsciiString) aName;
38         //szv#4:S4163:12Mar99 `Standard_Boolean stat1 =` not needed
39         data->ReadString (num,1,"name",ach,aName);
40
41         // --- own field : description ---
42
43         Handle(TCollection_HAsciiString) aDescription;
44         Standard_Boolean hasAdescription = Standard_True;
45         if (data->IsParamDefined(num,2)) {
46           //szv#4:S4163:12Mar99 `Standard_Boolean stat2 =` not needed
47           data->ReadString (num,2,"description",ach,aDescription);
48         }
49         else {
50           hasAdescription = Standard_False;
51           aDescription.Nullify();
52         }
53
54         //--- Initialisation of the read entity ---
55
56
57         ent->Init(aName, hasAdescription, aDescription);
58 }
59
60
61 void RWStepBasic_RWProductCategory::WriteStep
62         (StepData_StepWriter& SW,
63          const Handle(StepBasic_ProductCategory)& ent) const
64 {
65
66         // --- own field : name ---
67
68         SW.Send(ent->Name());
69
70         // --- own field : description ---
71
72         Standard_Boolean hasAdescription = ent->HasDescription();
73         if (hasAdescription) {
74           SW.Send(ent->Description());
75         }
76         else {
77           SW.SendUndef();
78         }
79 }