|
|
|||
File indexing completed on 2026-06-04 08:43:36
0001 // Created on: 2001-09-26 0002 // Created by: Michael KLOKOV 0003 // Copyright (c) 2001-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 _IntTools_MarkedRangeSet_HeaderFile 0017 #define _IntTools_MarkedRangeSet_HeaderFile 0018 0019 #include <IntTools_CArray1OfReal.hxx> 0020 #include <TColStd_SequenceOfReal.hxx> 0021 #include <TColStd_SequenceOfInteger.hxx> 0022 0023 class IntTools_Range; 0024 0025 //! class MarkedRangeSet provides continuous set of ranges marked with flags 0026 class IntTools_MarkedRangeSet 0027 { 0028 public: 0029 DEFINE_STANDARD_ALLOC 0030 0031 //! Empty constructor 0032 Standard_EXPORT IntTools_MarkedRangeSet(); 0033 0034 //! build set of ranges which consists of one range with 0035 //! boundary values theFirstBoundary and theLastBoundary 0036 Standard_EXPORT IntTools_MarkedRangeSet(const Standard_Real theFirstBoundary, 0037 const Standard_Real theLastBoundary, 0038 const Standard_Integer theInitFlag); 0039 0040 //! Build set of ranges based on the array of progressive sorted values 0041 //! 0042 //! Warning: 0043 //! The constructor do not check if the values of array are not sorted 0044 //! It should be checked before function invocation 0045 Standard_EXPORT IntTools_MarkedRangeSet(const TColStd_Array1OfReal& theSortedArray, 0046 const Standard_Integer theInitFlag); 0047 0048 //! build set of ranges which consists of one range with 0049 //! boundary values theFirstBoundary and theLastBoundary 0050 Standard_EXPORT void SetBoundaries(const Standard_Real theFirstBoundary, 0051 const Standard_Real theLastBoundary, 0052 const Standard_Integer theInitFlag); 0053 0054 //! Build set of ranges based on the array of progressive sorted values 0055 //! 0056 //! Warning: 0057 //! The function do not check if the values of array are not sorted 0058 //! It should be checked before function invocation 0059 Standard_EXPORT void SetRanges(const TColStd_Array1OfReal& theSortedArray, 0060 const Standard_Integer theInitFlag); 0061 0062 //! Inserts a new range marked with flag theFlag 0063 //! It replace the existing ranges or parts of ranges 0064 //! and their flags. 0065 //! Returns True if the range is inside the initial boundaries, 0066 //! otherwise or in case of some error returns False 0067 Standard_EXPORT Standard_Boolean InsertRange(const Standard_Real theFirstBoundary, 0068 const Standard_Real theLastBoundary, 0069 const Standard_Integer theFlag); 0070 0071 //! Inserts a new range marked with flag theFlag 0072 //! It replace the existing ranges or parts of ranges 0073 //! and their flags. 0074 //! Returns True if the range is inside the initial boundaries, 0075 //! otherwise or in case of some error returns False 0076 Standard_EXPORT Standard_Boolean InsertRange(const IntTools_Range& theRange, 0077 const Standard_Integer theFlag); 0078 0079 //! Inserts a new range marked with flag theFlag 0080 //! It replace the existing ranges or parts of ranges 0081 //! and their flags. 0082 //! The index theIndex is a position where the range will be inserted. 0083 //! Returns True if the range is inside the initial boundaries, 0084 //! otherwise or in case of some error returns False 0085 Standard_EXPORT Standard_Boolean InsertRange(const Standard_Real theFirstBoundary, 0086 const Standard_Real theLastBoundary, 0087 const Standard_Integer theFlag, 0088 const Standard_Integer theIndex); 0089 0090 //! Inserts a new range marked with flag theFlag 0091 //! It replace the existing ranges or parts of ranges 0092 //! and their flags. 0093 //! The index theIndex is a position where the range will be inserted. 0094 //! Returns True if the range is inside the initial boundaries, 0095 //! otherwise or in case of some error returns False 0096 Standard_EXPORT Standard_Boolean InsertRange(const IntTools_Range& theRange, 0097 const Standard_Integer theFlag, 0098 const Standard_Integer theIndex); 0099 0100 //! Set flag theFlag for range with index theIndex 0101 Standard_EXPORT void SetFlag(const Standard_Integer theIndex, const Standard_Integer theFlag); 0102 0103 //! Returns flag of the range with index theIndex 0104 Standard_EXPORT Standard_Integer Flag(const Standard_Integer theIndex) const; 0105 0106 //! Returns index of range which contains theValue. 0107 //! If theValue do not belong any range returns 0. 0108 Standard_EXPORT Standard_Integer GetIndex(const Standard_Real theValue) const; 0109 0110 Standard_EXPORT const TColStd_SequenceOfInteger& GetIndices(const Standard_Real theValue); 0111 0112 //! Returns index of range which contains theValue 0113 //! If theValue do not belong any range returns 0. 0114 //! If UseLower is Standard_True then lower boundary of the range 0115 //! can be equal to theValue, otherwise upper boundary of the range 0116 //! can be equal to theValue. 0117 Standard_EXPORT Standard_Integer GetIndex(const Standard_Real theValue, 0118 const Standard_Boolean UseLower) const; 0119 0120 //! Returns number of ranges 0121 Standard_Integer Length() const { return myRangeNumber; } 0122 0123 //! Returns the range with index theIndex. 0124 //! the Index can be from 1 to Length() 0125 Standard_EXPORT IntTools_Range Range(const Standard_Integer theIndex) const; 0126 0127 private: 0128 TColStd_SequenceOfReal myRangeSetStorer; 0129 Standard_Integer myRangeNumber; 0130 TColStd_SequenceOfInteger myFlags; 0131 TColStd_SequenceOfInteger myFoundIndices; 0132 }; 0133 0134 #endif // _IntTools_MarkedRangeSet_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|