Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/opencascade/IntTools_CurveRangeSample.hxx was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // Created on: 2005-10-05
0002 // Created by: Mikhail KLOKOV
0003 // Copyright (c) 2005-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_CurveRangeSample_HeaderFile
0017 #define _IntTools_CurveRangeSample_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 #include <Standard_DefineAlloc.hxx>
0021 #include <Standard_Handle.hxx>
0022 
0023 #include <IntTools_BaseRangeSample.hxx>
0024 #include <Standard_HashUtils.hxx>
0025 #include <Standard_Boolean.hxx>
0026 #include <Standard_Real.hxx>
0027 
0028 class IntTools_Range;
0029 
0030 //! class for range index management of curve
0031 class IntTools_CurveRangeSample  : public IntTools_BaseRangeSample
0032 {
0033 public:
0034 
0035   DEFINE_STANDARD_ALLOC
0036 
0037   
0038   Standard_EXPORT IntTools_CurveRangeSample();
0039   
0040   Standard_EXPORT IntTools_CurveRangeSample(const Standard_Integer theIndex);
0041   
0042   void SetRangeIndex (const Standard_Integer theIndex) { myIndex = theIndex; }
0043 
0044   Standard_Integer GetRangeIndex() const { return myIndex; }
0045 
0046   Standard_Boolean IsEqual (const IntTools_CurveRangeSample& Other) const
0047   {
0048     return ((myIndex == Other.myIndex) && (GetDepth() == Other.GetDepth()));
0049   }
0050 
0051   bool operator==(const IntTools_CurveRangeSample& Other) const
0052   {
0053     return IsEqual(Other);
0054   }
0055 
0056   Standard_EXPORT IntTools_Range GetRange (const Standard_Real theFirst, const Standard_Real theLast, const Standard_Integer theNbSample) const;
0057   
0058   Standard_Integer GetRangeIndexDeeper (const Standard_Integer theNbSample) const
0059   {
0060     return myIndex * theNbSample;
0061   }
0062 
0063 private:
0064 
0065   Standard_Integer myIndex;
0066 
0067 };
0068 
0069 namespace std
0070 {
0071   template <>
0072   struct hash<IntTools_CurveRangeSample>
0073   {
0074     size_t operator()(const IntTools_CurveRangeSample& theCurveRangeSample) const noexcept
0075     {
0076       // Combine two int values into a single hash value.
0077       int aCombination[2]{ theCurveRangeSample.GetDepth(), theCurveRangeSample.GetRangeIndex() };
0078       return opencascade::hashBytes(aCombination, sizeof(aCombination));
0079     }
0080   };
0081 }
0082 
0083 #endif // _IntTools_CurveRangeSample_HeaderFile