0031499
[occt.git] /
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
18 #include <StepData_DefaultGeneral.ixx>
19 #include <StepData.hxx>
20 #include <Interface_GeneralLib.hxx>
21 #include <StepData_UndefinedEntity.hxx>
22 #include <Interface_UndefinedContent.hxx>
23 #include <Interface_Macros.hxx>
24 #include <Interface_ParamType.hxx>
25
26
27 //  DefaultGeneral de StepData  reconnait  UN SEUL TYPE : UndefinedEntity
28
29
30 StepData_DefaultGeneral::StepData_DefaultGeneral ()
31 {
32   Interface_GeneralLib::SetGlobal (this, StepData::Protocol());
33 }
34
35     void  StepData_DefaultGeneral::FillSharedCase
36   (const Standard_Integer casenum, const Handle(Standard_Transient)& ent,
37    Interface_EntityIterator& iter) const 
38 {
39   if (casenum != 1) return;
40   DeclareAndCast(StepData_UndefinedEntity,undf,ent);
41   Handle(Interface_UndefinedContent) cont = undf->UndefinedContent();
42   Standard_Integer nb = cont->NbParams();
43   for (Standard_Integer i = 1; i <= nb; i ++) {
44     Interface_ParamType ptype = cont->ParamType(i);
45     if (ptype == Interface_ParamSub) {
46       DeclareAndCast(StepData_UndefinedEntity,subent,cont->ParamEntity(i));
47       FillSharedCase(casenum,cont->ParamEntity(i),iter);
48     } else if (ptype == Interface_ParamIdent) {
49       iter.GetOneItem(cont->ParamEntity(i));
50     }
51   }
52 }
53
54
55 void  StepData_DefaultGeneral::CheckCase(const Standard_Integer casenum,
56                                          const Handle(Standard_Transient)& ent,
57                                          const Interface_ShareTool& shares,
58                                          Handle(Interface_Check)& /*ach*/) const 
59 {
60 }  //  pas de Check sur une UndefinedEntity
61
62
63     Standard_Boolean  StepData_DefaultGeneral::NewVoid
64   (const Standard_Integer CN, Handle(Standard_Transient)& ent) const 
65 {
66   if (CN != 1) return Standard_False;
67   ent = new StepData_UndefinedEntity;
68   return Standard_True;
69 }
70
71     void  StepData_DefaultGeneral::CopyCase
72   (const Standard_Integer casenum, const Handle(Standard_Transient)& entfrom,
73    const Handle(Standard_Transient)& entto, Interface_CopyTool& TC) const 
74 {
75   if (casenum != 1) return;
76   DeclareAndCast(StepData_UndefinedEntity,undfrom,entfrom);
77   DeclareAndCast(StepData_UndefinedEntity,undto,entto);
78   undto->GetFromAnother(undfrom,TC);  //  On pourrait rapatrier cela
79 }