mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-09-06 04:37:55 +08:00
Foundation Classes - Tree & collection performance optimizations, move semantics, unified map API (#1065)
NCollection_UBTree/EBTree: - Add move constructor and move assignment operators - Replace recursive Select() and delNode() with iterative stack-based traversal to avoid stack overflow on deeply unbalanced trees - Optimize EBTree::Add() and Remove() to use single-lookup TryEmplaced() instead of double-lookup UnBind()+Bind() / Contains()+operator() - Remove unused DEFINE_HUBTREE / DEFINE_HEBTREE / IMPLEMENT_HUBTREE / IMPLEMENT_HEBTREE macros - Remove unused includes from EBTree (Standard_Type, Standard_Transient, NCollection_List, Standard_Integer, NCollection_Sequence) - Fix doxygen @param tags and comment style NCollection_LocalArray: - Add move constructor and move assignment operators with optimized three-way branching (stack-stack copy, heap-heap swap, stack-heap steal) - Add Reallocate() method supporting grow-with-copy for use as a dynamically growable stack - Add static_assert enforcing trivially copyable element type NCollection_CellFilter: - Replace const_cast destructive-copy hack in Cell with proper move semantics; delete copy constructor and copy assignment - Add Cell constructor from CellIndex for lightweight lookup keys - Refactor add()/iterateAdd() to accept CellIndex instead of Cell, use TryEmplaced() for single-lookup cell insertion - Refactor remove()/inspect() to use Contained() API with const_cast instead of C-style cast on Seek() - Change ListNode default constructor from runtime throw to = delete - Use size_t for dimension loops and add dimension size guard in IsEqual - Remove SUN WorkShop 5.3 workaround - Fix typo "usially" -> "usually" in class documentation NCollection map API unification (Contained, TryEmplace, TryBind): - Add Contained() to all map types returning std::optional with std::reference_wrapper; key-only maps return const key ref, data maps return std::pair of const key ref + value ref - Add TryEmplace()/TryEmplaced() to NCollection_FlatMap and NCollection_IndexedMap for parity with NCollection_Map - Add TryBind() to NCollection_IndexedDataMap for parity with NCollection_DataMap and NCollection_FlatDataMap - Remove Seek()/ChangeSeek() from NCollection_Map (replaced by Contained()) Dead compiler workaround removal: - NCollection_DefineAlloc: remove Borland/SUN #if branch, keep only the version with placement delete - NCollection_SparseArrayBase: remove SUN WorkShop 5.3 workaround GTests: - Add move constructor/assignment tests for LocalArray, UBTree, EBTree - Add Contained tests for NCollection_Map - Add CellFilter tests and UBTree deep-unbalanced-tree stress test
This commit is contained in:
@@ -201,20 +201,30 @@ inline void Extrema_GGenExtCC_ChangeIntervals(occ::handle<NCollection_HArray1<do
|
||||
theInts = aNewInts;
|
||||
}
|
||||
|
||||
class Extrema_GGenExtCC_PointsInspector : public NCollection_CellFilter_InspectorXY
|
||||
class Extrema_GGenExtCC_PointsInspector
|
||||
{
|
||||
public:
|
||||
static constexpr int Dimension = 2;
|
||||
|
||||
typedef gp_XY Point;
|
||||
typedef gp_XY Target;
|
||||
|
||||
static double Coord(int i, const Point& thePnt) { return thePnt.Coord(i + 1); }
|
||||
|
||||
static Point Shift(const Point& thePnt, double theTol)
|
||||
{
|
||||
return Point(thePnt.X() + theTol, thePnt.Y() + theTol);
|
||||
}
|
||||
|
||||
Extrema_GGenExtCC_PointsInspector(const double theTol)
|
||||
: myTol(theTol * theTol),
|
||||
myIsFind(false)
|
||||
{
|
||||
myTol = theTol * theTol;
|
||||
myIsFind = false;
|
||||
}
|
||||
|
||||
void ClearFind() { myIsFind = false; }
|
||||
|
||||
bool isFind() { return myIsFind; }
|
||||
bool isFind() const { return myIsFind; }
|
||||
|
||||
void SetCurrent(const gp_XY& theCurPnt) { myCurrent = theCurPnt; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user