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 | |
42cf5bc1 |
14 | |
15 | #include <Interface_Check.hxx> |
16 | #include <Interface_InterfaceModel.hxx> |
7fd59977 |
17 | #include <Interface_MSG.hxx> |
42cf5bc1 |
18 | #include <Message_Messenger.hxx> |
19 | #include <Standard_Transient.hxx> |
20 | #include <Standard_Type.hxx> |
7fd59977 |
21 | #include <Transfer_Binder.hxx> |
42cf5bc1 |
22 | #include <Transfer_Finder.hxx> |
23 | #include <Transfer_FinderProcess.hxx> |
ec357c5c |
24 | #include <Transfer_TransientMapper.hxx> |
7fd59977 |
25 | |
92efcf78 |
26 | IMPLEMENT_STANDARD_RTTIEXT(Transfer_FinderProcess,Transfer_ProcessForFinder) |
27 | |
b311480e |
28 | Transfer_FinderProcess::Transfer_FinderProcess (const Standard_Integer nb) |
7fd59977 |
29 | : Transfer_ProcessForFinder (nb) { } |
30 | |
31 | void Transfer_FinderProcess::SetModel |
32 | (const Handle(Interface_InterfaceModel)& model) |
33 | { themodel = model; } |
34 | |
35 | Handle(Interface_InterfaceModel) Transfer_FinderProcess::Model () const |
36 | { return themodel; } |
37 | |
38 | |
39 | Standard_Integer Transfer_FinderProcess::NextMappedWithAttribute |
40 | (const Standard_CString name, const Standard_Integer num0) const |
41 | { |
42 | Standard_Integer num, nb = NbMapped(); |
43 | for (num = num0+1; num <= nb; num ++) { |
44 | Handle(Transfer_Finder) fnd = Mapped (num); |
45 | if (fnd.IsNull()) continue; |
46 | if (!fnd->Attribute(name).IsNull()) return num; |
47 | } |
48 | return 0; |
49 | } |
50 | |
51 | Handle(Transfer_TransientMapper) Transfer_FinderProcess::TransientMapper |
52 | (const Handle(Standard_Transient)& obj) const |
53 | { |
54 | Handle(Transfer_TransientMapper) mapper = new Transfer_TransientMapper(obj); |
55 | Standard_Integer index = MapIndex (mapper); |
56 | if (index == 0) return mapper; |
57 | return Handle(Transfer_TransientMapper)::DownCast(Mapped(index)); |
58 | } |
59 | |
60 | |
61 | void Transfer_FinderProcess::PrintTrace |
62 | (const Handle(Transfer_Finder)& start, const Handle(Message_Messenger)& S) const |
63 | { if (!start.IsNull()) S<<" Type:"<<start->ValueTypeName(); } |
64 | |
65 | void Transfer_FinderProcess::PrintStats |
66 | (const Standard_Integer mode, const Handle(Message_Messenger)& S) const |
67 | { |
68 | S<<"\n*******************************************************************\n"; |
69 | if (mode == 1) { // Statistiques de base |
70 | S << "******** Basic Statistics ********"<<endl; |
71 | |
72 | Standard_Integer nbr = 0, nbe = 0, nbw = 0; |
73 | Standard_Integer i, max = NbMapped(), nbroots = NbRoots(); |
74 | S << "**** Nb Final Results : "<<nbroots<<endl; |
75 | |
76 | for (i = 1; i <= max; i ++) { |
77 | const Handle(Transfer_Binder)& binder = MapItem(i); |
78 | if (binder.IsNull()) continue; |
79 | const Handle(Interface_Check) ach = binder->Check(); |
80 | Transfer_StatusExec stat = binder->StatusExec(); |
81 | if (stat != Transfer_StatusInitial && stat != Transfer_StatusDone) |
82 | nbe ++; |
83 | else { |
84 | if (ach->NbWarnings() > 0) nbw ++; |
85 | if (binder->HasResult()) nbr ++; |
86 | } |
87 | } |
88 | if (nbr > nbroots) |
89 | S<<"**** ( Itermediate Results : "<<nbr-nbroots<<" )\n"; |
90 | if (nbe > 0) |
91 | S<<"**** Errors on :"<<Interface_MSG::Blanks(nbe,4)<<nbe<<" Entities\n"; |
92 | if (nbw > 0) |
93 | S<<"**** Warnings on : "<<Interface_MSG::Blanks(nbw,4)<<nbw<<" Entities\n"; |
94 | S<<"*******************************************************************"; |
95 | } |
96 | S<<endl; |
97 | } |