mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-29 14:00:49 +03:00
Integration of OCCT 6.5.0 from SVN
This commit is contained in:
31
src/RWHeaderSection/RWHeaderSection.cdl
Executable file
31
src/RWHeaderSection/RWHeaderSection.cdl
Executable file
@@ -0,0 +1,31 @@
|
||||
-- File: HeaderSection.cdl
|
||||
-- Created: Thu Jun 16 18:05:55 1994
|
||||
-- Author: EXPRESS->CDL V0.2 Translator
|
||||
-- Copyright: Matra-Datavision 1993
|
||||
|
||||
|
||||
|
||||
|
||||
package RWHeaderSection
|
||||
|
||||
uses
|
||||
|
||||
StepData, Interface, TCollection, TColStd, HeaderSection
|
||||
|
||||
is
|
||||
|
||||
|
||||
class ReadWriteModule;
|
||||
|
||||
class GeneralModule;
|
||||
|
||||
class RWFileName;
|
||||
class RWFileDescription;
|
||||
class RWFileSchema;
|
||||
|
||||
---Package Method ---
|
||||
|
||||
Init;
|
||||
---Purpose: enforced the initialisation of the libraries
|
||||
|
||||
end RWHeaderSection;
|
27
src/RWHeaderSection/RWHeaderSection.cxx
Executable file
27
src/RWHeaderSection/RWHeaderSection.cxx
Executable file
@@ -0,0 +1,27 @@
|
||||
|
||||
#include <RWHeaderSection.ixx>
|
||||
/// #include <EuclidStandard.hxx>
|
||||
|
||||
#include <StepData.hxx>
|
||||
|
||||
#include <HeaderSection_Protocol.hxx>
|
||||
|
||||
#include <HeaderSection.hxx>
|
||||
#include <RWHeaderSection_ReadWriteModule.hxx>
|
||||
#include <RWHeaderSection_GeneralModule.hxx>
|
||||
|
||||
|
||||
static Handle(RWHeaderSection_ReadWriteModule) rwm;
|
||||
static Handle(RWHeaderSection_GeneralModule) rwg;
|
||||
|
||||
|
||||
void RWHeaderSection::Init()
|
||||
{
|
||||
/// EuclidStandard::Init();
|
||||
Handle(HeaderSection_Protocol) proto = HeaderSection::Protocol();
|
||||
StepData::AddHeaderProtocol(proto);
|
||||
if (rwm.IsNull()) rwm = new RWHeaderSection_ReadWriteModule;
|
||||
if (rwg.IsNull()) rwg = new RWHeaderSection_GeneralModule;
|
||||
}
|
||||
|
||||
|
42
src/RWHeaderSection/RWHeaderSection_GeneralModule.cdl
Executable file
42
src/RWHeaderSection/RWHeaderSection_GeneralModule.cdl
Executable file
@@ -0,0 +1,42 @@
|
||||
-- File: GeneralModule.cdl
|
||||
-- Created: Thu Jun 16 18:05:55 1994
|
||||
-- Author: EXPRESS->CDL V0.2 Translator
|
||||
-- Copyright: Matra-Datavision 1993
|
||||
|
||||
|
||||
|
||||
|
||||
class GeneralModule from RWHeaderSection inherits GeneralModule from StepData
|
||||
---Purpose : Defines General Services for HeaderSection Entities
|
||||
-- (Share,Check,Copy; Trace already inherited)
|
||||
-- Depends (for case numbers) of Protocol from HeaderSection
|
||||
|
||||
uses Transient,
|
||||
EntityIterator from Interface,
|
||||
ShareTool from Interface,
|
||||
Check from Interface,
|
||||
CopyTool from Interface
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable GeneralModule from RWHeaderSection;
|
||||
---Purpose : Creates a GeneralModule
|
||||
|
||||
FillSharedCase (me; CN : Integer; ent : Transient;
|
||||
iter : in out EntityIterator);
|
||||
---Purpose : Specific filling of the list of Entities shared by an Entity
|
||||
-- <ent>, according to a Case Number <CN> (provided by HeaderSection
|
||||
-- Protocol).
|
||||
|
||||
CheckCase (me; CN : Integer; ent : Transient; shares : ShareTool; ach : in out Check);
|
||||
---Purpose : Specific Checking of an Entity <ent>
|
||||
|
||||
CopyCase (me; CN : Integer; entfrom : Transient; entto : mutable Transient; TC : in out CopyTool);
|
||||
---Purpose : Specific Copy ("Deep") from <entfrom> to <entto> (same type)
|
||||
-- by using a CopyTool which provides its working Map.
|
||||
-- Use method Transferred from CopyTool to work
|
||||
|
||||
|
||||
NewVoid (me; CN : Integer; ent : out mutable Transient) returns Boolean;
|
||||
|
||||
end GeneralModule;
|
141
src/RWHeaderSection/RWHeaderSection_GeneralModule.cxx
Executable file
141
src/RWHeaderSection/RWHeaderSection_GeneralModule.cxx
Executable file
@@ -0,0 +1,141 @@
|
||||
#include <RWHeaderSection_GeneralModule.ixx>
|
||||
|
||||
#include <Interface_Macros.hxx>
|
||||
|
||||
#include <Interface_GeneralLib.hxx>
|
||||
|
||||
#include <Interface_EntityIterator.hxx>
|
||||
|
||||
#include <HeaderSection.hxx>
|
||||
|
||||
#include <RWHeaderSection.hxx>
|
||||
|
||||
#include <Interface_HArray1OfHAsciiString.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
|
||||
|
||||
#include <HeaderSection_FileName.hxx>
|
||||
#include <HeaderSection_FileDescription.hxx>
|
||||
#include <HeaderSection_FileSchema.hxx>
|
||||
|
||||
#include <StepData_UndefinedEntity.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
|
||||
|
||||
RWHeaderSection_GeneralModule::RWHeaderSection_GeneralModule ()
|
||||
{ Interface_GeneralLib::SetGlobal(this, HeaderSection::Protocol()); }
|
||||
|
||||
void RWHeaderSection_GeneralModule::FillSharedCase(const Standard_Integer CN, const Handle(Standard_Transient)& ent, Interface_EntityIterator& iter) const
|
||||
{
|
||||
if (CN != 4) return;
|
||||
|
||||
DeclareAndCast(StepData_UndefinedEntity,undf,ent);
|
||||
undf->FillShared (iter);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void RWHeaderSection_GeneralModule::CheckCase(const Standard_Integer CN,
|
||||
const Handle(Standard_Transient)& ent,
|
||||
const Interface_ShareTool& shares,
|
||||
Handle(Interface_Check)& ach) const
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void RWHeaderSection_GeneralModule::CopyCase(const Standard_Integer CN, const Handle(Standard_Transient)& entfrom, const Handle(Standard_Transient)& entto, Interface_CopyTool& TC) const
|
||||
{
|
||||
// ajout manuel
|
||||
switch (CN) {
|
||||
|
||||
case 1 : {
|
||||
Standard_Integer i;
|
||||
DeclareAndCast(HeaderSection_FileName,enfr,entfrom);
|
||||
DeclareAndCast(HeaderSection_FileName,ento,entto);
|
||||
Handle(TCollection_HAsciiString) name =
|
||||
new TCollection_HAsciiString (enfr->Name());
|
||||
Handle(TCollection_HAsciiString) time =
|
||||
new TCollection_HAsciiString (enfr->TimeStamp());
|
||||
Standard_Integer nba = enfr->NbAuthor();
|
||||
Handle(Interface_HArray1OfHAsciiString) auth =
|
||||
new Interface_HArray1OfHAsciiString (1,nba);
|
||||
for (i = 1; i <= nba; i ++) auth->SetValue
|
||||
(i, new TCollection_HAsciiString (enfr->AuthorValue(i)) );
|
||||
Standard_Integer nbo = enfr->NbOrganization();
|
||||
Handle(Interface_HArray1OfHAsciiString) orga =
|
||||
new Interface_HArray1OfHAsciiString (1,nbo);
|
||||
for (i = 1; i <= nbo; i ++) orga->SetValue
|
||||
(i, new TCollection_HAsciiString (enfr->OrganizationValue(i)) );
|
||||
Handle(TCollection_HAsciiString) prep =
|
||||
new TCollection_HAsciiString (enfr->PreprocessorVersion());
|
||||
Handle(TCollection_HAsciiString) orig =
|
||||
new TCollection_HAsciiString (enfr->OriginatingSystem());
|
||||
Handle(TCollection_HAsciiString) autr =
|
||||
new TCollection_HAsciiString (enfr->Authorisation());
|
||||
ento->Init (name,time,auth,orga,prep,orig,autr);
|
||||
}
|
||||
break;
|
||||
|
||||
case 2 : {
|
||||
Standard_Integer i;
|
||||
DeclareAndCast(HeaderSection_FileDescription,enfr,entfrom);
|
||||
DeclareAndCast(HeaderSection_FileDescription,ento,entto);
|
||||
Standard_Integer nbd = enfr->NbDescription();
|
||||
Handle(Interface_HArray1OfHAsciiString) desc =
|
||||
new Interface_HArray1OfHAsciiString (1,nbd);
|
||||
for (i = 1; i <= nbd; i ++) desc->SetValue
|
||||
(i, new TCollection_HAsciiString (enfr->DescriptionValue(i)) );
|
||||
Handle(TCollection_HAsciiString) impl =
|
||||
new TCollection_HAsciiString (enfr->ImplementationLevel());
|
||||
ento->Init (desc,impl);
|
||||
}
|
||||
break;
|
||||
|
||||
case 3 : {
|
||||
Standard_Integer i;
|
||||
DeclareAndCast(HeaderSection_FileSchema,enfr,entfrom);
|
||||
DeclareAndCast(HeaderSection_FileSchema,ento,entto);
|
||||
Standard_Integer nbs = enfr->NbSchemaIdentifiers();
|
||||
Handle(Interface_HArray1OfHAsciiString) sche =
|
||||
new Interface_HArray1OfHAsciiString (1,nbs);
|
||||
for (i = 1; i <= nbs; i ++) sche->SetValue
|
||||
(i, new TCollection_HAsciiString (enfr->SchemaIdentifiersValue(i)) );
|
||||
ento->Init (sche);
|
||||
}
|
||||
break;
|
||||
|
||||
case 4 : {
|
||||
DeclareAndCast(StepData_UndefinedEntity,undfrom,entfrom);
|
||||
DeclareAndCast(StepData_UndefinedEntity,undto,entto);
|
||||
undto->GetFromAnother(undfrom,TC); // On pourrait rapatrier cela
|
||||
}
|
||||
break;
|
||||
|
||||
default : break;
|
||||
}
|
||||
}
|
||||
// --- Construction of empty class ---
|
||||
|
||||
Standard_Boolean RWHeaderSection_GeneralModule::NewVoid
|
||||
(const Standard_Integer CN, Handle(Standard_Transient)& ent) const
|
||||
{
|
||||
if (CN == 0) return Standard_False;
|
||||
switch (CN) {
|
||||
case 1 :
|
||||
ent = new HeaderSection_FileName;
|
||||
break;
|
||||
case 2 :
|
||||
ent = new HeaderSection_FileDescription;
|
||||
break;
|
||||
case 3 :
|
||||
ent = new HeaderSection_FileSchema;
|
||||
break;
|
||||
case 4 :
|
||||
ent = new StepData_UndefinedEntity;
|
||||
break;
|
||||
default : return Standard_False;
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
27
src/RWHeaderSection/RWHeaderSection_RWFileDescription.cdl
Executable file
27
src/RWHeaderSection/RWHeaderSection_RWFileDescription.cdl
Executable file
@@ -0,0 +1,27 @@
|
||||
-- File: FileDescription.cdl
|
||||
-- Created: Thu Jun 16 18:05:55 1994
|
||||
-- Author: EXPRESS->CDL V0.2 Translator
|
||||
-- Copyright: Matra-Datavision 1993
|
||||
|
||||
|
||||
|
||||
|
||||
class RWFileDescription from RWHeaderSection
|
||||
|
||||
---Purpose : Read & Write Module for FileDescription
|
||||
|
||||
uses Check from Interface,
|
||||
StepReaderData from StepData,
|
||||
StepWriter from StepData,
|
||||
FileDescription from HeaderSection
|
||||
|
||||
is
|
||||
|
||||
Create returns RWFileDescription;
|
||||
|
||||
ReadStep (me; data : StepReaderData; num : Integer;
|
||||
ach : in out Check; ent : mutable FileDescription from HeaderSection);
|
||||
|
||||
WriteStep (me; SW : in out StepWriter; ent : FileDescription from HeaderSection);
|
||||
|
||||
end RWFileDescription;
|
68
src/RWHeaderSection/RWHeaderSection_RWFileDescription.cxx
Executable file
68
src/RWHeaderSection/RWHeaderSection_RWFileDescription.cxx
Executable file
@@ -0,0 +1,68 @@
|
||||
|
||||
#include <RWHeaderSection_RWFileDescription.ixx>
|
||||
#include <Interface_HArray1OfHAsciiString.hxx>
|
||||
|
||||
|
||||
RWHeaderSection_RWFileDescription::RWHeaderSection_RWFileDescription () {}
|
||||
|
||||
void RWHeaderSection_RWFileDescription::ReadStep
|
||||
(const Handle(StepData_StepReaderData)& data,
|
||||
const Standard_Integer num,
|
||||
Handle(Interface_Check)& ach,
|
||||
const Handle(HeaderSection_FileDescription)& ent) const
|
||||
{
|
||||
|
||||
|
||||
// --- Number of Parameter Control ---
|
||||
|
||||
if (!data->CheckNbParams(num,2,ach,"file_description has not 2 parameter(s)")) return;
|
||||
|
||||
// --- own field : description ---
|
||||
|
||||
Handle(Interface_HArray1OfHAsciiString) aDescription;
|
||||
Handle(TCollection_HAsciiString) aDescriptionItem;
|
||||
Standard_Integer nsub1;
|
||||
nsub1 = data->SubListNumber(num, 1, Standard_False);
|
||||
if (nsub1 !=0) {
|
||||
Standard_Integer nb1 = data->NbParams(nsub1);
|
||||
aDescription = new Interface_HArray1OfHAsciiString (1, nb1);
|
||||
for (Standard_Integer i1 = 1; i1 <= nb1; i1 ++) {
|
||||
Standard_Boolean stat1 = data->ReadString
|
||||
(nsub1,i1,"description",ach,aDescriptionItem);
|
||||
if (stat1) aDescription->SetValue(i1,aDescriptionItem);
|
||||
}
|
||||
}
|
||||
else {
|
||||
ach->AddFail("Parameter #1 (description) is not a LIST");
|
||||
}
|
||||
|
||||
// --- own field : implementationLevel ---
|
||||
|
||||
Handle(TCollection_HAsciiString) aImplementationLevel;
|
||||
Standard_Boolean stat2;
|
||||
stat2 = data->ReadString (num,2,"implementation_level",ach,aImplementationLevel);
|
||||
|
||||
//--- Initialisation of the read entity ---
|
||||
|
||||
|
||||
if (!ach->HasFailed()) ent->Init(aDescription, aImplementationLevel);
|
||||
}
|
||||
|
||||
|
||||
void RWHeaderSection_RWFileDescription::WriteStep
|
||||
(StepData_StepWriter& SW,
|
||||
const Handle(HeaderSection_FileDescription)& ent) const
|
||||
{
|
||||
|
||||
// --- own field : description ---
|
||||
|
||||
SW.OpenSub();
|
||||
for (Standard_Integer i1 = 1; i1 <= ent->NbDescription(); i1 ++) {
|
||||
SW.Send(ent->DescriptionValue(i1));
|
||||
}
|
||||
SW.CloseSub();
|
||||
|
||||
// --- own field : implementationLevel ---
|
||||
|
||||
SW.Send(ent->ImplementationLevel());
|
||||
}
|
27
src/RWHeaderSection/RWHeaderSection_RWFileName.cdl
Executable file
27
src/RWHeaderSection/RWHeaderSection_RWFileName.cdl
Executable file
@@ -0,0 +1,27 @@
|
||||
-- File: FileName.cdl
|
||||
-- Created: Thu Jun 16 18:05:55 1994
|
||||
-- Author: EXPRESS->CDL V0.2 Translator
|
||||
-- Copyright: Matra-Datavision 1993
|
||||
|
||||
|
||||
|
||||
|
||||
class RWFileName from RWHeaderSection
|
||||
|
||||
---Purpose : Read & Write Module for FileName
|
||||
|
||||
uses Check from Interface,
|
||||
StepReaderData from StepData,
|
||||
StepWriter from StepData,
|
||||
FileName from HeaderSection
|
||||
|
||||
is
|
||||
|
||||
Create returns RWFileName;
|
||||
|
||||
ReadStep (me; data : StepReaderData; num : Integer;
|
||||
ach : in out Check; ent : mutable FileName from HeaderSection);
|
||||
|
||||
WriteStep (me; SW : in out StepWriter; ent : FileName from HeaderSection);
|
||||
|
||||
end RWFileName;
|
135
src/RWHeaderSection/RWHeaderSection_RWFileName.cxx
Executable file
135
src/RWHeaderSection/RWHeaderSection_RWFileName.cxx
Executable file
@@ -0,0 +1,135 @@
|
||||
|
||||
#include <RWHeaderSection_RWFileName.ixx>
|
||||
#include <Interface_HArray1OfHAsciiString.hxx>
|
||||
|
||||
|
||||
RWHeaderSection_RWFileName::RWHeaderSection_RWFileName () {}
|
||||
|
||||
void RWHeaderSection_RWFileName::ReadStep
|
||||
(const Handle(StepData_StepReaderData)& data,
|
||||
const Standard_Integer num,
|
||||
Handle(Interface_Check)& ach,
|
||||
const Handle(HeaderSection_FileName)& ent) const
|
||||
{
|
||||
|
||||
|
||||
// --- Number of Parameter Control ---
|
||||
|
||||
if (!data->CheckNbParams(num,7,ach,"file_name has not 7 parameter(s)")) return;
|
||||
|
||||
// --- own field : name ---
|
||||
|
||||
Handle(TCollection_HAsciiString) aName;
|
||||
Standard_Boolean stat1;
|
||||
stat1 = data->ReadString (num,1,"name",ach,aName);
|
||||
|
||||
// --- own field : timeStamp ---
|
||||
|
||||
Handle(TCollection_HAsciiString) aTimeStamp;
|
||||
Standard_Boolean stat2;
|
||||
stat2 = data->ReadString (num,2,"time_stamp",ach,aTimeStamp);
|
||||
|
||||
// --- own field : author ---
|
||||
|
||||
Handle(Interface_HArray1OfHAsciiString) aAuthor;
|
||||
Handle(TCollection_HAsciiString) aAuthorItem;
|
||||
Standard_Integer nsub3;
|
||||
nsub3 = data->SubListNumber(num, 3, Standard_False);
|
||||
if (nsub3 !=0) {
|
||||
Standard_Integer nb3 = data->NbParams(nsub3);
|
||||
aAuthor = new Interface_HArray1OfHAsciiString (1, nb3);
|
||||
for (Standard_Integer i3 = 1; i3 <= nb3; i3 ++) {
|
||||
Standard_Boolean stat3 = data->ReadString
|
||||
(nsub3,i3,"author",ach,aAuthorItem);
|
||||
if (stat3) aAuthor->SetValue(i3,aAuthorItem);
|
||||
}
|
||||
}
|
||||
else {
|
||||
ach->AddFail("Parameter #3 (author) is not a LIST");
|
||||
}
|
||||
|
||||
// --- own field : organization ---
|
||||
|
||||
Handle(Interface_HArray1OfHAsciiString) aOrganization;
|
||||
Handle(TCollection_HAsciiString) aOrganizationItem;
|
||||
Standard_Integer nsub4;
|
||||
nsub4 = data->SubListNumber(num, 4, Standard_False);
|
||||
if (nsub4 !=0) {
|
||||
Standard_Integer nb4 = data->NbParams(nsub4);
|
||||
aOrganization = new Interface_HArray1OfHAsciiString (1, nb4);
|
||||
for (Standard_Integer i4 = 1; i4 <= nb4; i4 ++) {
|
||||
Standard_Boolean stat4 = data->ReadString
|
||||
(nsub4,i4,"organization",ach,aOrganizationItem);
|
||||
if (stat4) aOrganization->SetValue(i4,aOrganizationItem);
|
||||
}
|
||||
}
|
||||
else {
|
||||
ach->AddFail("Parameter #4 (organization) is not a LIST");
|
||||
}
|
||||
|
||||
// --- own field : preprocessorVersion ---
|
||||
|
||||
Handle(TCollection_HAsciiString) aPreprocessorVersion;
|
||||
Standard_Boolean stat5;
|
||||
stat5 = data->ReadString (num,5,"preprocessor_version",ach,aPreprocessorVersion);
|
||||
|
||||
// --- own field : originatingSystem ---
|
||||
|
||||
Handle(TCollection_HAsciiString) aOriginatingSystem;
|
||||
Standard_Boolean stat6;
|
||||
stat6 = data->ReadString (num,6,"originating_system",ach,aOriginatingSystem);
|
||||
|
||||
// --- own field : authorisation ---
|
||||
|
||||
Handle(TCollection_HAsciiString) aAuthorisation;
|
||||
Standard_Boolean stat7;
|
||||
stat7 = data->ReadString (num,7,"authorisation",ach,aAuthorisation);
|
||||
|
||||
//--- Initialisation of the read entity ---
|
||||
|
||||
|
||||
if (!ach->HasFailed()) ent->Init(aName, aTimeStamp, aAuthor, aOrganization, aPreprocessorVersion, aOriginatingSystem, aAuthorisation);
|
||||
}
|
||||
|
||||
|
||||
void RWHeaderSection_RWFileName::WriteStep
|
||||
(StepData_StepWriter& SW,
|
||||
const Handle(HeaderSection_FileName)& ent) const
|
||||
{
|
||||
|
||||
// --- own field : name ---
|
||||
|
||||
SW.Send(ent->Name());
|
||||
|
||||
// --- own field : timeStamp ---
|
||||
|
||||
SW.Send(ent->TimeStamp());
|
||||
|
||||
// --- own field : author ---
|
||||
|
||||
SW.OpenSub();
|
||||
for (Standard_Integer i3 = 1; i3 <= ent->NbAuthor(); i3 ++) {
|
||||
SW.Send(ent->AuthorValue(i3));
|
||||
}
|
||||
SW.CloseSub();
|
||||
|
||||
// --- own field : organization ---
|
||||
|
||||
SW.OpenSub();
|
||||
for (Standard_Integer i4 = 1; i4 <= ent->NbOrganization(); i4 ++) {
|
||||
SW.Send(ent->OrganizationValue(i4));
|
||||
}
|
||||
SW.CloseSub();
|
||||
|
||||
// --- own field : preprocessorVersion ---
|
||||
|
||||
SW.Send(ent->PreprocessorVersion());
|
||||
|
||||
// --- own field : originatingSystem ---
|
||||
|
||||
SW.Send(ent->OriginatingSystem());
|
||||
|
||||
// --- own field : authorisation ---
|
||||
|
||||
SW.Send(ent->Authorisation());
|
||||
}
|
27
src/RWHeaderSection/RWHeaderSection_RWFileSchema.cdl
Executable file
27
src/RWHeaderSection/RWHeaderSection_RWFileSchema.cdl
Executable file
@@ -0,0 +1,27 @@
|
||||
-- File: FileSchema.cdl
|
||||
-- Created: Thu Jun 16 18:05:55 1994
|
||||
-- Author: EXPRESS->CDL V0.2 Translator
|
||||
-- Copyright: Matra-Datavision 1993
|
||||
|
||||
|
||||
|
||||
|
||||
class RWFileSchema from RWHeaderSection
|
||||
|
||||
---Purpose : Read & Write Module for FileSchema
|
||||
|
||||
uses Check from Interface,
|
||||
StepReaderData from StepData,
|
||||
StepWriter from StepData,
|
||||
FileSchema from HeaderSection
|
||||
|
||||
is
|
||||
|
||||
Create returns RWFileSchema;
|
||||
|
||||
ReadStep (me; data : StepReaderData; num : Integer;
|
||||
ach : in out Check; ent : mutable FileSchema from HeaderSection);
|
||||
|
||||
WriteStep (me; SW : in out StepWriter; ent : FileSchema from HeaderSection);
|
||||
|
||||
end RWFileSchema;
|
58
src/RWHeaderSection/RWHeaderSection_RWFileSchema.cxx
Executable file
58
src/RWHeaderSection/RWHeaderSection_RWFileSchema.cxx
Executable file
@@ -0,0 +1,58 @@
|
||||
|
||||
#include <RWHeaderSection_RWFileSchema.ixx>
|
||||
#include <Interface_HArray1OfHAsciiString.hxx>
|
||||
|
||||
|
||||
RWHeaderSection_RWFileSchema::RWHeaderSection_RWFileSchema () {}
|
||||
|
||||
void RWHeaderSection_RWFileSchema::ReadStep
|
||||
(const Handle(StepData_StepReaderData)& data,
|
||||
const Standard_Integer num,
|
||||
Handle(Interface_Check)& ach,
|
||||
const Handle(HeaderSection_FileSchema)& ent) const
|
||||
{
|
||||
|
||||
|
||||
// --- Number of Parameter Control ---
|
||||
|
||||
if (!data->CheckNbParams(num,1,ach,"file_schema has not 1 parameter(s)")) return;
|
||||
|
||||
// --- own field : schemaIdentifiers ---
|
||||
|
||||
Handle(Interface_HArray1OfHAsciiString) aSchemaIdentifiers;
|
||||
Handle(TCollection_HAsciiString) aSchemaIdentifiersItem;
|
||||
Standard_Integer nsub1;
|
||||
nsub1 = data->SubListNumber(num, 1, Standard_False);
|
||||
if (nsub1 !=0) {
|
||||
Standard_Integer nb1 = data->NbParams(nsub1);
|
||||
aSchemaIdentifiers = new Interface_HArray1OfHAsciiString (1, nb1);
|
||||
for (Standard_Integer i1 = 1; i1 <= nb1; i1 ++) {
|
||||
Standard_Boolean stat1 = data->ReadString
|
||||
(nsub1,i1,"schema_identifiers",ach,aSchemaIdentifiersItem);
|
||||
if (stat1) aSchemaIdentifiers->SetValue(i1,aSchemaIdentifiersItem);
|
||||
}
|
||||
}
|
||||
else {
|
||||
ach->AddFail("Parameter #1 (schema_identifiers) is not a LIST");
|
||||
}
|
||||
|
||||
//--- Initialisation of the read entity ---
|
||||
|
||||
|
||||
if (!ach->HasFailed()) ent->Init(aSchemaIdentifiers);
|
||||
}
|
||||
|
||||
|
||||
void RWHeaderSection_RWFileSchema::WriteStep
|
||||
(StepData_StepWriter& SW,
|
||||
const Handle(HeaderSection_FileSchema)& ent) const
|
||||
{
|
||||
|
||||
// --- own field : schemaIdentifiers ---
|
||||
|
||||
SW.OpenSub();
|
||||
for (Standard_Integer i1 = 1; i1 <= ent->NbSchemaIdentifiers(); i1 ++) {
|
||||
SW.Send(ent->SchemaIdentifiersValue(i1));
|
||||
}
|
||||
SW.CloseSub();
|
||||
}
|
45
src/RWHeaderSection/RWHeaderSection_ReadWriteModule.cdl
Executable file
45
src/RWHeaderSection/RWHeaderSection_ReadWriteModule.cdl
Executable file
@@ -0,0 +1,45 @@
|
||||
-- File: ReadWriteModule.cdl
|
||||
-- Created: Thu Jun 16 18:05:55 1994
|
||||
-- Author: EXPRESS->CDL V0.2 Translator
|
||||
-- Copyright: Matra-Datavision 1993
|
||||
|
||||
|
||||
|
||||
|
||||
class ReadWriteModule from RWHeaderSection inherits ReadWriteModule from StepData
|
||||
|
||||
---Purpose : General module to read and write HeaderSection entities
|
||||
|
||||
uses Transient,
|
||||
SequenceOfAsciiString from TColStd,
|
||||
AsciiString from TCollection,
|
||||
Check from Interface,
|
||||
StepReaderData from StepData,
|
||||
StepWriter from StepData
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable ReadWriteModule from RWHeaderSection;
|
||||
|
||||
CaseStep (me; atype : AsciiString from TCollection) returns Integer;
|
||||
---Purpose : associates a positive Case Number to each type of HeaderSection entity,
|
||||
-- given as a String defined in the EXPRESS form
|
||||
|
||||
CaseStep(me; types : SequenceOfAsciiString from TColStd) returns Integer is redefined;
|
||||
---Purpose : associates a positive Case Number to each type of HeaderSection Complex entity,
|
||||
-- given as a String defined in the EXPRESS form
|
||||
|
||||
IsComplex (me; CN : Integer) returns Boolean is redefined;
|
||||
---Purpose : returns True if the Case Number corresponds to a Complex Type
|
||||
|
||||
StepType (me; CN : Integer) returns AsciiString from TCollection;
|
||||
---Purpose : returns a StepType (defined in EXPRESS form which belongs to a
|
||||
-- Type of Entity, identified by its CaseNumber determined by Protocol
|
||||
---C++ : return const &
|
||||
|
||||
ReadStep (me; CN : Integer; data : StepReaderData; num : Integer;
|
||||
ach : in out Check; ent : mutable Transient);
|
||||
|
||||
WriteStep (me; CN : Integer; SW : in out StepWriter; ent : Transient);
|
||||
|
||||
end ReadWriteModule;
|
188
src/RWHeaderSection/RWHeaderSection_ReadWriteModule.cxx
Executable file
188
src/RWHeaderSection/RWHeaderSection_ReadWriteModule.cxx
Executable file
@@ -0,0 +1,188 @@
|
||||
#include <RWHeaderSection_ReadWriteModule.ixx>
|
||||
#include <Interface_ReaderLib.hxx>
|
||||
#include <StepData_WriterLib.hxx>
|
||||
#include <HeaderSection_Protocol.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
#include <Interface_ParamType.hxx>
|
||||
|
||||
|
||||
#include <HeaderSection_FileName.hxx>
|
||||
#include <HeaderSection_FileDescription.hxx>
|
||||
#include <HeaderSection_FileSchema.hxx>
|
||||
|
||||
#include <StepData_UndefinedEntity.hxx>
|
||||
|
||||
|
||||
#include <RWHeaderSection_RWFileName.hxx>
|
||||
#include <RWHeaderSection_RWFileDescription.hxx>
|
||||
#include <RWHeaderSection_RWFileSchema.hxx>
|
||||
|
||||
// -- General Declarations (Recognize, StepType) ---
|
||||
|
||||
static TCollection_AsciiString PasReco(""); // neutralise StartEntity de SW
|
||||
static TCollection_AsciiString Reco_FileName ("FILE_NAME");
|
||||
static TCollection_AsciiString Reco_FileDescription ("FILE_DESCRIPTION");
|
||||
static TCollection_AsciiString Reco_FileSchema ("FILE_SCHEMA");
|
||||
|
||||
// -- Definition of the libraries --
|
||||
|
||||
RWHeaderSection_ReadWriteModule::RWHeaderSection_ReadWriteModule ()
|
||||
{
|
||||
Handle(HeaderSection_Protocol) protocol = new HeaderSection_Protocol;
|
||||
StepData_WriterLib::SetGlobal(this,protocol);
|
||||
Interface_ReaderLib::SetGlobal(this,protocol);
|
||||
}
|
||||
|
||||
// --- Case Recognition ---
|
||||
|
||||
Standard_Integer RWHeaderSection_ReadWriteModule::CaseStep
|
||||
(const TCollection_AsciiString& key) const
|
||||
{
|
||||
if (key.IsEqual(Reco_FileName)) return 1;
|
||||
if (key.IsEqual(Reco_FileDescription)) return 2;
|
||||
if (key.IsEqual(Reco_FileSchema)) return 3;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// --- External Mapping Case Recognition ---
|
||||
|
||||
Standard_Integer RWHeaderSection_ReadWriteModule::CaseStep
|
||||
(const TColStd_SequenceOfAsciiString& types) const
|
||||
{
|
||||
|
||||
Standard_Integer NbComp = types.Length();
|
||||
#ifdef DEB
|
||||
if (NbComp < 2) {
|
||||
cout << "Plex Instance illegal " << endl;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// --- External Mapping Recognition ---
|
||||
|
||||
Standard_Boolean RWHeaderSection_ReadWriteModule::IsComplex
|
||||
(const Standard_Integer CN) const
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
|
||||
|
||||
const TCollection_AsciiString& RWHeaderSection_ReadWriteModule::StepType
|
||||
(const Standard_Integer CN) const
|
||||
{
|
||||
switch (CN) {
|
||||
case 1 : return Reco_FileName;
|
||||
case 2 : return Reco_FileDescription;
|
||||
case 3 : return Reco_FileSchema;
|
||||
default : return PasReco;
|
||||
}
|
||||
}
|
||||
|
||||
// -- Reading of a file --
|
||||
|
||||
void RWHeaderSection_ReadWriteModule::ReadStep
|
||||
(const Standard_Integer CN,
|
||||
const Handle(StepData_StepReaderData)& data,
|
||||
const Standard_Integer num,
|
||||
Handle(Interface_Check)& ach,
|
||||
const Handle(Standard_Transient)&ent) const
|
||||
{
|
||||
if (CN == 0) return;
|
||||
switch (CN) {
|
||||
case 1 :
|
||||
{
|
||||
DeclareAndCast(HeaderSection_FileName, anent, ent);
|
||||
RWHeaderSection_RWFileName tool;
|
||||
if (anent.IsNull()) ach->AddFail("Type Mismatch on FileName");
|
||||
else tool.ReadStep (data,num,ach,anent);
|
||||
}
|
||||
|
||||
break;
|
||||
case 2 :
|
||||
{
|
||||
DeclareAndCast(HeaderSection_FileDescription, anent, ent);
|
||||
RWHeaderSection_RWFileDescription tool;
|
||||
if (anent.IsNull()) ach->AddFail("Type Mismatch on FileDescription");
|
||||
else tool.ReadStep (data,num,ach,anent);
|
||||
}
|
||||
|
||||
break;
|
||||
case 3 :
|
||||
{
|
||||
DeclareAndCast(HeaderSection_FileSchema, anent, ent);
|
||||
RWHeaderSection_RWFileSchema tool;
|
||||
if (anent.IsNull()) ach->AddFail("Type Mismatch on FileSchema");
|
||||
else tool.ReadStep (data,num,ach,anent);
|
||||
}
|
||||
|
||||
break;
|
||||
case 4 :
|
||||
{
|
||||
DeclareAndCast(StepData_UndefinedEntity,und,ent);
|
||||
if (und.IsNull()) ach->AddFail
|
||||
("# Entity neither Recognized nor set as UndefinedEntity from StepData #");
|
||||
else und->ReadRecord(data,num,ach);
|
||||
}
|
||||
|
||||
break;
|
||||
default : ach->AddFail("Type Mismatch when reading - Entity");
|
||||
}
|
||||
|
||||
return;}
|
||||
|
||||
// -- Writing of a file --
|
||||
|
||||
void RWHeaderSection_ReadWriteModule::WriteStep
|
||||
(const Standard_Integer CN,
|
||||
StepData_StepWriter& SW,
|
||||
const Handle(Standard_Transient)&ent) const
|
||||
{
|
||||
if (CN == 0) return;
|
||||
switch (CN) {
|
||||
case 1 :
|
||||
{
|
||||
DeclareAndCast(HeaderSection_FileName, anent, ent);
|
||||
RWHeaderSection_RWFileName tool;
|
||||
if (anent.IsNull()) return;
|
||||
else tool.WriteStep (SW,anent);
|
||||
}
|
||||
|
||||
break;
|
||||
case 2 :
|
||||
{
|
||||
DeclareAndCast(HeaderSection_FileDescription, anent, ent);
|
||||
RWHeaderSection_RWFileDescription tool;
|
||||
if (anent.IsNull()) return;
|
||||
else tool.WriteStep (SW,anent);
|
||||
}
|
||||
|
||||
break;
|
||||
case 3 :
|
||||
{
|
||||
DeclareAndCast(HeaderSection_FileSchema, anent, ent);
|
||||
RWHeaderSection_RWFileSchema tool;
|
||||
if (anent.IsNull()) return;
|
||||
else tool.WriteStep (SW,anent);
|
||||
}
|
||||
|
||||
break;
|
||||
case 4 :
|
||||
{
|
||||
DeclareAndCast(StepData_UndefinedEntity,und,ent);
|
||||
if (und.IsNull()) break;
|
||||
// Parentheses gerees par StepWriter lui-meme
|
||||
// car en recevant le type PasReco, StepWriter ne l'affiche pas,
|
||||
// mais il gere les parentheses comme si de rien n etait
|
||||
if (und->IsComplex()) SW.StartComplex();
|
||||
und->WriteParams(SW);
|
||||
if (und->IsComplex()) SW.EndComplex();
|
||||
}
|
||||
|
||||
break;
|
||||
default : return;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user