1 #include <RWStepBasic_RWSiUnitAndPlaneAngleUnit.ixx>
2 #include <StepBasic_SiUnit.hxx>
3 #include <StepBasic_PlaneAngleUnit.hxx>
4 #include <StepBasic_DimensionalExponents.hxx>
5 #include <StepBasic_SiPrefix.hxx>
6 #include <StepBasic_SiUnitName.hxx>
7 #include <RWStepBasic_RWSiUnit.hxx>
10 RWStepBasic_RWSiUnitAndPlaneAngleUnit::RWStepBasic_RWSiUnitAndPlaneAngleUnit ()
14 void RWStepBasic_RWSiUnitAndPlaneAngleUnit::ReadStep(const Handle(StepData_StepReaderData)& data,
15 const Standard_Integer num0,
16 Handle(Interface_Check)& ach,
17 const Handle(StepBasic_SiUnitAndPlaneAngleUnit)& ent) const
19 Standard_Integer num = num0;
21 // --- Instance of common supertype NamedUnit ---
22 if (!data->CheckNbParams(num,1,ach,"named_unit")) return;
24 // --- field : dimensions ---
25 // --- this field is redefined ---
26 //szv#4:S4163:12Mar99 `Standard_Boolean stat1 =` not needed
27 data->CheckDerived(num,1,"dimensions",ach,Standard_False);
28 num = data->NextForComplex(num);
30 // --- Instance of plex componant PlaneAngleUnit ---
31 if (!data->CheckNbParams(num,0,ach,"plane_angle_unit")) return;
32 num = data->NextForComplex(num);
34 // --- Instance of plex componant SiUnit ---
35 if (!data->CheckNbParams(num,2,ach,"si_unit")) return;
37 // --- field : prefix ---
38 RWStepBasic_RWSiUnit reader;
39 StepBasic_SiPrefix aPrefix;
40 Standard_Boolean hasAprefix = Standard_False;
41 if (data->IsParamDefined(num,1)) {
42 if (data->ParamType(num,1) == Interface_ParamEnum) {
43 Standard_CString text = data->ParamCValue(num,1);
44 hasAprefix = reader.DecodePrefix(aPrefix,text);
46 ach->AddFail("Enumeration si_prefix has not an allowed value");
48 else ach->AddFail("Parameter #2 (prefix) is not an enumeration");
51 // --- field : name ---
52 StepBasic_SiUnitName aName;
53 if (data->ParamType(num,2) == Interface_ParamEnum) {
54 Standard_CString text = data->ParamCValue(num,2);
55 if(!reader.DecodeName(aName,text))
56 ach->AddFail("Enumeration si_unit_name has not an allowed value");
58 else ach->AddFail("Parameter #2 (name) is not an enumeration");
60 //--- Initialisation of the red entity ---
61 ent->Init(hasAprefix,aPrefix,aName);
65 void RWStepBasic_RWSiUnitAndPlaneAngleUnit::WriteStep(StepData_StepWriter& SW,
66 const Handle(StepBasic_SiUnitAndPlaneAngleUnit)& ent) const
68 // --- Instance of common supertype NamedUnit ---
69 SW.StartEntity("NAMED_UNIT");
71 // --- field : dimensions ---
72 // --- redefined field ---
75 // --- Instance of plex componant PlaneAngleUnit ---
76 SW.StartEntity("PLANE_ANGLE_UNIT");
78 // --- Instance of plex componant SiUnit ---
79 SW.StartEntity("SI_UNIT");
81 // --- field : prefix ---
82 RWStepBasic_RWSiUnit writer;
83 Standard_Boolean hasAprefix = ent->HasPrefix();
85 SW.SendEnum(writer.EncodePrefix(ent->Prefix()));
89 // --- field : name ---
90 SW.SendEnum(writer.EncodeName(ent->Name()));