1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
15 #include <Interface_Check.hxx>
16 #include <Interface_InterfaceModel.hxx>
17 #include <Interface_MSG.hxx>
18 #include <Transfer_Binder.hxx>
19 #include <Transfer_Finder.hxx>
20 #include <Transfer_FinderProcess.hxx>
21 #include <Transfer_TransientMapper.hxx>
23 IMPLEMENT_STANDARD_RTTIEXT(Transfer_FinderProcess,Transfer_ProcessForFinder)
25 Transfer_FinderProcess::Transfer_FinderProcess (const Standard_Integer nb)
26 : Transfer_ProcessForFinder (nb) { }
28 void Transfer_FinderProcess::SetModel
29 (const Handle(Interface_InterfaceModel)& model)
32 Handle(Interface_InterfaceModel) Transfer_FinderProcess::Model () const
36 Standard_Integer Transfer_FinderProcess::NextMappedWithAttribute
37 (const Standard_CString name, const Standard_Integer num0) const
39 Standard_Integer num, nb = NbMapped();
40 for (num = num0+1; num <= nb; num ++) {
41 Handle(Transfer_Finder) fnd = Mapped (num);
42 if (fnd.IsNull()) continue;
43 if (!fnd->Attribute(name).IsNull()) return num;
48 Handle(Transfer_TransientMapper) Transfer_FinderProcess::TransientMapper
49 (const Handle(Standard_Transient)& obj) const
51 Handle(Transfer_TransientMapper) mapper = new Transfer_TransientMapper(obj);
52 Standard_Integer index = MapIndex (mapper);
53 if (index == 0) return mapper;
54 return Handle(Transfer_TransientMapper)::DownCast(Mapped(index));
58 void Transfer_FinderProcess::PrintTrace (const Handle(Transfer_Finder)& start, Standard_OStream& S) const
60 if (!start.IsNull()) S << " Type:" << start->ValueTypeName();
63 void Transfer_FinderProcess::PrintStats (const Standard_Integer mode, Standard_OStream& S) const
65 S<<"\n*******************************************************************\n";
66 if (mode == 1) { // Statistiques de base
67 S<< "******** Basic Statistics ********"<<std::endl;
69 Standard_Integer nbr = 0, nbe = 0, nbw = 0;
70 Standard_Integer i, max = NbMapped(), nbroots = NbRoots();
71 S<< "**** Nb Final Results : "<< nbroots <<std::endl;
73 for (i = 1; i <= max; i ++) {
74 const Handle(Transfer_Binder)& binder = MapItem(i);
75 if (binder.IsNull()) continue;
76 const Handle(Interface_Check) ach = binder->Check();
77 Transfer_StatusExec stat = binder->StatusExec();
78 if (stat != Transfer_StatusInitial && stat != Transfer_StatusDone)
81 if (ach->NbWarnings() > 0) nbw ++;
82 if (binder->HasResult()) nbr ++;
86 S<<"**** ( Itermediate Results : "<<nbr-nbroots <<" )\n";
88 S<<"**** Errors on :"<<Interface_MSG::Blanks(nbe,4)<<nbe<<" Entities\n";
90 S<<"**** Warnings on : "<<Interface_MSG::Blanks(nbw,4)<<nbw<<" Entities\n";
91 S<<"*******************************************************************";