0030895: Coding Rules - specify std namespace explicitly for std::cout and streams
[occt.git] / src / IGESAppli / IGESAppli_ToolDrilledHole.cxx
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_DrilledHole.hxx>
20 #include <IGESAppli_ToolDrilledHole.hxx>
21 #include <IGESData_DirChecker.hxx>
22 #include <IGESData_IGESDumper.hxx>
23 #include <IGESData_IGESReaderData.hxx>
24 #include <IGESData_IGESWriter.hxx>
25 #include <IGESData_LevelListEntity.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_ShareTool.hxx>
32 #include <Message_Messenger.hxx>
33 #include <Standard_DomainError.hxx>
34
35 IGESAppli_ToolDrilledHole::IGESAppli_ToolDrilledHole ()    {  }
36
37
38 void  IGESAppli_ToolDrilledHole::ReadOwnParams
39   (const Handle(IGESAppli_DrilledHole)& ent,
40    const Handle(IGESData_IGESReaderData)& /*IR*/, IGESData_ParamReader& PR) const
41 {
42   Standard_Integer tempNbPropertyValues;
43   Standard_Real    tempDrillDiaSize;
44   Standard_Real    tempFinishDiaSize;
45   Standard_Integer tempPlatingFlag;
46   Standard_Integer tempNbLowerLayer;
47   Standard_Integer tempNbHigherLayer;
48   //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
49
50   //szv#4:S4163:12Mar99 `st=` not needed
51   PR.ReadInteger(PR.Current(),"No. of Property values",tempNbPropertyValues);
52   PR.ReadReal(PR.Current(),"Drill diameter size",tempDrillDiaSize);
53   PR.ReadReal(PR.Current(),"Finish diameter size",tempFinishDiaSize);
54   PR.ReadInteger(PR.Current(),"Plating Flag",tempPlatingFlag);
55   PR.ReadInteger(PR.Current(),"Lower numbered layer", tempNbLowerLayer);
56   PR.ReadInteger(PR.Current(),"Higher numbered layer", tempNbHigherLayer);
57
58   DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
59   ent->Init(tempNbPropertyValues,tempDrillDiaSize,tempFinishDiaSize,
60             tempPlatingFlag, tempNbLowerLayer,tempNbHigherLayer);
61 }
62
63 void  IGESAppli_ToolDrilledHole::WriteOwnParams
64   (const Handle(IGESAppli_DrilledHole)& ent, IGESData_IGESWriter& IW) const
65 {
66   IW.Send(ent->NbPropertyValues());
67   IW.Send(ent->DrillDiaSize());
68   IW.Send(ent->FinishDiaSize());
69   IW.SendBoolean(ent->IsPlating());
70   IW.Send(ent->NbLowerLayer());
71   IW.Send(ent->NbHigherLayer());
72 }
73
74 void  IGESAppli_ToolDrilledHole::OwnShared
75   (const Handle(IGESAppli_DrilledHole)& /*ent*/, Interface_EntityIterator& /*iter*/) const
76 {
77 }
78
79 void  IGESAppli_ToolDrilledHole::OwnCopy
80   (const Handle(IGESAppli_DrilledHole)& another,
81    const Handle(IGESAppli_DrilledHole)& ent, Interface_CopyTool& /*TC*/) const
82 {
83   ent->Init
84     (5,another->DrillDiaSize(),another->FinishDiaSize(),
85      (another->IsPlating() ? 1 : 0),
86      another->NbLowerLayer(),another->NbHigherLayer());
87 }
88
89
90 Standard_Boolean  IGESAppli_ToolDrilledHole::OwnCorrect
91   (const Handle(IGESAppli_DrilledHole)& ent) const
92 {
93   Standard_Boolean res = (ent->NbPropertyValues() != 5);
94   if (res) ent->Init
95     (5,ent->DrillDiaSize(),ent->FinishDiaSize(),(ent->IsPlating() ? 1 : 0),
96      ent->NbLowerLayer(),ent->NbHigherLayer());
97   if (ent->SubordinateStatus() != 0) {
98     Handle(IGESData_LevelListEntity) nulevel;
99     ent->InitLevel(nulevel,0);
100     res = Standard_True;
101   }   // NbPropertyvalues = 5 + RAZ level selon subordinate
102   return res;
103 }
104
105 IGESData_DirChecker  IGESAppli_ToolDrilledHole::DirChecker
106   (const Handle(IGESAppli_DrilledHole)& /*ent*/) const
107 {
108   IGESData_DirChecker DC(406,6);  //Form no = 6 & Type = 406
109   DC.Structure(IGESData_DefVoid);
110   DC.GraphicsIgnored();
111   DC.BlankStatusIgnored();
112   DC.UseFlagIgnored();
113   DC.HierarchyStatusIgnored();
114   return DC;
115 }
116
117 void  IGESAppli_ToolDrilledHole::OwnCheck
118   (const Handle(IGESAppli_DrilledHole)& ent,
119    const Interface_ShareTool& , Handle(Interface_Check)& ach) const
120 {
121   if (ent->SubordinateStatus() != 0)
122     if (ent->DefLevel() != IGESData_DefOne &&
123         ent->DefLevel() != IGESData_DefSeveral)
124       ach->AddFail("Level type : Not value/reference");
125   if (ent->NbPropertyValues() != 5)
126     ach->AddFail("Number of Property Values != 5");
127 }
128
129 void  IGESAppli_ToolDrilledHole::OwnDump
130   (const Handle(IGESAppli_DrilledHole)& ent, const IGESData_IGESDumper& /*dumper*/,
131    const Handle(Message_Messenger)& S, const Standard_Integer /*level*/) const
132 {
133   S << "IGESAppli_DrilledHole" << Message_EndLine;
134
135   S << "Number of property values : " << ent->NbPropertyValues() << Message_EndLine;
136   S << "Drill  diameter size :" << ent->DrillDiaSize() << "  ";
137   S << "Finish diameter size : "  << ent->FinishDiaSize() << Message_EndLine;
138   S << "Plating indication flag : ";
139   if (!ent->IsPlating())   S << "NO"  << "  -  ";
140   else                     S << "YES  -  ";
141   S << "Lower Numbered Layer  : " << ent->NbLowerLayer() << "  ";
142   S << "Higher Numbered Layer : " << ent->NbHigherLayer() << Message_EndLine;
143 }