Version: 9.16.0
ShHealOper_ModifStats.hxx
Go to the documentation of this file.
1// Copyright (C) 2007-2026 CEA, EDF, OPEN CASCADE
2//
3// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5//
6// This library is free software; you can redistribute it and/or
7// modify it under the terms of the GNU Lesser General Public
8// License as published by the Free Software Foundation; either
9// version 2.1 of the License, or (at your option) any later version.
10//
11// This library is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14// Lesser General Public License for more details.
15//
16// You should have received a copy of the GNU Lesser General Public
17// License along with this library; if not, write to the Free Software
18// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19//
20// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21//
22
23// File : ShHealOper_ModifStats.hxx
24// Created : Mon Dec 1 15:29:48 2014
25
26#ifndef __ShHealOper_ModifStats_HXX__
27#define __ShHealOper_ModifStats_HXX__
28
29#include <string>
30#include <set>
31
35class Standard_EXPORT ShHealOper_ModifStats
36{
37 public:
38
39 struct Standard_EXPORT Datum
40 {
41 std::string myModif; // what is done
42 mutable int myCount; // how many times (in how many sub-shapes)
43
44 Datum( const std::string& txt, int cnt=0 ): myModif( txt ), myCount(cnt) {}
45 bool operator< ( const Datum& o ) const { return myModif < o.myModif; }
46 };
47
48 // record a modification
49 void AddModif( const std::string& modifText, int nb=1 )
50 {
51 std::set< Datum >::iterator d = myData.insert( Datum( modifText )).first;
52 d->myCount += nb;
53 }
54
55 // add data from another ShHealOper_ModifStats
56 void Add( const ShHealOper_ModifStats& stats )
57 {
58 if ( myData.empty() ) myData = stats.myData;
59 else {
60 std::set< Datum >::const_iterator d = stats.myData.begin();
61 for ( ; d != stats.myData.end(); ++d )
62 AddModif( d->myModif, d->myCount );
63 }
64 }
65
66 // return all recorder modifications
67 const std::set< Datum >& GetData() const { return myData; }
68
69 // clear all statistics
70 void Clear() { myData.clear(); }
71
72 protected:
73
74 std::set< Datum > myData;
75
76};
77
78#endif
bool operator<(const gp_Pnt &me, const gp_Pnt &other)
Definition: GEOMImpl_WrappingDriver.cxx:101
Structure describing modifications done in a shape.
Definition: ShHealOper_ModifStats.hxx:36
std::set< Datum > myData
Definition: ShHealOper_ModifStats.hxx:74
void Add(const ShHealOper_ModifStats &stats)
Definition: ShHealOper_ModifStats.hxx:56
const std::set< Datum > & GetData() const
Definition: ShHealOper_ModifStats.hxx:67
void Clear()
Definition: ShHealOper_ModifStats.hxx:70
void AddModif(const std::string &modifText, int nb=1)
Definition: ShHealOper_ModifStats.hxx:49
Definition: ShHealOper_ModifStats.hxx:40
Datum(const std::string &txt, int cnt=0)
Definition: ShHealOper_ModifStats.hxx:44
std::string myModif
Definition: ShHealOper_ModifStats.hxx:41
int myCount
Definition: ShHealOper_ModifStats.hxx:42