|
||||
File indexing completed on 2025-01-18 10:04:11
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 0030 DEFINE_STANDARD_ALLOC 0031 0032 //! Empty constructor 0033 Standard_EXPORT IntTools_MarkedRangeSet(); 0034 0035 0036 //! build set of ranges which consists of one range with 0037 //! boundary values theFirstBoundary and theLastBoundary 0038 Standard_EXPORT IntTools_MarkedRangeSet(const Standard_Real theFirstBoundary, const Standard_Real theLastBoundary, const Standard_Integer theInitFlag); 0039 0040 0041 //! Build set of ranges based on the array of progressive sorted values 0042 //! 0043 //! Warning: 0044 //! The constructor do not check if the values of array are not sorted 0045 //! It should be checked before function invocation 0046 Standard_EXPORT IntTools_MarkedRangeSet(const TColStd_Array1OfReal& theSortedArray, const Standard_Integer theInitFlag); 0047 0048 0049 //! build set of ranges which consists of one range with 0050 //! boundary values theFirstBoundary and theLastBoundary 0051 Standard_EXPORT void SetBoundaries (const Standard_Real theFirstBoundary, const Standard_Real theLastBoundary, const Standard_Integer theInitFlag); 0052 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, const Standard_Integer theInitFlag); 0060 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, const Standard_Real theLastBoundary, const Standard_Integer theFlag); 0068 0069 0070 //! Inserts a new range marked with flag theFlag 0071 //! It replace the existing ranges or parts of ranges 0072 //! and their flags. 0073 //! Returns True if the range is inside the initial boundaries, 0074 //! otherwise or in case of some error returns False 0075 Standard_EXPORT Standard_Boolean InsertRange (const IntTools_Range& theRange, const Standard_Integer theFlag); 0076 0077 0078 //! Inserts a new range marked with flag theFlag 0079 //! It replace the existing ranges or parts of ranges 0080 //! and their flags. 0081 //! The index theIndex is a position where the range will be inserted. 0082 //! Returns True if the range is inside the initial boundaries, 0083 //! otherwise or in case of some error returns False 0084 Standard_EXPORT Standard_Boolean InsertRange (const Standard_Real theFirstBoundary, const Standard_Real theLastBoundary, const Standard_Integer theFlag, const Standard_Integer theIndex); 0085 0086 0087 //! Inserts a new range marked with flag theFlag 0088 //! It replace the existing ranges or parts of ranges 0089 //! and their flags. 0090 //! The index theIndex is a position where the range will be inserted. 0091 //! Returns True if the range is inside the initial boundaries, 0092 //! otherwise or in case of some error returns False 0093 Standard_EXPORT Standard_Boolean InsertRange (const IntTools_Range& theRange, const Standard_Integer theFlag, const Standard_Integer theIndex); 0094 0095 0096 //! Set flag theFlag for range with index theIndex 0097 Standard_EXPORT void SetFlag (const Standard_Integer theIndex, const Standard_Integer theFlag); 0098 0099 0100 //! Returns flag of the range with index theIndex 0101 Standard_EXPORT Standard_Integer Flag (const Standard_Integer theIndex) const; 0102 0103 0104 //! Returns index of range which contains theValue. 0105 //! If theValue do not belong any range returns 0. 0106 Standard_EXPORT Standard_Integer GetIndex (const Standard_Real theValue) const; 0107 0108 Standard_EXPORT const TColStd_SequenceOfInteger& GetIndices (const Standard_Real theValue); 0109 0110 0111 //! Returns index of range which contains theValue 0112 //! If theValue do not belong any range returns 0. 0113 //! If UseLower is Standard_True then lower boundary of the range 0114 //! can be equal to theValue, otherwise upper boundary of the range 0115 //! can be equal to theValue. 0116 Standard_EXPORT Standard_Integer GetIndex (const Standard_Real theValue, const Standard_Boolean UseLower) const; 0117 0118 //! Returns number of ranges 0119 Standard_Integer Length() const { return myRangeNumber; } 0120 0121 //! Returns the range with index theIndex. 0122 //! the Index can be from 1 to Length() 0123 Standard_EXPORT IntTools_Range Range (const Standard_Integer theIndex) const; 0124 0125 private: 0126 0127 TColStd_SequenceOfReal myRangeSetStorer; 0128 Standard_Integer myRangeNumber; 0129 TColStd_SequenceOfInteger myFlags; 0130 TColStd_SequenceOfInteger myFoundIndices; 0131 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 |