1 // Created by: CKY / Contract Toubro-Larsen
2 // Copyright (c) 1993-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 //--------------------------------------------------------------------
17 //--------------------------------------------------------------------
19 #include <IGESAppli_PinNumber.hxx>
20 #include <IGESAppli_ToolPinNumber.hxx>
21 #include <IGESData_DirChecker.hxx>
22 #include <IGESData_Dump.hxx>
23 #include <IGESData_IGESDumper.hxx>
24 #include <IGESData_IGESReaderData.hxx>
25 #include <IGESData_IGESWriter.hxx>
26 #include <IGESData_LevelListEntity.hxx>
27 #include <IGESData_ParamCursor.hxx>
28 #include <IGESData_ParamReader.hxx>
29 #include <Interface_Check.hxx>
30 #include <Interface_CopyTool.hxx>
31 #include <Interface_EntityIterator.hxx>
32 #include <Interface_Macros.hxx>
33 #include <Interface_ShareTool.hxx>
34 #include <Message_Messenger.hxx>
35 #include <Standard_DomainError.hxx>
36 #include <TCollection_HAsciiString.hxx>
38 IGESAppli_ToolPinNumber::IGESAppli_ToolPinNumber () { }
41 void IGESAppli_ToolPinNumber::ReadOwnParams
42 (const Handle(IGESAppli_PinNumber)& ent,
43 const Handle(IGESData_IGESReaderData)& /* IR */, IGESData_ParamReader& PR) const
45 Standard_Integer tempNbPropertyValues;
46 Handle(TCollection_HAsciiString) tempPinNumber;
47 //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
49 //szv#4:S4163:12Mar99 `st=` not needed
50 PR.ReadInteger(PR.Current(),"Number of property values",tempNbPropertyValues);
51 PR.ReadText(PR.Current(),"PinNumber",tempPinNumber);
53 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
54 ent->Init(tempNbPropertyValues,tempPinNumber);
57 void IGESAppli_ToolPinNumber::WriteOwnParams
58 (const Handle(IGESAppli_PinNumber)& ent, IGESData_IGESWriter& IW) const
60 IW.Send(ent->NbPropertyValues());
61 IW.Send(ent->PinNumberVal());
64 void IGESAppli_ToolPinNumber::OwnShared
65 (const Handle(IGESAppli_PinNumber)& /* ent */, Interface_EntityIterator& /* iter */) const
69 void IGESAppli_ToolPinNumber::OwnCopy
70 (const Handle(IGESAppli_PinNumber)& another,
71 const Handle(IGESAppli_PinNumber)& ent, Interface_CopyTool& /* TC */) const
73 Standard_Integer aNbPropertyValues;
74 Handle(TCollection_HAsciiString) aPinNumber =
75 new TCollection_HAsciiString(another->PinNumberVal());
76 aNbPropertyValues = another->NbPropertyValues();
77 ent->Init(aNbPropertyValues,aPinNumber);
80 Standard_Boolean IGESAppli_ToolPinNumber::OwnCorrect
81 (const Handle(IGESAppli_PinNumber)& ent) const
83 Standard_Boolean res = (ent->SubordinateStatus() != 0);
85 Handle(IGESData_LevelListEntity) nulevel;
86 ent->InitLevel(nulevel,0);
88 return res; // RAZ level selon subordibate
91 IGESData_DirChecker IGESAppli_ToolPinNumber::DirChecker
92 (const Handle(IGESAppli_PinNumber)& /* ent */ ) const
94 IGESData_DirChecker DC(406,8); //Form no = 8 & Type = 406
95 DC.Structure(IGESData_DefVoid);
97 DC.BlankStatusIgnored();
99 DC.HierarchyStatusIgnored();
103 void IGESAppli_ToolPinNumber::OwnCheck
104 (const Handle(IGESAppli_PinNumber)& ent,
105 const Interface_ShareTool& , Handle(Interface_Check)& ach) const
107 if (ent->SubordinateStatus() != 0)
108 if (ent->DefLevel() != IGESData_DefOne &&
109 ent->DefLevel() != IGESData_DefSeveral)
110 ach->AddFail("Level type: Incorrect");
111 if (ent->NbPropertyValues() != 1)
112 ach->AddFail("Number of Property Values != 1");
114 //Level to be ignored if the property is subordinate -- queried
117 void IGESAppli_ToolPinNumber::OwnDump
118 (const Handle(IGESAppli_PinNumber)& ent, const IGESData_IGESDumper& /* dumper */,
119 Standard_OStream& S, const Standard_Integer /* level */) const
121 S << "IGESAppli_PinNumber\n";
122 S << "Number of Property Values : " << ent->NbPropertyValues() << "\n";
124 IGESData_DumpString(S,ent->PinNumberVal());