1 // Created on: 2008-01-22
2 // Created by: Vladislav ROMASHKO
3 // Copyright (c) 2008-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _TFunction_Iterator_HeaderFile
17 #define _TFunction_Iterator_HeaderFile
19 #include <Standard.hxx>
20 #include <Standard_DefineAlloc.hxx>
21 #include <Standard_Handle.hxx>
23 #include <TDF_LabelList.hxx>
24 #include <Standard_Boolean.hxx>
25 #include <TDF_LabelMap.hxx>
26 #include <Standard_Integer.hxx>
27 #include <TFunction_ExecutionStatus.hxx>
28 #include <Standard_OStream.hxx>
29 class TFunction_Scope;
33 //! Iterator of the graph of functions
34 class TFunction_Iterator
41 //! An empty constructor.
42 Standard_EXPORT TFunction_Iterator();
45 //! Initializes the iterator.
46 Standard_EXPORT TFunction_Iterator(const TDF_Label& Access);
48 //! Initializes the Iterator.
49 Standard_EXPORT virtual void Init (const TDF_Label& Access);
51 //! Defines the mode of iteration - usage or not of the execution status.
52 //! If the iterator takes into account the execution status,
53 //! the method ::Current() returns only "not executed" functions
54 //! while their status is not changed.
55 //! If the iterator ignores the execution status,
56 //! the method ::Current() returns the functions
57 //! following their dependencies and ignoring the execution status.
58 Standard_EXPORT void SetUsageOfExecutionStatus (const Standard_Boolean usage);
60 //! Returns usage of execution status by the iterator.
61 Standard_EXPORT Standard_Boolean GetUsageOfExecutionStatus() const;
63 //! Analyses the graph of dependencies and returns
64 //! maximum number of threads may be used to calculate the model.
65 Standard_EXPORT virtual Standard_Integer GetMaxNbThreads() const;
67 //! Returns the current list of functions.
68 //! If the iterator uses the execution status,
69 //! the returned list contains only the functions
70 //! with "not executed" status.
71 Standard_EXPORT virtual const TDF_LabelList& Current() const;
73 //! Returns false if the graph of functions is fully iterated.
74 Standard_EXPORT virtual Standard_Boolean More() const;
76 //! Switches the iterator to the next list of current functions.
77 Standard_EXPORT virtual void Next();
79 //! A help-function aimed to help the user to check the status of retrurned function.
80 //! It calls TFunction_GraphNode::GetStatus() inside.
81 Standard_EXPORT TFunction_ExecutionStatus GetStatus (const TDF_Label& func) const;
83 //! A help-function aimed to help the user to change the execution status of a function.
84 //! It calls TFunction_GraphNode::SetStatus() inside.
85 Standard_EXPORT void SetStatus (const TDF_Label& func, const TFunction_ExecutionStatus status) const;
87 Standard_EXPORT Standard_OStream& Dump (Standard_OStream& OS) const;
102 TDF_LabelList myCurrent;
103 Standard_Boolean myUsageOfExecutionStatus;
104 TDF_LabelMap myPassedFunctions;
105 Handle(TFunction_Scope) myScope;
116 #endif // _TFunction_Iterator_HeaderFile