0030895: Coding Rules - specify std namespace explicitly for std::cout and streams
[occt.git] / src / IGESBasic / IGESBasic_ToolGroupWithoutBackP.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 <IGESBasic_GroupWithoutBackP.hxx>
20#include <IGESBasic_ToolGroupWithoutBackP.hxx>
21#include <IGESData_DirChecker.hxx>
7fd59977 22#include <IGESData_Dump.hxx>
42cf5bc1 23#include <IGESData_HArray1OfIGESEntity.hxx>
24#include <IGESData_IGESDumper.hxx>
25#include <IGESData_IGESEntity.hxx>
26#include <IGESData_IGESReaderData.hxx>
27#include <IGESData_IGESWriter.hxx>
28#include <IGESData_ParamCursor.hxx>
29#include <IGESData_ParamReader.hxx>
30#include <Interface_Check.hxx>
31#include <Interface_CopyTool.hxx>
32#include <Interface_EntityIterator.hxx>
7fd59977 33#include <Interface_Macros.hxx>
42cf5bc1 34#include <Interface_ShareTool.hxx>
35#include <Message_Messenger.hxx>
7fd59977 36#include <Message_Msg.hxx>
42cf5bc1 37#include <Standard_DomainError.hxx>
7fd59977 38
42cf5bc1 39// MGE 03/08/98
7fd59977 40IGESBasic_ToolGroupWithoutBackP::IGESBasic_ToolGroupWithoutBackP () { }
41
42
43void IGESBasic_ToolGroupWithoutBackP::ReadOwnParams
44 (const Handle(IGESBasic_GroupWithoutBackP)& ent,
45 const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const
46{
47 // MGE 03/08/98
48 // Building of messages
49 //========================================
50// Message_Msg Msg202("XSTEP_202");
51// Message_Msg Msg203("XSTEP_203");
52 //========================================
53
54 //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
55 Standard_Integer nbval = 0;
56 Handle(IGESData_HArray1OfIGESEntity) EntArray;
57// Msg202.Arg(7);
58 //st = PR.ReadInteger( PR.Current(), Msg202, nbval); //szv#4:S4163:12Mar99 not needed
59 //st = PR.ReadInteger( PR.Current(), "Count of Entities", nbval);
60 if (PR.ReadInteger( PR.Current(), nbval)) { //szv#4:S4163:12Mar99 `st=` not needed
61 Message_Msg Msg203("XSTEP_203");
62 Msg203.Arg(7);
63 PR.ReadEnts (IR,PR.CurrentList(nbval),Msg203,EntArray); //szv#4:S4163:12Mar99 `st=` not needed
64 //st = PR.ReadEnts (IR,PR.CurrentList(nbval),"Entities",EntArray);
65 }
66 else{
67 Message_Msg Msg202("XSTEP_202");
68 Msg202.Arg(7);
69 PR.SendFail(Msg202);
70 }
71 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
72 ent->Init(EntArray);
73}
74
75void IGESBasic_ToolGroupWithoutBackP::WriteOwnParams
76 (const Handle(IGESBasic_GroupWithoutBackP)& ent, IGESData_IGESWriter& IW) const
77{
78 Standard_Integer upper = ent->NbEntities();
79 IW.Send(upper);
80 for (Standard_Integer i = 1; i <= upper;i++)
81 IW.Send(ent->Entity(i));
82}
83
84void IGESBasic_ToolGroupWithoutBackP::OwnShared
85 (const Handle(IGESBasic_GroupWithoutBackP)& ent, Interface_EntityIterator& iter) const
86{
87 Standard_Integer upper = ent->NbEntities();
88 for (Standard_Integer i = 1; i <= upper; i ++)
89 iter.GetOneItem(ent->Entity(i));
90}
91
92void IGESBasic_ToolGroupWithoutBackP::OwnCopy
93 (const Handle(IGESBasic_GroupWithoutBackP)& another,
94 const Handle(IGESBasic_GroupWithoutBackP)& ent, Interface_CopyTool& TC) const
95{
96 Standard_Integer lower,upper;
97 lower = 1;
98 upper = another->NbEntities();
99 Handle(IGESData_HArray1OfIGESEntity) EntArray = new
100 IGESData_HArray1OfIGESEntity(lower,upper);
101 for (Standard_Integer i = lower;i <= upper;i++)
102 {
103 DeclareAndCast
104 (IGESData_IGESEntity,myentity,TC.Transferred(another->Entity(i)));
105 EntArray->SetValue(i,myentity);
106 }
107 ent->Init(EntArray);
108}
109
110Standard_Boolean IGESBasic_ToolGroupWithoutBackP::OwnCorrect
111 (const Handle(IGESBasic_GroupWithoutBackP)& ent ) const
112{
113 Standard_Integer ianul = 0;
114 Standard_Integer i, nbtrue = 0, nb = ent->NbEntities();
115 for (i = 1; i <= nb; i ++) {
116 Handle(IGESData_IGESEntity) val = ent->Entity(i);
117 if (val.IsNull()) ianul ++;
118 else if (val->TypeNumber() == 0) ianul ++;
119 }
120 if (ianul == 0) return Standard_False;
121 Handle(IGESData_HArray1OfIGESEntity) EntArray;
122 if (ianul < nb) EntArray = new IGESData_HArray1OfIGESEntity(1,nb-ianul);
123 for (i = 1; i <= nb; i ++) {
124 Handle(IGESData_IGESEntity) val = ent->Entity(i);
125 if (val.IsNull()) continue;
126 else if (val->TypeNumber() == 0) continue;
127 nbtrue ++;
128 EntArray->SetValue (nbtrue,ent->Entity(i));
129 }
130 ent->Init(EntArray);
131 return Standard_True;
132}
133
134IGESData_DirChecker IGESBasic_ToolGroupWithoutBackP::DirChecker
135 (const Handle(IGESBasic_GroupWithoutBackP)& /* ent */ ) const
136{
137 IGESData_DirChecker DC(402,7); //TypeNo. 402, Form no. 7
138 DC.Structure(IGESData_DefVoid);
139 DC.GraphicsIgnored();
140 DC.BlankStatusIgnored();
141 DC.HierarchyStatusIgnored();
142 return DC;
143}
144
145void IGESBasic_ToolGroupWithoutBackP::OwnCheck
146 (const Handle(IGESBasic_GroupWithoutBackP)& ent,
147 const Interface_ShareTool& , Handle(Interface_Check)& /* ach */) const
148{
149 Standard_Boolean ianul = Standard_False;
150 Standard_Integer i, nb = ent->NbEntities();
151 for (i = 1; i <= nb; i ++) {
152 Handle(IGESData_IGESEntity) val = ent->Entity(i);
153 if (val.IsNull()) ianul = Standard_True;
154 else if (val->TypeNumber() == 0) ianul = Standard_True;
155 if (ianul) {
156 break;
157 }
158 }
159}
160
161void IGESBasic_ToolGroupWithoutBackP::OwnDump
162(const Handle(IGESBasic_GroupWithoutBackP)& ent, const IGESData_IGESDumper& dumper,
163 const Handle(Message_Messenger)& S, const Standard_Integer level) const
164{
04232180 165 S << "IGESBasic_GroupWithoutBackP" << Message_EndLine;
7fd59977 166 S << "Entries in the Group : ";
167 IGESData_DumpEntities(S,dumper ,level,1, ent->NbEntities(),ent->Entity);
04232180 168 S << Message_EndLine;
7fd59977 169}
170