0025748: Parallel version of progress indicator
[occt.git] / src / Message / Message_ProgressIndicator.cxx
CommitLineData
973c2be1 1// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 2//
973c2be1 3// This file is part of Open CASCADE Technology software library.
b311480e 4//
d5f74e42 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
973c2be1 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.
b311480e 10//
973c2be1 11// Alternatively, this file may be used under the terms of Open CASCADE
12// commercial license or contractual agreement.
b311480e 13
42cf5bc1 14#include <Message_ProgressIndicator.hxx>
7fd59977 15
25e59720 16IMPLEMENT_STANDARD_RTTIEXT(Message_ProgressIndicator,Standard_Transient)
92efcf78 17
7fd59977 18//=======================================================================
19//function : Message_ProgressIndicator
7e785937 20//purpose :
7fd59977 21//=======================================================================
7e785937 22Message_ProgressIndicator::Message_ProgressIndicator()
23: myPosition(0.),
24 myRootScope (NULL)
7fd59977 25{
7e785937 26 myRootScope = new Message_ProgressScope (this);
7fd59977 27}
7fd59977 28
7fd59977 29//=======================================================================
7e785937 30//function : ~Message_ProgressIndicator
31//purpose :
7fd59977 32//=======================================================================
7e785937 33Message_ProgressIndicator::~Message_ProgressIndicator()
7fd59977 34{
7e785937 35 // Avoid calling Increment() from myRootScope.Close()
36 myRootScope->myProgress = 0;
37 myRootScope->myIsActive = false;
38 delete myRootScope;
7fd59977 39}
40
41//=======================================================================
7e785937 42//function : Start()
43//purpose :
7fd59977 44//=======================================================================
7e785937 45Message_ProgressRange Message_ProgressIndicator::Start()
7fd59977 46{
7e785937 47 myPosition = 0.;
48 myRootScope->myValue = 0.;
49 Reset();
50 Show (*myRootScope, Standard_False);
51 return myRootScope->Next();
7fd59977 52}
53
54//=======================================================================
7e785937 55//function : Start()
56//purpose :
7fd59977 57//=======================================================================
7e785937 58Message_ProgressRange Message_ProgressIndicator::Start
59 (const Handle(Message_ProgressIndicator)& theProgress)
7fd59977 60{
7e785937 61 return theProgress.IsNull() ? Message_ProgressRange() : theProgress->Start();
7fd59977 62}