1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Partitioning/decimation module for the SALOME v3.2 platform
22 * \file MULTIPR_ProgressCallback.hxx
24 * \brief Class MULTIPR_ProgressCallback
26 * \author Olivier LE ROUX - CS, Virtual Reality Dpt
31 #ifndef MULTIPR_PROGRESS_CALLBACK_HXX
32 #define MULTIPR_PROGRESS_CALLBACK_HXX
34 //*****************************************************************************
36 //*****************************************************************************
39 //*****************************************************************************
40 // Class MULTIPR_ProgressCallback
41 // Used to provide feedback on the progress of a slow operation.
42 //*****************************************************************************
44 class MULTIPR_ProgressCallback
49 * Builds a new MULTIPR_ProgressCallback (default constructor).
51 MULTIPR_ProgressCallback() { init(100); }
54 * Destructor. Removes everything.
56 virtual ~MULTIPR_ProgressCallback() { /* do nothing */ }
59 * Starts to provide feedback on the progress of a slow operation.
60 * \param pTaskTitle name of the task to be monitored.
61 * \param pNumSteps number of steps in the task.
63 virtual void start(const char* pTaskTitle, int pNumSteps) = 0;
66 * Moves on the current amount of progress made.
68 void moveOn() { mCurrentStep++; float percent = float(mCurrentStep)/float(mTotalSteps)*100.0f; progress(percent); }
71 * Termines to provide feedback.
73 virtual void done() = 0;
78 * Resets this progress callback.
79 * \param pNumSteps number of steps in the task to be monitored.
81 void init(int pNumSteps) { mCurrentStep = 0; mTotalSteps = pNumSteps; }
84 * Callback. Called on each progress.
85 * \param pPercent percent accomplished.
87 virtual void progress(float pPercent) = 0;
94 }; // class MULTIPR_ProgressCallback
97 //*****************************************************************************
98 // Class MULTIPR_EmptyMeshCallback
99 // Used to provide feedback when an empty mesh is produced.
100 //*****************************************************************************
102 class MULTIPR_EmptyMeshCallback
107 * Builds a new MULTIPR_EmptyMeshCallback (default constructor).
109 MULTIPR_EmptyMeshCallback() { /* do nothing */ }
112 * Destructor. Removes everything.
114 virtual ~MULTIPR_EmptyMeshCallback() { /* do nothing */ }
117 * Callback. Called each time an empty mesh is produced.
118 * \param pInfo information related to the empty mesh.
120 virtual void reportEmptyMesh(std::string pInfo) = 0;
122 }; // class MULTIPR_EmptyMeshCallback
125 #endif // MULTIPR_PROGRESS_CALLBACK_HXX