| 1 | // Created by: CKY / Contract Toubro-Larsen |
| 2 | // Copyright (c) 1993-1999 Matra Datavision |
| 3 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
| 4 | // |
| 5 | // This file is part of Open CASCADE Technology software library. |
| 6 | // |
| 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 |
| 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. |
| 12 | // |
| 13 | // Alternatively, this file may be used under the terms of Open CASCADE |
| 14 | // commercial license or contractual agreement. |
| 15 | |
| 16 | //-------------------------------------------------------------------- |
| 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 | |
| 26 | IGESAppli_ToolLevelFunction::IGESAppli_ToolLevelFunction () { } |
| 27 | |
| 28 | |
| 29 | void 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 | |
| 53 | void 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 | |
| 62 | void IGESAppli_ToolLevelFunction::OwnShared |
| 63 | (const Handle(IGESAppli_LevelFunction)& /* ent */, Interface_EntityIterator& /* iter */) const |
| 64 | { |
| 65 | } |
| 66 | |
| 67 | void 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 | |
| 81 | Standard_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 | |
| 89 | IGESData_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 | |
| 102 | void 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 | |
| 110 | void 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 | } |