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_GeneralModule.hxx>
28 #include <Standard_Transient.hxx>
29 #include <Standard_Type.hxx>
30 #include <StepData_UndefinedEntity.hxx>
31 #include <TCollection_HAsciiString.hxx>
33 IMPLEMENT_STANDARD_RTTIEXT(RWHeaderSection_GeneralModule,StepData_GeneralModule)
35 RWHeaderSection_GeneralModule::RWHeaderSection_GeneralModule ()
37 Interface_GeneralLib::SetGlobal(this, HeaderSection::Protocol());
40 void RWHeaderSection_GeneralModule::FillSharedCase(const Standard_Integer CN, const Handle(Standard_Transient)& ent, Interface_EntityIterator& iter) const
44 DeclareAndCast(StepData_UndefinedEntity,undf,ent);
45 undf->FillShared (iter);
50 void RWHeaderSection_GeneralModule::CheckCase(const Standard_Integer,
51 const Handle(Standard_Transient)&,
52 const Interface_ShareTool&,
53 Handle(Interface_Check)&) const
58 void RWHeaderSection_GeneralModule::CopyCase(const Standard_Integer CN, const Handle(Standard_Transient)& entfrom, const Handle(Standard_Transient)& entto, Interface_CopyTool& TC) const
65 DeclareAndCast(HeaderSection_FileName,enfr,entfrom);
66 DeclareAndCast(HeaderSection_FileName,ento,entto);
67 Handle(TCollection_HAsciiString) name =
68 new TCollection_HAsciiString (enfr->Name());
69 Handle(TCollection_HAsciiString) time =
70 new TCollection_HAsciiString (enfr->TimeStamp());
71 Standard_Integer nba = enfr->NbAuthor();
72 Handle(Interface_HArray1OfHAsciiString) auth =
73 new Interface_HArray1OfHAsciiString (1,nba);
74 for (i = 1; i <= nba; i ++) auth->SetValue
75 (i, new TCollection_HAsciiString (enfr->AuthorValue(i)) );
76 Standard_Integer nbo = enfr->NbOrganization();
77 Handle(Interface_HArray1OfHAsciiString) orga =
78 new Interface_HArray1OfHAsciiString (1,nbo);
79 for (i = 1; i <= nbo; i ++) orga->SetValue
80 (i, new TCollection_HAsciiString (enfr->OrganizationValue(i)) );
81 Handle(TCollection_HAsciiString) prep =
82 new TCollection_HAsciiString (enfr->PreprocessorVersion());
83 Handle(TCollection_HAsciiString) orig =
84 new TCollection_HAsciiString (enfr->OriginatingSystem());
85 Handle(TCollection_HAsciiString) autr =
86 new TCollection_HAsciiString (enfr->Authorisation());
87 ento->Init (name,time,auth,orga,prep,orig,autr);
93 DeclareAndCast(HeaderSection_FileDescription,enfr,entfrom);
94 DeclareAndCast(HeaderSection_FileDescription,ento,entto);
95 Standard_Integer nbd = enfr->NbDescription();
96 Handle(Interface_HArray1OfHAsciiString) desc =
97 new Interface_HArray1OfHAsciiString (1,nbd);
98 for (i = 1; i <= nbd; i ++) desc->SetValue
99 (i, new TCollection_HAsciiString (enfr->DescriptionValue(i)) );
100 Handle(TCollection_HAsciiString) impl =
101 new TCollection_HAsciiString (enfr->ImplementationLevel());
102 ento->Init (desc,impl);
108 DeclareAndCast(HeaderSection_FileSchema,enfr,entfrom);
109 DeclareAndCast(HeaderSection_FileSchema,ento,entto);
110 Standard_Integer nbs = enfr->NbSchemaIdentifiers();
111 Handle(Interface_HArray1OfHAsciiString) sche =
112 new Interface_HArray1OfHAsciiString (1,nbs);
113 for (i = 1; i <= nbs; i ++) sche->SetValue
114 (i, new TCollection_HAsciiString (enfr->SchemaIdentifiersValue(i)) );
120 DeclareAndCast(StepData_UndefinedEntity,undfrom,entfrom);
121 DeclareAndCast(StepData_UndefinedEntity,undto,entto);
122 undto->GetFromAnother(undfrom,TC); // On pourrait rapatrier cela
129 // --- Construction of empty class ---
131 Standard_Boolean RWHeaderSection_GeneralModule::NewVoid
132 (const Standard_Integer CN, Handle(Standard_Transient)& ent) const
134 if (CN == 0) return Standard_False;
137 ent = new HeaderSection_FileName;
140 ent = new HeaderSection_FileDescription;
143 ent = new HeaderSection_FileSchema;
146 ent = new StepData_UndefinedEntity;
148 default : return Standard_False;
151 return Standard_True;