|
|
|||
File indexing completed on 2026-06-14 08:29:23
0001 // Copyright (c) 2017-2021 OPEN CASCADE SAS 0002 // 0003 // This file is part of Open CASCADE Technology software library. 0004 // 0005 // This library is free software; you can redistribute it and/or modify it under 0006 // the terms of the GNU Lesser General Public License version 2.1 as published 0007 // by the Free Software Foundation, with special exception defined in the file 0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 0009 // distribution for complete text of the license and disclaimer of any warranty. 0010 // 0011 // Alternatively, this file may be used under the terms of Open CASCADE 0012 // commercial license or contractual agreement. 0013 0014 #ifndef _Message_LazyProgressScope_HeaderFiler 0015 #define _Message_LazyProgressScope_HeaderFiler 0016 0017 #include <Message_ProgressScope.hxx> 0018 0019 //! Progress scope with lazy updates and abort fetches. 0020 //! 0021 //! Although Message_ProgressIndicator implementation is encouraged to spare GUI updates, 0022 //! even optimized implementation might show a noticeable overhead on a very small update step (e.g. 0023 //! per triangle). 0024 //! 0025 //! The class splits initial (displayed) number of overall steps into larger chunks specified in 0026 //! constructor, so that displayed progress is updated at larger steps. 0027 class Message_LazyProgressScope : protected Message_ProgressScope 0028 { 0029 public: 0030 //! Main constructor. 0031 //! @param[in] theRange progress range to scope 0032 //! @param[in] theName name of this scope 0033 //! @param[in] theMax number of steps within this scope 0034 //! @param[in] thePatchStep number of steps to update progress 0035 //! @param[in] theIsInf infinite flag 0036 Message_LazyProgressScope(const Message_ProgressRange& theRange, 0037 const char* theName, 0038 const Standard_Real theMax, 0039 const Standard_Real thePatchStep, 0040 const Standard_Boolean theIsInf = Standard_False) 0041 : Message_ProgressScope(theRange, theName, theMax, theIsInf), 0042 myPatchStep(thePatchStep), 0043 myPatchProgress(0.0), 0044 myIsLazyAborted(Standard_False) 0045 { 0046 } 0047 0048 //! Increment progress with 1. 0049 void Next() 0050 { 0051 if (++myPatchProgress < myPatchStep) 0052 { 0053 return; 0054 } 0055 0056 myPatchProgress = 0.0; 0057 Message_ProgressScope::Next(myPatchStep); 0058 IsAborted(); 0059 } 0060 0061 //! Return TRUE if progress has been aborted - return the cached state lazily updated. 0062 Standard_Boolean More() const { return !myIsLazyAborted; } 0063 0064 //! Return TRUE if progress has been aborted - fetches actual value from the Progress. 0065 Standard_Boolean IsAborted() 0066 { 0067 myIsLazyAborted = myIsLazyAborted || !Message_ProgressScope::More(); 0068 return myIsLazyAborted; 0069 } 0070 0071 protected: 0072 Standard_Real myPatchStep; 0073 Standard_Real myPatchProgress; 0074 Standard_Boolean myIsLazyAborted; 0075 }; 0076 0077 #endif // _Message_LazyProgressScope_HeaderFiler
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|