summaryrefslogtreecommitdiff
path: root/src/IFSelect/IFSelect_CheckCounter.cxx
blob: 06e32d48166ddecd01c63145598f498fec389299 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include <IFSelect_CheckCounter.ixx>
#include <Standard_Transient.hxx>
#include <Interface_Check.hxx>
#include <stdio.h>


//=======================================================================
//function : IFSelect_CheckCounter
//purpose  : 
//=======================================================================

IFSelect_CheckCounter::IFSelect_CheckCounter(const Standard_Boolean withlist)
     : IFSelect_SignatureList (withlist)
{
  SetName("Check");
}


//=======================================================================
//function : SetSignature
//purpose  : 
//=======================================================================

void IFSelect_CheckCounter::SetSignature(const Handle(MoniTool_SignText)& sign)
{
  thesign = sign;
}


//=======================================================================
//function : Signature
//purpose  : 
//=======================================================================

Handle(MoniTool_SignText) IFSelect_CheckCounter::Signature () const
{
 return thesign;
}


//=======================================================================
//function : Analyse
//purpose  : 
//=======================================================================

void  IFSelect_CheckCounter::Analyse(const Interface_CheckIterator& list,
                                     const Handle(Interface_InterfaceModel)& model,
                                     const Standard_Boolean original,
                                     const Standard_Boolean failsonly)
{
  Standard_Integer i,nb,num, nbe = (model.IsNull() ? 0 : model->NbEntities());
  char mess[300];
  sprintf (mess,"Check %s",list.Name());
  SetName (mess);
  for (list.Start(); list.More(); list.Next()) {
    num = list.Number();
    Handle(Standard_Transient) ent;
    const Handle(Interface_Check) check = list.Value();
    ent = check->Entity();
    if (ent.IsNull() && num > 0 && num <= nbe) ent = model->Value(num);
    nb = check->NbFails();
    Standard_CString tystr = NULL;
    if (!ent.IsNull()) {
      if (!thesign.IsNull()) tystr = thesign->Text (ent,model).ToCString();
      else if (!model.IsNull()) tystr = model->TypeName (ent);
      else tystr =
	Interface_InterfaceModel::ClassName(ent->DynamicType()->Name());
    }
    for (i = 1; i <= nb; i ++) {
      if (ent.IsNull())  sprintf(mess,"F: %s",check->CFail(i,original));
      else sprintf(mess,"F:%s: %s",tystr,check->CFail(i,original));
      Add (ent,mess);
    }
    nb = 0;
    if (!failsonly) nb = check->NbWarnings();
    for (i = 1; i <= nb; i ++) {
      if (ent.IsNull())  sprintf(mess,"W: %s",check->CWarning(i,original));
      else sprintf(mess,"W:%s: %s",tystr,check->CWarning(i,original));
      Add (ent,mess);
    }
  }
}