| 1 | /* This file is part of the FaCT++ DL reasoner |
| 2 | Copyright (C) 2003-2015 Dmitry Tsarkov and The University of Manchester |
| 3 | Copyright (C) 2015-2017 Dmitry Tsarkov |
| 4 | |
| 5 | This library is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU Lesser General Public |
| 7 | License as published by the Free Software Foundation; either |
| 8 | version 2.1 of the License, or (at your option) any later version. |
| 9 | |
| 10 | This library is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | Lesser General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU Lesser General Public |
| 16 | License along with this library; if not, write to the Free Software |
| 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | */ |
| 19 | |
| 20 | #ifndef PROGRESSINDICATORINTERFACE_H |
| 21 | #define PROGRESSINDICATORINTERFACE_Hcxx . . $ `Kernel/ProgressIndicatorInterface.h:21:9`! |
| 22 | |
| 23 | /// interface of the progress indicator |
| 24 | class ProgressIndicatorInterfacecxx . . $ ProgressIndicatorInterface# |
| 25 | { |
| 26 | protected: // members |
| 27 | /// limit of the progress: indicate [0..uLimit] |
| 28 | unsigned long uLimitcxx . . $ ProgressIndicatorInterface#uLimit. = 0; |
| 29 | /// current value of an indicator |
| 30 | unsigned long uCurrentcxx . . $ ProgressIndicatorInterface#uCurrent. = 0; |
| 31 | |
| 32 | protected: // methods |
| 33 | /// initial exposure method: can be overridden in derived classes |
| 34 | virtual void initExposurecxx . . $ ProgressIndicatorInterface#initExposure(49f6e7a06ebc5aa8). ( void ) {} |
| 35 | /// indicate current value somehow |
| 36 | virtual void exposecxx . . $ ProgressIndicatorInterface#expose(49f6e7a06ebc5aa8). ( void ) = 0; |
| 37 | /// check whether the limit is reached |
| 38 | bool checkMaxcxx . . $ ProgressIndicatorInterface#checkMax(c9857a73d68e59ba). ( void ) |
| 39 | { |
| 40 | if ( uCurrentcxx . . $ ProgressIndicatorInterface#uCurrent. > uLimitcxx . . $ ProgressIndicatorInterface#uLimit. ) |
| 41 | { |
| 42 | uCurrentcxx . . $ ProgressIndicatorInterface#uCurrent. = uLimitcxx . . $ ProgressIndicatorInterface#uLimit.; |
| 43 | return true; |
| 44 | } |
| 45 | else |
| 46 | return false; |
| 47 | } |
| 48 | |
| 49 | public: // interface |
| 50 | /// empty c'tor |
| 51 | ProgressIndicatorInterfacecxx . . $ ProgressIndicatorInterface#ProgressIndicatorInterface(49f6e7a06ebc5aa8).() = default; |
| 52 | /// init c'tor |
| 53 | explicit ProgressIndicatorInterfacecxx . . $ ProgressIndicatorInterface#ProgressIndicatorInterface(2c44cd906ae4e829). ( unsigned long limit ) { setLimitcxx . . $ ProgressIndicatorInterface#setLimit(2c44cd906ae4e829). (limit); } |
| 54 | /// empty d'tor |
| 55 | virtual ~cxx . . $ ProgressIndicatorInterface#`~ProgressIndicatorInterface`(49f6e7a06ebc5aa8).ProgressIndicatorInterfacecxx . . $ ProgressIndicatorInterface#() = default; |
| 56 | |
| 57 | /// set indicator to a given VALUE |
| 58 | void setIndicatorcxx . . $ ProgressIndicatorInterface#setIndicator(2c44cd906ae4e829). ( unsigned long value ) |
| 59 | { |
| 60 | if ( uCurrentcxx . . $ ProgressIndicatorInterface#uCurrent. != value ) |
| 61 | { |
| 62 | uCurrentcxx . . $ ProgressIndicatorInterface#uCurrent. = value; |
| 63 | checkMaxcxx . . $ ProgressIndicatorInterface#checkMax(c9857a73d68e59ba). (); |
| 64 | exposecxx . . $ ProgressIndicatorInterface#expose(49f6e7a06ebc5aa8). (); |
| 65 | } |
| 66 | } |
| 67 | /// increment current value of an indicator to DELTA steps |
| 68 | void incIndicatorcxx . . $ ProgressIndicatorInterface#incIndicator(2c44cd906ae4e829). ( unsigned long delta = 1 ) { setIndicatorcxx . . $ ProgressIndicatorInterface#setIndicator(2c44cd906ae4e829).(uCurrentcxx . . $ ProgressIndicatorInterface#uCurrent.+delta); } |
| 69 | /// set indicator to 0 |
| 70 | void resetcxx . . $ ProgressIndicatorInterface#reset(49f6e7a06ebc5aa8). ( void ) { setIndicatorcxx . . $ ProgressIndicatorInterface#setIndicator(2c44cd906ae4e829). (0); } |
| 71 | /// set the limit of an indicator to a given VALUE |
| 72 | void setLimitcxx . . $ ProgressIndicatorInterface#setLimit(2c44cd906ae4e829). ( unsigned long limit ) { uLimitcxx . . $ ProgressIndicatorInterface#uLimit. = limit; resetcxx . . $ ProgressIndicatorInterface#reset(49f6e7a06ebc5aa8).(); initExposurecxx . . $ ProgressIndicatorInterface#initExposure(49f6e7a06ebc5aa8).(); } |
| 73 | }; // ProgressIndicatorInterface |
| 74 | |
| 75 | #endif |