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 <IGESBasic_Name.hxx>
20 #include <IGESBasic_ToolName.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_ParamCursor.hxx>
27 #include <IGESData_ParamReader.hxx>
28 #include <Interface_Check.hxx>
29 #include <Interface_CopyTool.hxx>
30 #include <Interface_EntityIterator.hxx>
31 #include <Interface_Macros.hxx>
32 #include <Interface_ShareTool.hxx>
33 #include <Message_Messenger.hxx>
34 #include <Standard_DomainError.hxx>
35 #include <TCollection_HAsciiString.hxx>
37 IGESBasic_ToolName::IGESBasic_ToolName () { }
40 void IGESBasic_ToolName::ReadOwnParams
41 (const Handle(IGESBasic_Name)& ent,
42 const Handle(IGESData_IGESReaderData)& /* IR */, IGESData_ParamReader& PR) const
44 Standard_Integer tempNbPropertyValues;
45 Handle(TCollection_HAsciiString) tempName;
46 //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
48 PR.ReadInteger(PR.Current(),"Number of property values",tempNbPropertyValues); //szv#4:S4163:12Mar99 `st=` not needed
49 PR.ReadText(PR.Current(),"Name",tempName); //szv#4:S4163:12Mar99 `st=` not needed
51 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
52 ent->Init(tempNbPropertyValues,tempName);
55 void IGESBasic_ToolName::WriteOwnParams
56 (const Handle(IGESBasic_Name)& ent, IGESData_IGESWriter& IW) const
58 IW.Send(ent->NbPropertyValues());
59 IW.Send(ent->Value());
62 void IGESBasic_ToolName::OwnShared
63 (const Handle(IGESBasic_Name)& /* ent */, Interface_EntityIterator& /* iter */) const
67 void IGESBasic_ToolName::OwnCopy
68 (const Handle(IGESBasic_Name)& another,
69 const Handle(IGESBasic_Name)& ent, Interface_CopyTool& /* TC */) const
71 Standard_Integer aNbPropertyValues;
72 Handle(TCollection_HAsciiString) aName;
73 aName = new TCollection_HAsciiString(another->Value());
74 aNbPropertyValues = another->NbPropertyValues();
75 ent->Init(aNbPropertyValues,aName);
78 Standard_Boolean IGESBasic_ToolName::OwnCorrect
79 (const Handle(IGESBasic_Name)& ent) const
81 Standard_Boolean res = (ent->NbPropertyValues() != 1);
82 if (res) ent->Init(1,ent->Value());
83 return res; // nbpropertyvalues = 1
86 IGESData_DirChecker IGESBasic_ToolName::DirChecker
87 (const Handle(IGESBasic_Name)& /*ent*/ ) const
89 IGESData_DirChecker DC(406,15); //Form no = 15 & Type = 406
90 DC.Structure(IGESData_DefVoid);
92 DC.BlankStatusIgnored();
94 DC.HierarchyStatusIgnored();
98 void IGESBasic_ToolName::OwnCheck
99 (const Handle(IGESBasic_Name)& ent,
100 const Interface_ShareTool& , Handle(Interface_Check)& ach) const
102 if (ent->NbPropertyValues() != 1)
103 ach->AddFail("Number of Property Values != 1");
106 void IGESBasic_ToolName::OwnDump
107 (const Handle(IGESBasic_Name)& ent, const IGESData_IGESDumper& /* dumper */,
108 const Handle(Message_Messenger)& S, const Standard_Integer /* level */) const
110 S << "IGESBasic_Name" << endl;
112 S << "Number of property values : " << ent->NbPropertyValues() << endl;
114 IGESData_DumpString(S,ent->Value());