0026377: Passing Handle objects as arguments to functions as non-const reference...
[occt.git] / src / IGESAppli / IGESAppli_ToolPartNumber.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
42cf5bc1 19#include <IGESAppli_PartNumber.hxx>
20#include <IGESAppli_ToolPartNumber.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>
7fd59977 26#include <IGESData_ParamCursor.hxx>
42cf5bc1 27#include <IGESData_ParamReader.hxx>
28#include <Interface_Check.hxx>
29#include <Interface_CopyTool.hxx>
30#include <Interface_EntityIterator.hxx>
7fd59977 31#include <Interface_Macros.hxx>
42cf5bc1 32#include <Interface_ShareTool.hxx>
33#include <Message_Messenger.hxx>
34#include <Standard_DomainError.hxx>
35#include <TCollection_HAsciiString.hxx>
7fd59977 36
37IGESAppli_ToolPartNumber::IGESAppli_ToolPartNumber () { }
38
39
40void IGESAppli_ToolPartNumber::ReadOwnParams
41 (const Handle(IGESAppli_PartNumber)& ent,
42 const Handle(IGESData_IGESReaderData)& /* IR */, IGESData_ParamReader& PR) const
43{
44 //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
45 Standard_Integer tempNbPropertyValues;
46 Handle(TCollection_HAsciiString) tempGenericNumber;
47 Handle(TCollection_HAsciiString) tempMilitaryNumber;
48 Handle(TCollection_HAsciiString) tempVendorNumber;
49 Handle(TCollection_HAsciiString) tempInternalNumber;
50
51 //szv#4:S4163:12Mar99 `st=` not needed
52 if (PR.DefinedElseSkip())
53 PR.ReadInteger(PR.Current(), "Number of property values", tempNbPropertyValues);
54 else
55 tempNbPropertyValues = 4;
56
57 PR.ReadText(PR.Current(), "Generic Number or Name", tempGenericNumber);
58 PR.ReadText(PR.Current(), "Military Number or Name", tempMilitaryNumber);
59 PR.ReadText(PR.Current(), "Vendor Number or Name", tempVendorNumber);
60 PR.ReadText(PR.Current(), "Internal Number or Name", tempInternalNumber);
61 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
62 ent->Init(tempNbPropertyValues, tempGenericNumber,
63 tempMilitaryNumber, tempVendorNumber, tempInternalNumber);
64}
65
66void IGESAppli_ToolPartNumber::WriteOwnParams
67 (const Handle(IGESAppli_PartNumber)& ent, IGESData_IGESWriter& IW) const
68{
69 IW.Send(ent->NbPropertyValues());
70 IW.Send(ent->GenericNumber());
71 IW.Send(ent->MilitaryNumber());
72 IW.Send(ent->VendorNumber());
73 IW.Send(ent->InternalNumber());
74}
75
76void IGESAppli_ToolPartNumber::OwnShared
77 (const Handle(IGESAppli_PartNumber)& /* ent */, Interface_EntityIterator& /* iter */) const
78{
79}
80
81void IGESAppli_ToolPartNumber::OwnCopy
82 (const Handle(IGESAppli_PartNumber)& another,
83 const Handle(IGESAppli_PartNumber)& ent, Interface_CopyTool& /* TC */) const
84{
85 Standard_Integer tempNbPropertyValues = another->NbPropertyValues();
86 Handle(TCollection_HAsciiString) tempGenericNumber =
87 new TCollection_HAsciiString(another->GenericNumber());
88 Handle(TCollection_HAsciiString) tempMilitaryNumber =
89 new TCollection_HAsciiString(another->MilitaryNumber());
90 Handle(TCollection_HAsciiString) tempVendorNumber =
91 new TCollection_HAsciiString(another->VendorNumber());
92 Handle(TCollection_HAsciiString) tempInternalNumber =
93 new TCollection_HAsciiString(another->InternalNumber());
94 ent->Init(tempNbPropertyValues, tempGenericNumber, tempMilitaryNumber,
95 tempVendorNumber, tempInternalNumber);
96}
97
98Standard_Boolean IGESAppli_ToolPartNumber::OwnCorrect
99 (const Handle(IGESAppli_PartNumber)& ent) const
100{
101 Standard_Boolean res = (ent->NbPropertyValues() != 4);
102 if (res) ent->Init
103 (4,ent->GenericNumber(),ent->MilitaryNumber(),ent->VendorNumber(),
104 ent->InternalNumber()); // nbpropertyvalues= 4
105 return res;
106}
107
108IGESData_DirChecker IGESAppli_ToolPartNumber::DirChecker
109 (const Handle(IGESAppli_PartNumber)& /* ent */ ) const
110{
111 IGESData_DirChecker DC(406, 9);
112 DC.Structure(IGESData_DefVoid);
113 DC.GraphicsIgnored();
114 DC.LineFont(IGESData_DefVoid);
115 DC.LineWeight(IGESData_DefVoid);
116 DC.Color(IGESData_DefVoid);
117 DC.BlankStatusIgnored();
118 DC.UseFlagIgnored();
119 DC.HierarchyStatusIgnored();
120 return DC;
121}
122
123void IGESAppli_ToolPartNumber::OwnCheck
124 (const Handle(IGESAppli_PartNumber)& ent,
125 const Interface_ShareTool& , Handle(Interface_Check)& ach) const
126{
127 if (ent->NbPropertyValues() != 4)
128 ach->AddFail("Number of property values != 4");
129}
130
131void IGESAppli_ToolPartNumber::OwnDump
132 (const Handle(IGESAppli_PartNumber)& ent, const IGESData_IGESDumper& /* dumper */,
133 const Handle(Message_Messenger)& S, const Standard_Integer /* level */) const
134{
135 //Standard_Integer sublevel = (level > 4) ? 1 : 0; //szv#4:S4163:12Mar99 unused
136 S << "IGESAppli_PartNumber" << endl;
137 S << "Number of property values : " << ent->NbPropertyValues() << endl;
138 S << "Generic Number or Name : ";
139 IGESData_DumpString(S,ent->GenericNumber());
140 S << endl;
141 S << "Military Number or Name : ";
142 IGESData_DumpString(S,ent->MilitaryNumber());
143 S << endl;
144 S << "Vendor Number or Name : ";
145 IGESData_DumpString(S,ent->VendorNumber());
146 S << endl;
147 S << "Internal Number or Name : ";
148 IGESData_DumpString(S,ent->InternalNumber());
149 S << endl;
150}