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 <HeaderSection.hxx>
16 #include <HeaderSection_FileDescription.hxx>
17 #include <HeaderSection_FileName.hxx>
18 #include <HeaderSection_FileSchema.hxx>
19 #include <HeaderSection_Protocol.hxx>
20 #include <Interface_Check.hxx>
21 #include <Interface_CopyTool.hxx>
22 #include <Interface_EntityIterator.hxx>
23 #include <Interface_GeneralLib.hxx>
24 #include <Interface_HArray1OfHAsciiString.hxx>
25 #include <Interface_Macros.hxx>
26 #include <Interface_ShareTool.hxx>
27 #include <RWHeaderSection.hxx>
28 #include <RWHeaderSection_GeneralModule.hxx>
29 #include <Standard_Transient.hxx>
30 #include <Standard_Type.hxx>
31 #include <StepData_UndefinedEntity.hxx>
32 #include <TCollection_HAsciiString.hxx>
34 RWHeaderSection_GeneralModule::RWHeaderSection_GeneralModule ()
36 Interface_GeneralLib::SetGlobal(this, HeaderSection::Protocol());
39 void RWHeaderSection_GeneralModule::FillSharedCase(const Standard_Integer CN, const Handle(Standard_Transient)& ent, Interface_EntityIterator& iter) const
43 DeclareAndCast(StepData_UndefinedEntity,undf,ent);
44 undf->FillShared (iter);
49 void RWHeaderSection_GeneralModule::CheckCase(const Standard_Integer,
50 const Handle(Standard_Transient)&,
51 const Interface_ShareTool&,
52 Handle(Interface_Check)&) const
57 void RWHeaderSection_GeneralModule::CopyCase(const Standard_Integer CN, const Handle(Standard_Transient)& entfrom, const Handle(Standard_Transient)& entto, Interface_CopyTool& TC) const
64 DeclareAndCast(HeaderSection_FileName,enfr,entfrom);
65 DeclareAndCast(HeaderSection_FileName,ento,entto);
66 Handle(TCollection_HAsciiString) name =
67 new TCollection_HAsciiString (enfr->Name());
68 Handle(TCollection_HAsciiString) time =
69 new TCollection_HAsciiString (enfr->TimeStamp());
70 Standard_Integer nba = enfr->NbAuthor();
71 Handle(Interface_HArray1OfHAsciiString) auth =
72 new Interface_HArray1OfHAsciiString (1,nba);
73 for (i = 1; i <= nba; i ++) auth->SetValue
74 (i, new TCollection_HAsciiString (enfr->AuthorValue(i)) );
75 Standard_Integer nbo = enfr->NbOrganization();
76 Handle(Interface_HArray1OfHAsciiString) orga =
77 new Interface_HArray1OfHAsciiString (1,nbo);
78 for (i = 1; i <= nbo; i ++) orga->SetValue
79 (i, new TCollection_HAsciiString (enfr->OrganizationValue(i)) );
80 Handle(TCollection_HAsciiString) prep =
81 new TCollection_HAsciiString (enfr->PreprocessorVersion());
82 Handle(TCollection_HAsciiString) orig =
83 new TCollection_HAsciiString (enfr->OriginatingSystem());
84 Handle(TCollection_HAsciiString) autr =
85 new TCollection_HAsciiString (enfr->Authorisation());
86 ento->Init (name,time,auth,orga,prep,orig,autr);
92 DeclareAndCast(HeaderSection_FileDescription,enfr,entfrom);
93 DeclareAndCast(HeaderSection_FileDescription,ento,entto);
94 Standard_Integer nbd = enfr->NbDescription();
95 Handle(Interface_HArray1OfHAsciiString) desc =
96 new Interface_HArray1OfHAsciiString (1,nbd);
97 for (i = 1; i <= nbd; i ++) desc->SetValue
98 (i, new TCollection_HAsciiString (enfr->DescriptionValue(i)) );
99 Handle(TCollection_HAsciiString) impl =
100 new TCollection_HAsciiString (enfr->ImplementationLevel());
101 ento->Init (desc,impl);
107 DeclareAndCast(HeaderSection_FileSchema,enfr,entfrom);
108 DeclareAndCast(HeaderSection_FileSchema,ento,entto);
109 Standard_Integer nbs = enfr->NbSchemaIdentifiers();
110 Handle(Interface_HArray1OfHAsciiString) sche =
111 new Interface_HArray1OfHAsciiString (1,nbs);
112 for (i = 1; i <= nbs; i ++) sche->SetValue
113 (i, new TCollection_HAsciiString (enfr->SchemaIdentifiersValue(i)) );
119 DeclareAndCast(StepData_UndefinedEntity,undfrom,entfrom);
120 DeclareAndCast(StepData_UndefinedEntity,undto,entto);
121 undto->GetFromAnother(undfrom,TC); // On pourrait rapatrier cela
128 // --- Construction of empty class ---
130 Standard_Boolean RWHeaderSection_GeneralModule::NewVoid
131 (const Standard_Integer CN, Handle(Standard_Transient)& ent) const
133 if (CN == 0) return Standard_False;
136 ent = new HeaderSection_FileName;
139 ent = new HeaderSection_FileDescription;
142 ent = new HeaderSection_FileSchema;
145 ent = new StepData_UndefinedEntity;
147 default : return Standard_False;
150 return Standard_True;