0025748: Parallel version of progress indicator
[occt.git] / src / Message / Message_ProgressSentry.lxx
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 <Message_ProgressIndicator.hxx>
15
16 //=======================================================================
17 //function : Relieve
18 //purpose  : 
19 //=======================================================================
20
21 inline void Message_ProgressSentry::Relieve ()
22 {
23   if ( ! myActive ) return;
24   myProgress->EndScope();
25   myActive = 0;
26 }
27
28 //=======================================================================
29 //function : Next
30 //purpose  : 
31 //=======================================================================
32
33 inline void Message_ProgressSentry::Next (const Standard_CString name) const
34 {
35   if ( myActive ) myProgress->NextScope(name);
36 }
37
38 //=======================================================================
39 //function : Next
40 //purpose  : 
41 //=======================================================================
42
43 inline void Message_ProgressSentry::Next (const Standard_Real span, 
44                                           const Standard_CString name) const
45 {
46   if ( myActive ) myProgress->NextScope(span, name);
47 }
48
49 //=======================================================================
50 //function : Next
51 //purpose  : 
52 //=======================================================================
53
54 inline void Message_ProgressSentry::Next (const Standard_Real span, 
55                                           const Handle(TCollection_HAsciiString)& name) const
56 {
57   if ( myActive ) {
58     myProgress->EndScope();
59     myProgress->NewScope(span, name);
60   }
61 }
62
63 //=======================================================================
64 //function : More
65 //purpose  : 
66 //=======================================================================
67
68 inline Standard_Boolean Message_ProgressSentry::More () const
69 {
70   return myActive ? ! myProgress->UserBreak() : Standard_True;
71 }
72
73 //=======================================================================
74 //function : Show
75 //purpose  : 
76 //=======================================================================
77
78 inline void Message_ProgressSentry::Show () const
79 {
80   if ( ! myProgress.IsNull() ) myProgress->Show();
81 }