b311480e |
1 | // Copyright (c) 1999-2012 OPEN CASCADE SAS |
2 | // |
3 | // The content of this file is subject to the Open CASCADE Technology Public |
4 | // License Version 6.5 (the "License"). You may not use the content of this file |
5 | // except in compliance with the License. Please obtain a copy of the License |
6 | // at http://www.opencascade.org and read it completely before using this file. |
7 | // |
8 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
9 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
10 | // |
11 | // The Original Code and all software distributed under the License is |
12 | // distributed on an "AS IS" basis, without warranty of any kind, and the |
13 | // Initial Developer hereby disclaims all such warranties, including without |
14 | // limitation, any warranties of merchantability, fitness for a particular |
15 | // purpose or non-infringement. Please see the License for the specific terms |
16 | // and conditions governing the rights and limitations under the License. |
17 | |
7fd59977 |
18 | #include <RWHeaderSection_GeneralModule.ixx> |
19 | |
20 | #include <Interface_Macros.hxx> |
21 | |
22 | #include <Interface_GeneralLib.hxx> |
23 | |
24 | #include <Interface_EntityIterator.hxx> |
25 | |
26 | #include <HeaderSection.hxx> |
27 | |
28 | #include <RWHeaderSection.hxx> |
29 | |
30 | #include <Interface_HArray1OfHAsciiString.hxx> |
31 | #include <TCollection_HAsciiString.hxx> |
32 | |
33 | |
34 | #include <HeaderSection_FileName.hxx> |
35 | #include <HeaderSection_FileDescription.hxx> |
36 | #include <HeaderSection_FileSchema.hxx> |
37 | |
38 | #include <StepData_UndefinedEntity.hxx> |
39 | #include <Interface_Macros.hxx> |
40 | |
41 | |
42 | RWHeaderSection_GeneralModule::RWHeaderSection_GeneralModule () |
43 | { Interface_GeneralLib::SetGlobal(this, HeaderSection::Protocol()); } |
44 | |
45 | void RWHeaderSection_GeneralModule::FillSharedCase(const Standard_Integer CN, const Handle(Standard_Transient)& ent, Interface_EntityIterator& iter) const |
46 | { |
47 | if (CN != 4) return; |
48 | |
49 | DeclareAndCast(StepData_UndefinedEntity,undf,ent); |
50 | undf->FillShared (iter); |
51 | |
52 | } |
53 | |
54 | |
55 | void RWHeaderSection_GeneralModule::CheckCase(const Standard_Integer CN, |
56 | const Handle(Standard_Transient)& ent, |
57 | const Interface_ShareTool& shares, |
302f96fb |
58 | Handle(Interface_Check)& /*ach*/) const |
7fd59977 |
59 | { |
60 | } |
61 | |
62 | |
63 | void RWHeaderSection_GeneralModule::CopyCase(const Standard_Integer CN, const Handle(Standard_Transient)& entfrom, const Handle(Standard_Transient)& entto, Interface_CopyTool& TC) const |
64 | { |
65 | // ajout manuel |
66 | switch (CN) { |
67 | |
68 | case 1 : { |
69 | Standard_Integer i; |
70 | DeclareAndCast(HeaderSection_FileName,enfr,entfrom); |
71 | DeclareAndCast(HeaderSection_FileName,ento,entto); |
72 | Handle(TCollection_HAsciiString) name = |
73 | new TCollection_HAsciiString (enfr->Name()); |
74 | Handle(TCollection_HAsciiString) time = |
75 | new TCollection_HAsciiString (enfr->TimeStamp()); |
76 | Standard_Integer nba = enfr->NbAuthor(); |
77 | Handle(Interface_HArray1OfHAsciiString) auth = |
78 | new Interface_HArray1OfHAsciiString (1,nba); |
79 | for (i = 1; i <= nba; i ++) auth->SetValue |
80 | (i, new TCollection_HAsciiString (enfr->AuthorValue(i)) ); |
81 | Standard_Integer nbo = enfr->NbOrganization(); |
82 | Handle(Interface_HArray1OfHAsciiString) orga = |
83 | new Interface_HArray1OfHAsciiString (1,nbo); |
84 | for (i = 1; i <= nbo; i ++) orga->SetValue |
85 | (i, new TCollection_HAsciiString (enfr->OrganizationValue(i)) ); |
86 | Handle(TCollection_HAsciiString) prep = |
87 | new TCollection_HAsciiString (enfr->PreprocessorVersion()); |
88 | Handle(TCollection_HAsciiString) orig = |
89 | new TCollection_HAsciiString (enfr->OriginatingSystem()); |
90 | Handle(TCollection_HAsciiString) autr = |
91 | new TCollection_HAsciiString (enfr->Authorisation()); |
92 | ento->Init (name,time,auth,orga,prep,orig,autr); |
93 | } |
94 | break; |
95 | |
96 | case 2 : { |
97 | Standard_Integer i; |
98 | DeclareAndCast(HeaderSection_FileDescription,enfr,entfrom); |
99 | DeclareAndCast(HeaderSection_FileDescription,ento,entto); |
100 | Standard_Integer nbd = enfr->NbDescription(); |
101 | Handle(Interface_HArray1OfHAsciiString) desc = |
102 | new Interface_HArray1OfHAsciiString (1,nbd); |
103 | for (i = 1; i <= nbd; i ++) desc->SetValue |
104 | (i, new TCollection_HAsciiString (enfr->DescriptionValue(i)) ); |
105 | Handle(TCollection_HAsciiString) impl = |
106 | new TCollection_HAsciiString (enfr->ImplementationLevel()); |
107 | ento->Init (desc,impl); |
108 | } |
109 | break; |
110 | |
111 | case 3 : { |
112 | Standard_Integer i; |
113 | DeclareAndCast(HeaderSection_FileSchema,enfr,entfrom); |
114 | DeclareAndCast(HeaderSection_FileSchema,ento,entto); |
115 | Standard_Integer nbs = enfr->NbSchemaIdentifiers(); |
116 | Handle(Interface_HArray1OfHAsciiString) sche = |
117 | new Interface_HArray1OfHAsciiString (1,nbs); |
118 | for (i = 1; i <= nbs; i ++) sche->SetValue |
119 | (i, new TCollection_HAsciiString (enfr->SchemaIdentifiersValue(i)) ); |
120 | ento->Init (sche); |
121 | } |
122 | break; |
123 | |
124 | case 4 : { |
125 | DeclareAndCast(StepData_UndefinedEntity,undfrom,entfrom); |
126 | DeclareAndCast(StepData_UndefinedEntity,undto,entto); |
127 | undto->GetFromAnother(undfrom,TC); // On pourrait rapatrier cela |
128 | } |
129 | break; |
130 | |
131 | default : break; |
132 | } |
133 | } |
134 | // --- Construction of empty class --- |
135 | |
136 | Standard_Boolean RWHeaderSection_GeneralModule::NewVoid |
137 | (const Standard_Integer CN, Handle(Standard_Transient)& ent) const |
138 | { |
139 | if (CN == 0) return Standard_False; |
140 | switch (CN) { |
141 | case 1 : |
142 | ent = new HeaderSection_FileName; |
143 | break; |
144 | case 2 : |
145 | ent = new HeaderSection_FileDescription; |
146 | break; |
147 | case 3 : |
148 | ent = new HeaderSection_FileSchema; |
149 | break; |
150 | case 4 : |
151 | ent = new StepData_UndefinedEntity; |
152 | break; |
153 | default : return Standard_False; |
154 | } |
155 | |
156 | return Standard_True; |
157 | } |
158 | |