0024157: Parallelization of assembly part of BO
[occt.git] / src / IFSelect / IFSelect_CheckCounter.cxx
CommitLineData
b311480e 1// Copyright (c) 1999-2012 OPEN CASCADE SAS
2//
3// The content of this file is subject to the Open CASCADE Technology Public
4// License Version 6.5 (the "License"). You may not use the content of this file
5// except in compliance with the License. Please obtain a copy of the License
6// at http://www.opencascade.org and read it completely before using this file.
7//
8// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
9// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
10//
11// The Original Code and all software distributed under the License is
12// distributed on an "AS IS" basis, without warranty of any kind, and the
13// Initial Developer hereby disclaims all such warranties, including without
14// limitation, any warranties of merchantability, fitness for a particular
15// purpose or non-infringement. Please see the License for the specific terms
16// and conditions governing the rights and limitations under the License.
17
7fd59977 18#include <IFSelect_CheckCounter.ixx>
19#include <Standard_Transient.hxx>
20#include <Interface_Check.hxx>
21#include <stdio.h>
22
23
24//=======================================================================
25//function : IFSelect_CheckCounter
26//purpose :
27//=======================================================================
28
29IFSelect_CheckCounter::IFSelect_CheckCounter(const Standard_Boolean withlist)
30 : IFSelect_SignatureList (withlist)
31{
32 SetName("Check");
33}
34
35
36//=======================================================================
37//function : SetSignature
38//purpose :
39//=======================================================================
40
41void IFSelect_CheckCounter::SetSignature(const Handle(MoniTool_SignText)& sign)
42{
43 thesign = sign;
44}
45
46
47//=======================================================================
48//function : Signature
49//purpose :
50//=======================================================================
51
52Handle(MoniTool_SignText) IFSelect_CheckCounter::Signature () const
53{
54 return thesign;
55}
56
57
58//=======================================================================
59//function : Analyse
60//purpose :
61//=======================================================================
62
63void IFSelect_CheckCounter::Analyse(const Interface_CheckIterator& list,
64 const Handle(Interface_InterfaceModel)& model,
65 const Standard_Boolean original,
66 const Standard_Boolean failsonly)
67{
68 Standard_Integer i,nb,num, nbe = (model.IsNull() ? 0 : model->NbEntities());
69 char mess[300];
70 sprintf (mess,"Check %s",list.Name());
71 SetName (mess);
72 for (list.Start(); list.More(); list.Next()) {
73 num = list.Number();
74 Handle(Standard_Transient) ent;
75 const Handle(Interface_Check) check = list.Value();
76 ent = check->Entity();
77 if (ent.IsNull() && num > 0 && num <= nbe) ent = model->Value(num);
78 nb = check->NbFails();
79 Standard_CString tystr = NULL;
80 if (!ent.IsNull()) {
81 if (!thesign.IsNull()) tystr = thesign->Text (ent,model).ToCString();
82 else if (!model.IsNull()) tystr = model->TypeName (ent);
83 else tystr =
84 Interface_InterfaceModel::ClassName(ent->DynamicType()->Name());
85 }
86 for (i = 1; i <= nb; i ++) {
87 if (ent.IsNull()) sprintf(mess,"F: %s",check->CFail(i,original));
88 else sprintf(mess,"F:%s: %s",tystr,check->CFail(i,original));
89 Add (ent,mess);
90 }
91 nb = 0;
92 if (!failsonly) nb = check->NbWarnings();
93 for (i = 1; i <= nb; i ++) {
94 if (ent.IsNull()) sprintf(mess,"W: %s",check->CWarning(i,original));
95 else sprintf(mess,"W:%s: %s",tystr,check->CWarning(i,original));
96 Add (ent,mess);
97 }
98 }
99}