0024023: Revamp the OCCT Handle -- ambiguity
[occt.git] / src / IGESAppli / IGESAppli_ToolLevelFunction.cxx
CommitLineData
b311480e 1// Created by: CKY / Contract Toubro-Larsen
2// Copyright (c) 1993-1999 Matra Datavision
973c2be1 3// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
7fd59977 6//
d5f74e42 7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
7fd59977 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
b311480e 15
16//--------------------------------------------------------------------
7fd59977 17//--------------------------------------------------------------------
18
19#include <IGESAppli_ToolLevelFunction.ixx>
20#include <IGESData_ParamCursor.hxx>
21#include <TCollection_HAsciiString.hxx>
22#include <Interface_Macros.hxx>
23#include <IGESData_Dump.hxx>
24
25
26IGESAppli_ToolLevelFunction::IGESAppli_ToolLevelFunction () { }
27
28
29void IGESAppli_ToolLevelFunction::ReadOwnParams
30 (const Handle(IGESAppli_LevelFunction)& ent,
31 const Handle(IGESData_IGESReaderData)& /* IR */, IGESData_ParamReader& PR) const
32{
33 Standard_Integer tempNbPropertyValues;
34 Standard_Integer tempFuncDescripCode;
35 Handle(TCollection_HAsciiString) tempFuncDescrip;
36 //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
37
38 //szv#4:S4163:12Mar99 `st=` not needed
39 PR.ReadInteger(PR.Current(),"No. of Property values", tempNbPropertyValues);
40
41 if (PR.DefinedElseSkip())
42 PR.ReadInteger(PR.Current(),"Function description code",tempFuncDescripCode);
43 else
44 tempFuncDescripCode = 0;
45
46 if (PR.DefinedElseSkip())
47 PR.ReadText(PR.Current(),"Function description",tempFuncDescrip);
48
49 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
50 ent->Init (tempNbPropertyValues,tempFuncDescripCode,tempFuncDescrip);
51}
52
53void IGESAppli_ToolLevelFunction::WriteOwnParams
54 (const Handle(IGESAppli_LevelFunction)& ent, IGESData_IGESWriter& IW) const
55{
56 IW.Send(ent->NbPropertyValues());
57 IW.Send(ent->FuncDescriptionCode());
58 if (ent->FuncDescription().IsNull()) IW.SendVoid();
59 else IW.Send(ent->FuncDescription());
60}
61
62void IGESAppli_ToolLevelFunction::OwnShared
63 (const Handle(IGESAppli_LevelFunction)& /* ent */, Interface_EntityIterator& /* iter */) const
64{
65}
66
67void IGESAppli_ToolLevelFunction::OwnCopy
68 (const Handle(IGESAppli_LevelFunction)& another,
69 const Handle(IGESAppli_LevelFunction)& ent, Interface_CopyTool& /* TC */) const
70{
71 Standard_Integer aNbPropertyValues, code;
72 Handle(TCollection_HAsciiString) descrip;
73 if (!another->FuncDescription().IsNull()) descrip =
74 new TCollection_HAsciiString(another->FuncDescription());
75 code = another->FuncDescriptionCode();
76 aNbPropertyValues = another->NbPropertyValues();
77
78 ent->Init(aNbPropertyValues,code,descrip);
79}
80
81Standard_Boolean IGESAppli_ToolLevelFunction::OwnCorrect
82 (const Handle(IGESAppli_LevelFunction)& ent) const
83{
84 Standard_Boolean res = (ent->NbPropertyValues() != 2);
85 if (res) ent->Init(2,ent->FuncDescriptionCode(),ent->FuncDescription());
86 return res; // nbpropertyvalues = 2
87}
88
89IGESData_DirChecker IGESAppli_ToolLevelFunction::DirChecker
90 (const Handle(IGESAppli_LevelFunction)& /* ent */ ) const
91{
92 IGESData_DirChecker DC(406,3); //Form no = 3 & Type = 406
93 DC.Structure(IGESData_DefVoid);
94 DC.GraphicsIgnored();
95 DC.BlankStatusIgnored();
96 DC.UseFlagIgnored();
97 DC.HierarchyStatusIgnored();
98 DC.SubordinateStatusRequired(00);
99 return DC;
100}
101
102void IGESAppli_ToolLevelFunction::OwnCheck
103 (const Handle(IGESAppli_LevelFunction)& ent,
104 const Interface_ShareTool& , Handle(Interface_Check)& ach) const
105{
106 if (ent->NbPropertyValues() != 2)
107 ach->AddFail("Number of Property Values != 2");
108}
109
110void IGESAppli_ToolLevelFunction::OwnDump
111 (const Handle(IGESAppli_LevelFunction)& ent, const IGESData_IGESDumper& /* dumper */,
112 const Handle(Message_Messenger)& S, const Standard_Integer /* level */) const
113{
114 S << "IGESAppli_LevelFunction" << endl;
115
116 S << "Number of property values : " << ent->NbPropertyValues() << endl;
117 S << "Function Description code : " << ent->FuncDescriptionCode() << endl;
118 S << "Function Description : ";
119 IGESData_DumpString(S,ent->FuncDescription());
120 S << endl;
121}