973c2be1 |
1 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
2 | // |
973c2be1 |
3 | // This file is part of Open CASCADE Technology software library. |
b311480e |
4 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
10 | // |
973c2be1 |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
b311480e |
13 | |
7fd59977 |
14 | #include <Transfer_FinderProcess.ixx> |
15 | #include <Interface_MSG.hxx> |
16 | #include <Transfer_Binder.hxx> |
17 | #include <Interface_Check.hxx> |
ec357c5c |
18 | #include <Transfer_TransientMapper.hxx> |
7fd59977 |
19 | |
20 | |
b311480e |
21 | Transfer_FinderProcess::Transfer_FinderProcess (const Standard_Integer nb) |
7fd59977 |
22 | : Transfer_ProcessForFinder (nb) { } |
23 | |
24 | void Transfer_FinderProcess::SetModel |
25 | (const Handle(Interface_InterfaceModel)& model) |
26 | { themodel = model; } |
27 | |
28 | Handle(Interface_InterfaceModel) Transfer_FinderProcess::Model () const |
29 | { return themodel; } |
30 | |
31 | |
32 | Standard_Integer Transfer_FinderProcess::NextMappedWithAttribute |
33 | (const Standard_CString name, const Standard_Integer num0) const |
34 | { |
35 | Standard_Integer num, nb = NbMapped(); |
36 | for (num = num0+1; num <= nb; num ++) { |
37 | Handle(Transfer_Finder) fnd = Mapped (num); |
38 | if (fnd.IsNull()) continue; |
39 | if (!fnd->Attribute(name).IsNull()) return num; |
40 | } |
41 | return 0; |
42 | } |
43 | |
44 | Handle(Transfer_TransientMapper) Transfer_FinderProcess::TransientMapper |
45 | (const Handle(Standard_Transient)& obj) const |
46 | { |
47 | Handle(Transfer_TransientMapper) mapper = new Transfer_TransientMapper(obj); |
48 | Standard_Integer index = MapIndex (mapper); |
49 | if (index == 0) return mapper; |
50 | return Handle(Transfer_TransientMapper)::DownCast(Mapped(index)); |
51 | } |
52 | |
53 | |
54 | void Transfer_FinderProcess::PrintTrace |
55 | (const Handle(Transfer_Finder)& start, const Handle(Message_Messenger)& S) const |
56 | { if (!start.IsNull()) S<<" Type:"<<start->ValueTypeName(); } |
57 | |
58 | void Transfer_FinderProcess::PrintStats |
59 | (const Standard_Integer mode, const Handle(Message_Messenger)& S) const |
60 | { |
61 | S<<"\n*******************************************************************\n"; |
62 | if (mode == 1) { // Statistiques de base |
63 | S << "******** Basic Statistics ********"<<endl; |
64 | |
65 | Standard_Integer nbr = 0, nbe = 0, nbw = 0; |
66 | Standard_Integer i, max = NbMapped(), nbroots = NbRoots(); |
67 | S << "**** Nb Final Results : "<<nbroots<<endl; |
68 | |
69 | for (i = 1; i <= max; i ++) { |
70 | const Handle(Transfer_Binder)& binder = MapItem(i); |
71 | if (binder.IsNull()) continue; |
72 | const Handle(Interface_Check) ach = binder->Check(); |
73 | Transfer_StatusExec stat = binder->StatusExec(); |
74 | if (stat != Transfer_StatusInitial && stat != Transfer_StatusDone) |
75 | nbe ++; |
76 | else { |
77 | if (ach->NbWarnings() > 0) nbw ++; |
78 | if (binder->HasResult()) nbr ++; |
79 | } |
80 | } |
81 | if (nbr > nbroots) |
82 | S<<"**** ( Itermediate Results : "<<nbr-nbroots<<" )\n"; |
83 | if (nbe > 0) |
84 | S<<"**** Errors on :"<<Interface_MSG::Blanks(nbe,4)<<nbe<<" Entities\n"; |
85 | if (nbw > 0) |
86 | S<<"**** Warnings on : "<<Interface_MSG::Blanks(nbw,4)<<nbw<<" Entities\n"; |
87 | S<<"*******************************************************************"; |
88 | } |
89 | S<<endl; |
90 | } |