Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-18 09:19:39

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 <NCollection_DynamicArray.hxx>
0026 
0027 class BOPTools_Set
0028 {
0029 public:
0030   DEFINE_STANDARD_ALLOC
0031 
0032   Standard_EXPORT BOPTools_Set();
0033   Standard_EXPORT virtual ~BOPTools_Set();
0034 
0035   Standard_EXPORT BOPTools_Set(const occ::handle<NCollection_BaseAllocator>& theAllocator);
0036 
0037   //! Copy constructor.
0038   Standard_EXPORT BOPTools_Set(const BOPTools_Set& theOther);
0039 
0040   Standard_EXPORT BOPTools_Set& Assign(const BOPTools_Set& Other);
0041 
0042   BOPTools_Set& operator=(const BOPTools_Set& Other) { return Assign(Other); }
0043 
0044   Standard_EXPORT const TopoDS_Shape& Shape() const;
0045 
0046   Standard_EXPORT void Add(const TopoDS_Shape& theS, const TopAbs_ShapeEnum theType);
0047 
0048   Standard_EXPORT int NbShapes() const;
0049 
0050   Standard_EXPORT bool IsEqual(const BOPTools_Set& aOther) const;
0051 
0052   bool operator==(const BOPTools_Set& theOther) const { return IsEqual(theOther); }
0053 
0054   size_t GetSum() const { return mySum; }
0055 
0056 protected:
0057   Standard_EXPORT void Clear();
0058 
0059   occ::handle<NCollection_BaseAllocator> myAllocator;
0060   NCollection_DynamicArray<TopoDS_Shape> myShapes;
0061   TopoDS_Shape                           myShape;
0062   int                                    myNbShapes;
0063   size_t                                 mySum;
0064   int                                    myUpper;
0065 };
0066 
0067 namespace std
0068 {
0069 template <>
0070 struct hash<BOPTools_Set>
0071 {
0072   size_t operator()(const BOPTools_Set& theSet) const noexcept { return theSet.GetSum(); }
0073 };
0074 } // namespace std
0075 
0076 #endif // _BOPTools_Set_HeaderFile