0026377: Passing Handle objects as arguments to functions as non-const reference...
[occt.git] / src / IGESAppli / IGESAppli_ToolPinNumber.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_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>
7fd59977 26#include <IGESData_LevelListEntity.hxx>
42cf5bc1 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>
7fd59977 32#include <Interface_Macros.hxx>
42cf5bc1 33#include <Interface_ShareTool.hxx>
34#include <Message_Messenger.hxx>
35#include <Standard_DomainError.hxx>
36#include <TCollection_HAsciiString.hxx>
7fd59977 37
38IGESAppli_ToolPinNumber::IGESAppli_ToolPinNumber () { }
39
40
41void IGESAppli_ToolPinNumber::ReadOwnParams
42 (const Handle(IGESAppli_PinNumber)& ent,
43 const Handle(IGESData_IGESReaderData)& /* IR */, IGESData_ParamReader& PR) const
44{
45 Standard_Integer tempNbPropertyValues;
46 Handle(TCollection_HAsciiString) tempPinNumber;
47 //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
48
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);
52
53 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
54 ent->Init(tempNbPropertyValues,tempPinNumber);
55}
56
57void IGESAppli_ToolPinNumber::WriteOwnParams
58 (const Handle(IGESAppli_PinNumber)& ent, IGESData_IGESWriter& IW) const
59{
60 IW.Send(ent->NbPropertyValues());
61 IW.Send(ent->PinNumberVal());
62}
63
64void IGESAppli_ToolPinNumber::OwnShared
65 (const Handle(IGESAppli_PinNumber)& /* ent */, Interface_EntityIterator& /* iter */) const
66{
67}
68
69void IGESAppli_ToolPinNumber::OwnCopy
70 (const Handle(IGESAppli_PinNumber)& another,
71 const Handle(IGESAppli_PinNumber)& ent, Interface_CopyTool& /* TC */) const
72{
73 Standard_Integer aNbPropertyValues;
74 Handle(TCollection_HAsciiString) aPinNumber =
75 new TCollection_HAsciiString(another->PinNumberVal());
76 aNbPropertyValues = another->NbPropertyValues();
77 ent->Init(aNbPropertyValues,aPinNumber);
78}
79
80Standard_Boolean IGESAppli_ToolPinNumber::OwnCorrect
81 (const Handle(IGESAppli_PinNumber)& ent) const
82{
83 Standard_Boolean res = (ent->SubordinateStatus() != 0);
84 if (res) {
85 Handle(IGESData_LevelListEntity) nulevel;
86 ent->InitLevel(nulevel,0);
87 }
88 return res; // RAZ level selon subordibate
89}
90
91IGESData_DirChecker IGESAppli_ToolPinNumber::DirChecker
92 (const Handle(IGESAppli_PinNumber)& /* ent */ ) const
93{
94 IGESData_DirChecker DC(406,8); //Form no = 8 & Type = 406
95 DC.Structure(IGESData_DefVoid);
96 DC.GraphicsIgnored();
97 DC.BlankStatusIgnored();
98 DC.UseFlagIgnored();
99 DC.HierarchyStatusIgnored();
100 return DC;
101}
102
103void IGESAppli_ToolPinNumber::OwnCheck
104 (const Handle(IGESAppli_PinNumber)& ent,
105 const Interface_ShareTool& , Handle(Interface_Check)& ach) const
106{
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");
113 //UNFINISHED
114 //Level to be ignored if the property is subordinate -- queried
115}
116
117void IGESAppli_ToolPinNumber::OwnDump
118 (const Handle(IGESAppli_PinNumber)& ent, const IGESData_IGESDumper& /* dumper */,
119 const Handle(Message_Messenger)& S, const Standard_Integer /* level */) const
120{
121 S << "IGESAppli_PinNumber" << endl;
122 S << "Number of Property Values : " << ent->NbPropertyValues() << endl;
123 S << "PinNumber : ";
124 IGESData_DumpString(S,ent->PinNumberVal());
125 S << endl;
126}