mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
0025748: Parallel version of progress indicator
Progress indication mechanism is refactored to support incrementing progress within multithreaded algorithms. The class Message_ProgressIndicator is only an interface to the user application. It accumulates the progress provided by progress scopes. The counter is protected by mutex for thread-safety. The new class Message_ProgressScope replacing Message_ProgressSentry should be used to advance the progress. The scopes are nested to each other to reflect the nested nature of operations. The new class Message_ProgressRange should be used to pass the progress to sub-scopes. All OCCT algorithms involving progress indication have been updated to new API. Improvements in Draw_ProgressIndicator: - Separate console mode has been added in order to make possible to put the progress into std::cout instead or in addition to the draw interpreter, instead of trigger option "-tclOutput". - Treatment of Ctrl-Break signal has been added. Now any operation can be aborted by Ctrl-C or Ctrl-Break keystroke. Added new test case 'perf fclasses progr_par' for testing of parallel work of the progress.
This commit is contained in:
@@ -25,7 +25,8 @@ Transfer_Actor::Transfer_Actor () { }
|
||||
|
||||
Handle(Transfer_Binder) Transfer_Actor::Transferring
|
||||
(const TheStart& /*start*/,
|
||||
const Handle(Transfer_TransferProcess)& /*TP*/)
|
||||
const Handle(Transfer_TransferProcess)& /*TP*/,
|
||||
const Message_ProgressRange& /*theProgress*/)
|
||||
{ return NullResult(); }
|
||||
|
||||
|
||||
|
@@ -63,7 +63,8 @@ Transfer_ActorDispatch::Transfer_ActorDispatch
|
||||
|
||||
Handle(Transfer_Binder) Transfer_ActorDispatch::Transfer
|
||||
(const Handle(Standard_Transient)& start,
|
||||
const Handle(Transfer_TransientProcess)& /*TP*/)
|
||||
const Handle(Transfer_TransientProcess)& /*TP*/,
|
||||
const Message_ProgressRange&)
|
||||
{
|
||||
thetool.TransferEntity(start);
|
||||
return thetool.TransientProcess()->Find(start);
|
||||
|
@@ -75,7 +75,10 @@ public:
|
||||
//! Specific action : it calls the method Transfer from CopyTool
|
||||
//! i.e. the general service Copy, then returns the Binder
|
||||
//! produced by the TransientProcess
|
||||
Standard_EXPORT virtual Handle(Transfer_Binder) Transfer (const Handle(Standard_Transient)& start, const Handle(Transfer_TransientProcess)& TP) Standard_OVERRIDE;
|
||||
Standard_EXPORT virtual Handle(Transfer_Binder) Transfer
|
||||
(const Handle(Standard_Transient)& start,
|
||||
const Handle(Transfer_TransientProcess)& TP,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
@@ -31,25 +31,28 @@ Standard_Integer& Transfer_ActorOfFinderProcess::ModeTrans ()
|
||||
|
||||
Handle(Transfer_Binder) Transfer_ActorOfFinderProcess::Transfer
|
||||
(const Handle(Transfer_Finder)& fnd,
|
||||
const Handle(Transfer_FinderProcess)& FP)
|
||||
const Handle(Transfer_FinderProcess)& FP,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
Handle(Transfer_TransientMapper) tm = Handle(Transfer_TransientMapper)::DownCast (fnd);
|
||||
if (tm.IsNull()) return NullResult();
|
||||
Handle(Standard_Transient) res = TransferTransient (tm->Value(),FP);
|
||||
Handle(Standard_Transient) res = TransferTransient (tm->Value(),FP, theProgress);
|
||||
if (res.IsNull()) return NullResult();
|
||||
return TransientResult (res);
|
||||
}
|
||||
|
||||
Handle(Transfer_Binder) Transfer_ActorOfFinderProcess::Transferring
|
||||
(const Handle(Transfer_Finder)& ent,
|
||||
const Handle(Transfer_ProcessForFinder)& TP)
|
||||
const Handle(Transfer_ProcessForFinder)& TP,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
return Transfer(ent,Handle(Transfer_FinderProcess)::DownCast(TP));
|
||||
return Transfer(ent,Handle(Transfer_FinderProcess)::DownCast(TP), theProgress);
|
||||
}
|
||||
|
||||
Handle(Standard_Transient) Transfer_ActorOfFinderProcess::TransferTransient
|
||||
(const Handle(Standard_Transient)& /*ent*/,
|
||||
const Handle(Transfer_FinderProcess)& )
|
||||
const Handle(Transfer_FinderProcess)&,
|
||||
const Message_ProgressRange& )
|
||||
{
|
||||
Handle(Standard_Transient) nulres;
|
||||
return nulres;
|
||||
|
@@ -47,11 +47,20 @@ public:
|
||||
//! Returns the Transfer Mode, modifiable
|
||||
Standard_EXPORT Standard_Integer& ModeTrans();
|
||||
|
||||
Standard_EXPORT virtual Handle(Transfer_Binder) Transferring (const Handle(Transfer_Finder)& start, const Handle(Transfer_ProcessForFinder)& TP) Standard_OVERRIDE;
|
||||
Standard_EXPORT virtual Handle(Transfer_Binder) Transferring
|
||||
(const Handle(Transfer_Finder)& start,
|
||||
const Handle(Transfer_ProcessForFinder)& TP,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual Handle(Transfer_Binder) Transfer (const Handle(Transfer_Finder)& start, const Handle(Transfer_FinderProcess)& TP);
|
||||
Standard_EXPORT virtual Handle(Transfer_Binder) Transfer
|
||||
(const Handle(Transfer_Finder)& start,
|
||||
const Handle(Transfer_FinderProcess)& TP,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
Standard_EXPORT virtual Handle(Standard_Transient) TransferTransient (const Handle(Standard_Transient)& start, const Handle(Transfer_FinderProcess)& TP);
|
||||
Standard_EXPORT virtual Handle(Standard_Transient) TransferTransient
|
||||
(const Handle(Standard_Transient)& start,
|
||||
const Handle(Transfer_FinderProcess)& TP,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
|
||||
|
||||
|
@@ -24,6 +24,7 @@
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Transfer_HSequenceOfFinder.hxx>
|
||||
#include <Transfer_TransferMapOfProcessForFinder.hxx>
|
||||
#include <Message_ProgressRange.hxx>
|
||||
|
||||
class Standard_DomainError;
|
||||
class Transfer_Finder;
|
||||
@@ -34,7 +35,6 @@ class Transfer_Binder;
|
||||
class Transfer_SimpleBinderOfTransient;
|
||||
class Standard_Transient;
|
||||
|
||||
|
||||
class Transfer_ActorOfProcessForFinder;
|
||||
DEFINE_STANDARD_HANDLE(Transfer_ActorOfProcessForFinder, Standard_Transient)
|
||||
|
||||
@@ -65,7 +65,10 @@ public:
|
||||
//! (Default defined as doing nothing; should be deffered)
|
||||
//! "mutable" allows the Actor to record intermediate
|
||||
//! information, in addition to those of TransferProcess
|
||||
Standard_EXPORT virtual Handle(Transfer_Binder) Transferring (const Handle(Transfer_Finder)& start, const Handle(Transfer_ProcessForFinder)& TP);
|
||||
Standard_EXPORT virtual Handle(Transfer_Binder) Transferring
|
||||
(const Handle(Transfer_Finder)& start,
|
||||
const Handle(Transfer_ProcessForFinder)& TP,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Prepares and Returns a Binder for a Transient Result
|
||||
//! Returns a Null Handle if <res> is itself Null
|
||||
|
@@ -25,6 +25,7 @@
|
||||
#include <TColStd_MapTransientHasher.hxx>
|
||||
#include <TColStd_HSequenceOfTransient.hxx>
|
||||
#include <Transfer_TransferMapOfProcessForTransient.hxx>
|
||||
#include <Message_ProgressRange.hxx>
|
||||
|
||||
class Standard_DomainError;
|
||||
class Standard_Transient;
|
||||
@@ -33,7 +34,6 @@ class Transfer_IteratorOfProcessForTransient;
|
||||
class Transfer_Binder;
|
||||
class Transfer_SimpleBinderOfTransient;
|
||||
|
||||
|
||||
class Transfer_ActorOfProcessForTransient;
|
||||
DEFINE_STANDARD_HANDLE(Transfer_ActorOfProcessForTransient, Standard_Transient)
|
||||
|
||||
@@ -64,7 +64,10 @@ public:
|
||||
//! (Default defined as doing nothing; should be deffered)
|
||||
//! "mutable" allows the Actor to record intermediate
|
||||
//! information, in addition to those of TransferProcess
|
||||
Standard_EXPORT virtual Handle(Transfer_Binder) Transferring (const Handle(Standard_Transient)& start, const Handle(Transfer_ProcessForTransient)& TP);
|
||||
Standard_EXPORT virtual Handle(Transfer_Binder) Transferring
|
||||
(const Handle(Standard_Transient)& start,
|
||||
const Handle(Transfer_ProcessForTransient)& TP,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Prepares and Returns a Binder for a Transient Result
|
||||
//! Returns a Null Handle if <res> is itself Null
|
||||
|
@@ -26,23 +26,26 @@ Transfer_ActorOfTransientProcess::Transfer_ActorOfTransientProcess () { }
|
||||
|
||||
Handle(Transfer_Binder) Transfer_ActorOfTransientProcess::Transfer
|
||||
(const Handle(Standard_Transient)& start,
|
||||
const Handle(Transfer_TransientProcess)& TP)
|
||||
const Handle(Transfer_TransientProcess)& TP,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
Handle(Standard_Transient) res = TransferTransient (start,TP);
|
||||
Handle(Standard_Transient) res = TransferTransient (start,TP, theProgress);
|
||||
if (res.IsNull()) return NullResult();
|
||||
return TransientResult (res);
|
||||
}
|
||||
|
||||
Handle(Transfer_Binder) Transfer_ActorOfTransientProcess::Transferring
|
||||
(const Handle(Standard_Transient)& ent,
|
||||
const Handle(Transfer_ProcessForTransient)& TP)
|
||||
const Handle(Transfer_ProcessForTransient)& TP,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
return Transfer(ent,Handle(Transfer_TransientProcess)::DownCast(TP));
|
||||
return Transfer(ent,Handle(Transfer_TransientProcess)::DownCast(TP), theProgress);
|
||||
}
|
||||
|
||||
Handle(Standard_Transient) Transfer_ActorOfTransientProcess::TransferTransient
|
||||
(const Handle(Standard_Transient)& /*ent*/,
|
||||
const Handle(Transfer_TransientProcess)& /*TP*/)
|
||||
const Handle(Transfer_TransientProcess)& /*TP*/,
|
||||
const Message_ProgressRange& )
|
||||
{
|
||||
Handle(Standard_Transient) nulres;
|
||||
return nulres;
|
||||
|
@@ -25,7 +25,7 @@ class Transfer_Binder;
|
||||
class Standard_Transient;
|
||||
class Transfer_ProcessForTransient;
|
||||
class Transfer_TransientProcess;
|
||||
|
||||
class Message_ProgressScope;
|
||||
|
||||
class Transfer_ActorOfTransientProcess;
|
||||
DEFINE_STANDARD_HANDLE(Transfer_ActorOfTransientProcess, Transfer_ActorOfProcessForTransient)
|
||||
@@ -39,11 +39,20 @@ public:
|
||||
|
||||
Standard_EXPORT Transfer_ActorOfTransientProcess();
|
||||
|
||||
Standard_EXPORT virtual Handle(Transfer_Binder) Transferring (const Handle(Standard_Transient)& start, const Handle(Transfer_ProcessForTransient)& TP) Standard_OVERRIDE;
|
||||
Standard_EXPORT virtual Handle(Transfer_Binder) Transferring
|
||||
(const Handle(Standard_Transient)& start,
|
||||
const Handle(Transfer_ProcessForTransient)& TP,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual Handle(Transfer_Binder) Transfer (const Handle(Standard_Transient)& start, const Handle(Transfer_TransientProcess)& TP);
|
||||
Standard_EXPORT virtual Handle(Transfer_Binder) Transfer
|
||||
(const Handle(Standard_Transient)& start,
|
||||
const Handle(Transfer_TransientProcess)& TP,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
Standard_EXPORT virtual Handle(Standard_Transient) TransferTransient (const Handle(Standard_Transient)& start, const Handle(Transfer_TransientProcess)& TP);
|
||||
Standard_EXPORT virtual Handle(Standard_Transient) TransferTransient
|
||||
(const Handle(Standard_Transient)& start,
|
||||
const Handle(Transfer_TransientProcess)& TP,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
|
||||
|
||||
|
@@ -20,12 +20,12 @@
|
||||
#include <TColStd_IndexedMapOfInteger.hxx>
|
||||
#include <Transfer_HSequenceOfFinder.hxx>
|
||||
#include <Transfer_TransferMapOfProcessForFinder.hxx>
|
||||
#include <Message_ProgressRange.hxx>
|
||||
|
||||
class Message_Messenger;
|
||||
class Transfer_Finder;
|
||||
class Transfer_Binder;
|
||||
class Transfer_ActorOfProcessForFinder;
|
||||
class Message_ProgressIndicator;
|
||||
class Interface_InterfaceError;
|
||||
class Transfer_TransferFailure;
|
||||
class Transfer_FindHasher;
|
||||
@@ -324,11 +324,13 @@ public:
|
||||
//! the method TransferProduct (see below).
|
||||
//! Mapping and Roots are managed : nothing is done if a Result is
|
||||
//! already Bound, an exception is raised in case of error.
|
||||
Standard_EXPORT Handle(Transfer_Binder) Transferring (const Handle(Transfer_Finder)& start);
|
||||
Standard_EXPORT Handle(Transfer_Binder) Transferring (const Handle(Transfer_Finder)& start,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Same as Transferring but does not return the Binder.
|
||||
//! Simply returns True in case of success (for user call)
|
||||
Standard_EXPORT Standard_Boolean Transfer (const Handle(Transfer_Finder)& start);
|
||||
Standard_EXPORT Standard_Boolean Transfer (const Handle(Transfer_Finder)& start,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Allows controls if exceptions will be handled
|
||||
//! Transfer Operations
|
||||
@@ -407,12 +409,6 @@ public:
|
||||
//! a check or a check-list
|
||||
//! By default, returns 0; can be redefined
|
||||
Standard_EXPORT virtual Standard_Integer CheckNum (const Handle(Transfer_Finder)& start) const;
|
||||
|
||||
//! Sets Progress indicator
|
||||
Standard_EXPORT void SetProgress (const Handle(Message_ProgressIndicator)& theProgress);
|
||||
|
||||
//! Gets Progress indicator
|
||||
Standard_EXPORT Handle(Message_ProgressIndicator) GetProgress() const;
|
||||
|
||||
|
||||
|
||||
@@ -439,7 +435,8 @@ private:
|
||||
//! until a Non Null Binder is produced.
|
||||
//! But keep in mind that a Null Binder can allways be returned
|
||||
//! if a Starting Entity has not been recognized at all.
|
||||
Standard_EXPORT Handle(Transfer_Binder) TransferProduct (const Handle(Transfer_Finder)& start);
|
||||
Standard_EXPORT Handle(Transfer_Binder) TransferProduct (const Handle(Transfer_Finder)& start,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
Standard_Boolean theerrh;
|
||||
Standard_Integer thetrace;
|
||||
@@ -453,7 +450,6 @@ private:
|
||||
Standard_Integer theindex;
|
||||
Handle(Transfer_ActorOfProcessForFinder) theactor;
|
||||
Transfer_TransferMapOfProcessForFinder themap;
|
||||
Handle(Message_ProgressIndicator) myProgress;
|
||||
|
||||
|
||||
};
|
||||
|
@@ -22,7 +22,6 @@
|
||||
#include <Transfer_Finder.hxx>
|
||||
#include <Transfer_Binder.hxx>
|
||||
#include <Transfer_ActorOfProcessForFinder.hxx>
|
||||
#include <Message_ProgressIndicator.hxx>
|
||||
#include <Interface_InterfaceError.hxx>
|
||||
#include <Transfer_TransferFailure.hxx>
|
||||
#include <Transfer_FindHasher.hxx>
|
||||
|
@@ -21,11 +21,11 @@
|
||||
#include <Transfer_TransferMapOfProcessForTransient.hxx>
|
||||
#include <TColStd_MapTransientHasher.hxx>
|
||||
#include <TColStd_HSequenceOfTransient.hxx>
|
||||
#include <Message_ProgressRange.hxx>
|
||||
|
||||
class Message_Messenger;
|
||||
class Transfer_Binder;
|
||||
class Transfer_ActorOfProcessForTransient;
|
||||
class Message_ProgressIndicator;
|
||||
class Interface_InterfaceError;
|
||||
class Transfer_TransferFailure;
|
||||
class Transfer_IteratorOfProcessForTransient;
|
||||
@@ -311,11 +311,13 @@ public:
|
||||
//! the method TransferProduct (see below).
|
||||
//! Mapping and Roots are managed : nothing is done if a Result is
|
||||
//! already Bound, an exception is raised in case of error.
|
||||
Standard_EXPORT Handle(Transfer_Binder) Transferring (const Handle(Standard_Transient)& start);
|
||||
Standard_EXPORT Handle(Transfer_Binder) Transferring (const Handle(Standard_Transient)& start,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Same as Transferring but does not return the Binder.
|
||||
//! Simply returns True in case of success (for user call)
|
||||
Standard_EXPORT Standard_Boolean Transfer (const Handle(Standard_Transient)& start);
|
||||
Standard_EXPORT Standard_Boolean Transfer (const Handle(Standard_Transient)& start,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Allows controls if exceptions will be handled
|
||||
//! Transfer Operations
|
||||
@@ -394,13 +396,6 @@ public:
|
||||
//! a check or a check-list
|
||||
//! By default, returns 0; can be redefined
|
||||
Standard_EXPORT virtual Standard_Integer CheckNum (const Handle(Standard_Transient)& start) const;
|
||||
|
||||
//! Sets Progress indicator
|
||||
Standard_EXPORT void SetProgress (const Handle(Message_ProgressIndicator)& theProgress);
|
||||
|
||||
//! Gets Progress indicator
|
||||
Standard_EXPORT Handle(Message_ProgressIndicator) GetProgress() const;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -426,7 +421,8 @@ private:
|
||||
//! until a Non Null Binder is produced.
|
||||
//! But keep in mind that a Null Binder can allways be returned
|
||||
//! if a Starting Entity has not been recognized at all.
|
||||
Standard_EXPORT Handle(Transfer_Binder) TransferProduct (const Handle(Standard_Transient)& start);
|
||||
Standard_EXPORT Handle(Transfer_Binder) TransferProduct (const Handle(Standard_Transient)& start,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
Standard_Boolean theerrh;
|
||||
Standard_Integer thetrace;
|
||||
@@ -440,7 +436,6 @@ private:
|
||||
Standard_Integer theindex;
|
||||
Handle(Transfer_ActorOfProcessForTransient) theactor;
|
||||
Transfer_TransferMapOfProcessForTransient themap;
|
||||
Handle(Message_ProgressIndicator) myProgress;
|
||||
|
||||
|
||||
};
|
||||
|
@@ -22,7 +22,6 @@
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Transfer_Binder.hxx>
|
||||
#include <Transfer_ActorOfProcessForTransient.hxx>
|
||||
#include <Message_ProgressIndicator.hxx>
|
||||
#include <Interface_InterfaceError.hxx>
|
||||
#include <Transfer_TransferFailure.hxx>
|
||||
#include <Transfer_TransferMapOfProcessForTransient.hxx>
|
||||
|
@@ -25,6 +25,7 @@
|
||||
#include <Transfer_TransferFailure.hxx>
|
||||
#include <Transfer_TransferOutput.hxx>
|
||||
#include <Transfer_TransientProcess.hxx>
|
||||
#include <Message_ProgressScope.hxx>
|
||||
|
||||
Transfer_TransferOutput::Transfer_TransferOutput (const Handle(Transfer_ActorOfTransientProcess)& actor,
|
||||
const Handle(Interface_InterfaceModel)& amodel)
|
||||
@@ -54,7 +55,8 @@ Handle(Interface_InterfaceModel) Transfer_TransferOutput::Model () const
|
||||
Handle(Transfer_TransientProcess) Transfer_TransferOutput::TransientProcess () const
|
||||
{ return theproc; }
|
||||
|
||||
void Transfer_TransferOutput::Transfer (const Handle(Standard_Transient)& obj)
|
||||
void Transfer_TransferOutput::Transfer (const Handle(Standard_Transient)& obj,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
if (themodel->Number(obj) == 0) throw Transfer_TransferFailure("TransferOutput : Transfer, entities do not come from same initial model");
|
||||
// Standard_Integer scope = 0;
|
||||
@@ -63,7 +65,7 @@ void Transfer_TransferOutput::Transfer (const Handle(Standard_Transient)& obj)
|
||||
//:1 modified by ABV 5 Nov 97
|
||||
//:1 if (!theproc->Transfer(obj)) return; // auparavant, traitement Undefined
|
||||
// Standard_Boolean ok =
|
||||
theproc->Transfer ( obj );
|
||||
theproc->Transfer ( obj, theProgress );
|
||||
// if (scope > 0) theproc->EndScope (scope);
|
||||
// if ( ! ok ) return;
|
||||
|
||||
@@ -81,34 +83,38 @@ void Transfer_TransferOutput::Transfer (const Handle(Standard_Transient)& obj)
|
||||
// Pour transferer tout simplement toutes les racines d'un modele d'interface
|
||||
// Chacune est notee "Root" dans le Process final
|
||||
|
||||
void Transfer_TransferOutput::TransferRoots ()
|
||||
{ TransferRoots(Interface_Protocol::Active()); }
|
||||
void Transfer_TransferOutput::TransferRoots (const Message_ProgressRange& theProgress)
|
||||
{ TransferRoots(Interface_Protocol::Active(), theProgress); }
|
||||
|
||||
void Transfer_TransferOutput::TransferRoots (const Handle(Interface_Protocol)& protocol)
|
||||
void Transfer_TransferOutput::TransferRoots (const Handle(Interface_Protocol)& protocol,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
theproc->SetRootManagement (Standard_False);
|
||||
Interface_ShareFlags tool(themodel,protocol);
|
||||
Interface_EntityIterator list = tool.RootEntities();
|
||||
for (list.Start(); list.More(); list.Next()) {
|
||||
Message_ProgressScope aPS(theProgress, NULL, list.NbEntities());
|
||||
for (list.Start(); list.More() && aPS.More(); list.Next()) {
|
||||
Handle(Standard_Transient) ent = list.Value();
|
||||
// Standard_Integer scope = 0;
|
||||
// if (thescope) scope = theproc->NewScope (ent);
|
||||
if (theproc->Transfer(ent)) theproc->SetRoot(ent);
|
||||
if (theproc->Transfer (ent, aPS.Next())) theproc->SetRoot(ent);
|
||||
// if (scope > 0) theproc->EndScope (scope);
|
||||
}
|
||||
}
|
||||
|
||||
void Transfer_TransferOutput::TransferRoots (const Interface_Graph& G)
|
||||
void Transfer_TransferOutput::TransferRoots (const Interface_Graph& G,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
theproc->SetRootManagement (Standard_False);
|
||||
Interface_ShareFlags tool(G);
|
||||
theproc->SetModel (G.Model());
|
||||
Interface_EntityIterator list = tool.RootEntities();
|
||||
for (list.Start(); list.More(); list.Next()) {
|
||||
Message_ProgressScope aPS(theProgress, NULL, list.NbEntities());
|
||||
for (list.Start(); list.More() && aPS.More(); list.Next()) {
|
||||
Handle(Standard_Transient) ent = list.Value();
|
||||
// Standard_Integer scope = 0;
|
||||
// if (thescope) scope = theproc->NewScope (ent);
|
||||
if (theproc->Transfer(ent)) theproc->SetRoot(ent);
|
||||
if (theproc->Transfer (ent, aPS.Next())) theproc->SetRoot(ent);
|
||||
// if (scope > 0) theproc->EndScope (scope);
|
||||
}
|
||||
}
|
||||
|
@@ -20,8 +20,9 @@
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Message_ProgressRange.hxx>
|
||||
|
||||
class Transfer_TransientProcess;
|
||||
class Interface_InterfaceModel;
|
||||
class Standard_NoSuchObject;
|
||||
@@ -32,7 +33,6 @@ class Interface_Protocol;
|
||||
class Interface_Graph;
|
||||
class Interface_EntityIterator;
|
||||
|
||||
|
||||
//! A TransferOutput is a Tool which manages the transfer of
|
||||
//! entities created by an Interface, stored in an InterfaceModel,
|
||||
//! into a set of Objects suitable for an Application
|
||||
@@ -67,22 +67,25 @@ public:
|
||||
|
||||
//! Transfer checks that all taken Entities come from the same
|
||||
//! Model, then calls Transfer from TransientProcess
|
||||
Standard_EXPORT void Transfer (const Handle(Standard_Transient)& obj);
|
||||
Standard_EXPORT void Transfer (const Handle(Standard_Transient)& obj,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Runs transfer on the roots of the Interface Model
|
||||
//! The Roots are computed with a ShareFlags created from a
|
||||
//! Protocol given as Argument
|
||||
Standard_EXPORT void TransferRoots (const Handle(Interface_Protocol)& protocol);
|
||||
Standard_EXPORT void TransferRoots (const Handle(Interface_Protocol)& protocol,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Runs transfer on the roots defined by a Graph of dependences
|
||||
//! (which detains also a Model and its Entities)
|
||||
//! Roots are computed with a ShareFlags created from the Graph
|
||||
Standard_EXPORT void TransferRoots (const Interface_Graph& G);
|
||||
Standard_EXPORT void TransferRoots (const Interface_Graph& G,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Runs transfer on the roots of the Interface Model
|
||||
//! Remark : the Roots are computed with a ShareFlags created
|
||||
//! from the Active Protocol
|
||||
Standard_EXPORT void TransferRoots();
|
||||
Standard_EXPORT void TransferRoots(const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Returns the list of Starting Entities with these criteria :
|
||||
//! - <normal> False, gives the entities bound with ABNORMAL STATUS
|
||||
|
@@ -26,6 +26,7 @@
|
||||
#include <Message_Messenger.hxx>
|
||||
#include <Message_Msg.hxx>
|
||||
#include <Message.hxx>
|
||||
#include <Message_ProgressScope.hxx>
|
||||
|
||||
#include <Transfer_VoidBinder.hxx>
|
||||
#include <Transfer_SimpleBinderOfTransient.hxx>
|
||||
@@ -992,7 +993,8 @@ Standard_Boolean Transfer_TransferProcess::Recognize(const TheStart& start) con
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Transfer_Binder) Transfer_TransferProcess::Transferring(const TheStart& start)
|
||||
Handle(Transfer_Binder) Transfer_TransferProcess::Transferring(const TheStart& start,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
// Map deja alimentee ?
|
||||
Handle(Transfer_Binder) former = FindAndMask(start);
|
||||
@@ -1064,7 +1066,7 @@ Handle(Transfer_Binder) Transfer_TransferProcess::Transferring(const TheStart& s
|
||||
Standard_Integer oldlev = thelevel;
|
||||
try {
|
||||
OCC_CATCH_SIGNALS
|
||||
binder = TransferProduct(start);
|
||||
binder = TransferProduct(start, theProgress);
|
||||
}
|
||||
|
||||
// ... Exceptions a Rattraper : elles ne se ressemblent pas toutes ... !
|
||||
@@ -1107,7 +1109,10 @@ Handle(Transfer_Binder) Transfer_TransferProcess::Transferring(const TheStart& s
|
||||
}
|
||||
|
||||
// Transfert non protege (ainsi, dbx a la main en cas de plantage par Raise)
|
||||
else binder = TransferProduct(start);
|
||||
else binder = TransferProduct(start, theProgress);
|
||||
|
||||
if (theProgress.UserBreak())
|
||||
return Handle(Transfer_Binder)();
|
||||
|
||||
// .... Conclusion : Noter dans la Map ....
|
||||
|
||||
@@ -1149,19 +1154,24 @@ Handle(Transfer_Binder) Transfer_TransferProcess::Transferring(const TheStart& s
|
||||
// ## ## TransferProduct : Action proprement dite ## ##
|
||||
|
||||
Handle(Transfer_Binder) Transfer_TransferProcess::TransferProduct
|
||||
(const TheStart& start)
|
||||
(const TheStart& start,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
thelevel ++; // si decremente et == 0, transfert racine
|
||||
Handle(Transfer_Binder) binder;
|
||||
Handle(Transfer_Actor) actor = theactor;
|
||||
|
||||
// On balaie les Next jusqu a avoir un Resultat
|
||||
Message_ProgressScope aScope (theProgress, NULL, 1, true);
|
||||
while (!actor.IsNull()) {
|
||||
if (actor->Recognize (start)) binder = actor->Transferring(start,this);
|
||||
if (actor->Recognize (start)) binder = actor->Transferring(start,this, aScope.Next());
|
||||
else binder.Nullify();
|
||||
if (!binder.IsNull()) break;
|
||||
actor = actor->Next();
|
||||
}
|
||||
if (aScope.UserBreak())
|
||||
return Handle(Transfer_Binder)();
|
||||
|
||||
if (binder.IsNull()) {
|
||||
// if (thetrace) {
|
||||
// aSender << "Transfer has produced no Result" <<endl;
|
||||
@@ -1184,9 +1194,10 @@ Handle(Transfer_Binder) Transfer_TransferProcess::Transferring(const TheStart& s
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Transfer_TransferProcess::Transfer(const TheStart& start)
|
||||
Standard_Boolean Transfer_TransferProcess::Transfer(const TheStart& start,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
Handle(Transfer_Binder) binder = Transferring(start);
|
||||
Handle(Transfer_Binder) binder = Transferring(start, theProgress);
|
||||
return (!binder.IsNull());
|
||||
}
|
||||
|
||||
@@ -1543,23 +1554,3 @@ Standard_Integer Transfer_TransferProcess::CheckNum(const TheStart& ) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetProgress
|
||||
//purpose : Sets Progress indicator
|
||||
//=======================================================================
|
||||
|
||||
void Transfer_TransferProcess::SetProgress(const Handle(Message_ProgressIndicator)& theProgress)
|
||||
{
|
||||
myProgress = theProgress;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetProgress
|
||||
//purpose : Returns Progress indicator
|
||||
//=======================================================================
|
||||
|
||||
Handle(Message_ProgressIndicator) Transfer_TransferProcess::GetProgress() const
|
||||
{
|
||||
return myProgress;
|
||||
}
|
||||
|
Reference in New Issue
Block a user