0022048: Visualization, AIS_InteractiveContext - single object selection should alway...
[occt.git] / src / TFunction / TFunction_Iterator.hxx
1 // Created on: 2008-01-22
2 // Created by: Vladislav ROMASHKO
3 // Copyright (c) 2008-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
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.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 #ifndef _TFunction_Iterator_HeaderFile
17 #define _TFunction_Iterator_HeaderFile
18
19 #include <Standard.hxx>
20 #include <Standard_DefineAlloc.hxx>
21 #include <Standard_Handle.hxx>
22
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;
30 class TDF_Label;
31
32
33 //! Iterator of the graph of functions
34 class TFunction_Iterator 
35 {
36 public:
37
38   DEFINE_STANDARD_ALLOC
39
40   
41   //! An empty constructor.
42   Standard_EXPORT TFunction_Iterator();
43   
44   //! A constructor.
45   //! Initializes the iterator.
46   Standard_EXPORT TFunction_Iterator(const TDF_Label& Access);
47   
48   //! Initializes the Iterator.
49   Standard_EXPORT virtual void Init (const TDF_Label& Access);
50   
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);
59   
60   //! Returns usage of execution status by the iterator.
61   Standard_EXPORT Standard_Boolean GetUsageOfExecutionStatus() const;
62   
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;
66   
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;
72   
73   //! Returns false if the graph of functions is fully iterated.
74   Standard_EXPORT virtual Standard_Boolean More() const;
75   
76   //! Switches the iterator to the next list of current functions.
77   Standard_EXPORT virtual void Next();
78   
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;
82   
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;
86   
87   Standard_EXPORT Standard_OStream& Dump (Standard_OStream& OS) const;
88
89
90
91
92 protected:
93
94
95
96
97
98 private:
99
100
101
102   TDF_LabelList myCurrent;
103   Standard_Boolean myUsageOfExecutionStatus;
104   TDF_LabelMap myPassedFunctions;
105   Handle(TFunction_Scope) myScope;
106
107
108 };
109
110
111
112
113
114
115
116 #endif // _TFunction_Iterator_HeaderFile