Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-26 09:05:05

0001 // Created on: 2008-01-22
0002 // Created by: Vladislav ROMASHKO
0003 // Copyright (c) 2008-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _TFunction_Iterator_HeaderFile
0017 #define _TFunction_Iterator_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 #include <Standard_DefineAlloc.hxx>
0021 #include <Standard_Handle.hxx>
0022 
0023 #include <TDF_Label.hxx>
0024 #include <NCollection_List.hxx>
0025 #include <NCollection_Map.hxx>
0026 #include <Standard_Integer.hxx>
0027 #include <TFunction_ExecutionStatus.hxx>
0028 #include <Standard_OStream.hxx>
0029 class TFunction_Scope;
0030 class TDF_Label;
0031 
0032 //! Iterator of the graph of functions
0033 class TFunction_Iterator
0034 {
0035 public:
0036   DEFINE_STANDARD_ALLOC
0037 
0038   //! An empty constructor.
0039   Standard_EXPORT TFunction_Iterator();
0040 
0041   //! A constructor.
0042   //! Initializes the iterator.
0043   Standard_EXPORT TFunction_Iterator(const TDF_Label& Access);
0044 
0045   //! Initializes the Iterator.
0046   Standard_EXPORT virtual void Init(const TDF_Label& Access);
0047 
0048   //! Defines the mode of iteration - usage or not of the execution status.
0049   //! If the iterator takes into account the execution status,
0050   //! the method ::Current() returns only "not executed" functions
0051   //! while their status is not changed.
0052   //! If the iterator ignores the execution status,
0053   //! the method ::Current() returns the functions
0054   //! following their dependencies and ignoring the execution status.
0055   Standard_EXPORT void SetUsageOfExecutionStatus(const bool usage);
0056 
0057   //! Returns usage of execution status by the iterator.
0058   Standard_EXPORT bool GetUsageOfExecutionStatus() const;
0059 
0060   //! Analyses the graph of dependencies and returns
0061   //! maximum number of threads may be used to calculate the model.
0062   Standard_EXPORT virtual int GetMaxNbThreads() const;
0063 
0064   //! Returns the current list of functions.
0065   //! If the iterator uses the execution status,
0066   //! the returned list contains only the functions
0067   //! with "not executed" status.
0068   Standard_EXPORT virtual const NCollection_List<TDF_Label>& Current() const;
0069 
0070   //! Returns false if the graph of functions is fully iterated.
0071   Standard_EXPORT virtual bool More() const;
0072 
0073   //! Switches the iterator to the next list of current functions.
0074   Standard_EXPORT virtual void Next();
0075 
0076   //! A help-function aimed to help the user to check the status of retrurned function.
0077   //! It calls TFunction_GraphNode::GetStatus() inside.
0078   Standard_EXPORT TFunction_ExecutionStatus GetStatus(const TDF_Label& func) const;
0079 
0080   //! A help-function aimed to help the user to change the execution status of a function.
0081   //! It calls TFunction_GraphNode::SetStatus() inside.
0082   Standard_EXPORT void SetStatus(const TDF_Label&                func,
0083                                  const TFunction_ExecutionStatus status) const;
0084 
0085   Standard_EXPORT Standard_OStream& Dump(Standard_OStream& OS) const;
0086 
0087 private:
0088   NCollection_List<TDF_Label>  myCurrent;
0089   bool                         myUsageOfExecutionStatus;
0090   NCollection_Map<TDF_Label>   myPassedFunctions;
0091   occ::handle<TFunction_Scope> myScope;
0092 };
0093 
0094 #endif // _TFunction_Iterator_HeaderFile