0024023: Revamp the OCCT Handle -- ambiguity
[occt.git] / src / StepData / StepData_DefaultGeneral.cxx
CommitLineData
973c2be1 1// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 2//
973c2be1 3// This file is part of Open CASCADE Technology software library.
b311480e 4//
d5f74e42 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
973c2be1 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.
b311480e 10//
973c2be1 11// Alternatively, this file may be used under the terms of Open CASCADE
12// commercial license or contractual agreement.
b311480e 13
7fd59977 14#include <StepData_DefaultGeneral.ixx>
15#include <StepData.hxx>
16#include <Interface_GeneralLib.hxx>
c04c30b3 17#include <StepData_Protocol.hxx>
7fd59977 18#include <StepData_UndefinedEntity.hxx>
19#include <Interface_UndefinedContent.hxx>
20#include <Interface_Macros.hxx>
21#include <Interface_ParamType.hxx>
22
23
24// DefaultGeneral de StepData reconnait UN SEUL TYPE : UndefinedEntity
25
26
b311480e 27StepData_DefaultGeneral::StepData_DefaultGeneral ()
7fd59977 28{
29 Interface_GeneralLib::SetGlobal (this, StepData::Protocol());
30}
31
32 void StepData_DefaultGeneral::FillSharedCase
33 (const Standard_Integer casenum, const Handle(Standard_Transient)& ent,
34 Interface_EntityIterator& iter) const
35{
36 if (casenum != 1) return;
37 DeclareAndCast(StepData_UndefinedEntity,undf,ent);
38 Handle(Interface_UndefinedContent) cont = undf->UndefinedContent();
39 Standard_Integer nb = cont->NbParams();
40 for (Standard_Integer i = 1; i <= nb; i ++) {
41 Interface_ParamType ptype = cont->ParamType(i);
42 if (ptype == Interface_ParamSub) {
43 DeclareAndCast(StepData_UndefinedEntity,subent,cont->ParamEntity(i));
44 FillSharedCase(casenum,cont->ParamEntity(i),iter);
45 } else if (ptype == Interface_ParamIdent) {
46 iter.GetOneItem(cont->ParamEntity(i));
47 }
48 }
49}
50
51
35e08fe8 52void StepData_DefaultGeneral::CheckCase(const Standard_Integer,
53 const Handle(Standard_Transient)&,
54 const Interface_ShareTool&,
55 Handle(Interface_Check)&) const
7fd59977 56{
57} // pas de Check sur une UndefinedEntity
58
59
60 Standard_Boolean StepData_DefaultGeneral::NewVoid
61 (const Standard_Integer CN, Handle(Standard_Transient)& ent) const
62{
63 if (CN != 1) return Standard_False;
64 ent = new StepData_UndefinedEntity;
65 return Standard_True;
66}
67
68 void StepData_DefaultGeneral::CopyCase
69 (const Standard_Integer casenum, const Handle(Standard_Transient)& entfrom,
70 const Handle(Standard_Transient)& entto, Interface_CopyTool& TC) const
71{
72 if (casenum != 1) return;
73 DeclareAndCast(StepData_UndefinedEntity,undfrom,entfrom);
74 DeclareAndCast(StepData_UndefinedEntity,undto,entto);
75 undto->GetFromAnother(undfrom,TC); // On pourrait rapatrier cela
76}