0024830: Remove redundant keyword 'mutable' in CDL declarations
[occt.git] / src / IFSelect / IFSelect_GraphCounter.cxx
1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
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.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14 #include <IFSelect_GraphCounter.ixx>
15 #include <Interface_EntityIterator.hxx>
16 #include <IFSelect_SelectPointed.hxx>
17 #include <stdio.h>
18 #include <string.h>
19
20
21 IFSelect_GraphCounter::IFSelect_GraphCounter
22   (const Standard_Boolean withmap, const Standard_Boolean withlist)
23   : IFSelect_SignCounter (withmap,withlist)  {  }
24
25     Handle(IFSelect_SelectDeduct)  IFSelect_GraphCounter::Applied () const
26       {  return theapplied;  }
27
28     void  IFSelect_GraphCounter::SetApplied
29   (const Handle(IFSelect_SelectDeduct)& applied)
30       {  theapplied = applied;  }
31
32     void  IFSelect_GraphCounter::AddWithGraph
33   (const Handle(TColStd_HSequenceOfTransient)& list,
34    const Interface_Graph& graph)
35 {
36   if (theapplied.IsNull())  {  AddList (list,graph.Model());  return;  }
37   if (list.IsNull()) return;
38   Standard_Integer i, nb = list->Length();
39   for (i = 1; i <= nb; i ++) {
40     char val[12];
41     Handle(Standard_Transient) ent = list->Value(i);
42     theapplied->Alternate()->SetEntity (ent);
43     Interface_EntityIterator iter = theapplied->UniqueResult(graph);
44     Standard_Integer n = iter.NbEntities();
45     switch (n) {
46     case 0: Add (ent,"0"); break;
47     case 1: Add (ent,"1"); break;
48     case 2: Add (ent,"2"); break;
49     case 3: Add (ent,"3"); break;
50     case 4: Add (ent,"4"); break;
51     case 5: Add (ent,"5"); break;
52     case 6: Add (ent,"6"); break;
53     case 7: Add (ent,"7"); break;
54     case 8: Add (ent,"8"); break;
55     case 9: Add (ent,"9"); break;
56     default :
57       sprintf (val,"%d",n);
58       Add (ent,val);
59       break;
60     }
61   }
62 }