Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:05

0001 // Created by: Peter KURNEV
0002 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0003 //
0004 // This file is part of Open CASCADE Technology software library.
0005 //
0006 // This library is free software; you can redistribute it and/or modify it under
0007 // the terms of the GNU Lesser General Public License version 2.1 as published
0008 // by the Free Software Foundation, with special exception defined in the file
0009 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0010 // distribution for complete text of the license and disclaimer of any warranty.
0011 //
0012 // Alternatively, this file may be used under the terms of Open CASCADE
0013 // commercial license or contractual agreement.
0014 
0015 #ifndef _BOPTools_Set_HeaderFile
0016 #define _BOPTools_Set_HeaderFile
0017 
0018 #include <Standard.hxx>
0019 #include <Standard_DefineAlloc.hxx>
0020 #include <Standard_Handle.hxx>
0021 
0022 #include <TopoDS_Shape.hxx>
0023 #include <Standard_Integer.hxx>
0024 #include <TopAbs_ShapeEnum.hxx>
0025 #include <TopTools_ListOfShape.hxx>
0026 
0027 
0028 
0029 class BOPTools_Set 
0030 {
0031 public:
0032 
0033   DEFINE_STANDARD_ALLOC
0034 
0035   
0036   Standard_EXPORT BOPTools_Set();
0037 Standard_EXPORT virtual ~BOPTools_Set();
0038   
0039   Standard_EXPORT BOPTools_Set(const Handle(NCollection_BaseAllocator)& theAllocator);
0040 
0041   //! Copy constructor.
0042   Standard_EXPORT BOPTools_Set (const BOPTools_Set& theOther);
0043 
0044   Standard_EXPORT BOPTools_Set& Assign (const BOPTools_Set& Other);
0045 BOPTools_Set& operator = (const BOPTools_Set& Other)
0046 {
0047   return Assign(Other);
0048 }
0049   
0050   Standard_EXPORT const TopoDS_Shape& Shape() const;
0051   
0052   Standard_EXPORT void Add (const TopoDS_Shape& theS, const TopAbs_ShapeEnum theType);
0053   
0054   Standard_EXPORT Standard_Integer NbShapes() const;
0055   
0056   Standard_EXPORT Standard_Boolean IsEqual (const BOPTools_Set& aOther) const;
0057 
0058   bool operator==(const BOPTools_Set& theOther) const
0059   {
0060     return IsEqual(theOther);
0061   }
0062 
0063   size_t GetSum() const { return mySum; }
0064 
0065 protected:
0066 
0067   
0068   Standard_EXPORT void Clear();
0069 
0070 
0071   Handle(NCollection_BaseAllocator) myAllocator;
0072   TopTools_ListOfShape myShapes;
0073   TopoDS_Shape myShape;
0074   Standard_Integer myNbShapes;
0075   size_t mySum;
0076   Standard_Integer myUpper;
0077 };
0078 
0079 namespace std
0080 {
0081   template <>
0082   struct hash<BOPTools_Set>
0083   {
0084     size_t operator()(const BOPTools_Set& theSet) const noexcept
0085     {
0086       return theSet.GetSum();
0087     }
0088   };
0089 }
0090 
0091 #endif // _BOPTools_Set_HeaderFile