File indexing completed on 2026-09-28 09:19:37
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef _BRepGraph_SupplementIterator_HeaderFile
0015 #define _BRepGraph_SupplementIterator_HeaderFile
0016
0017 #include <BRepGraph.hxx>
0018 #include <BRepGraph_LayerRegistry.hxx>
0019 #include <BRepGraph_LayerTopoSupplement.hxx>
0020 #include <NCollection_ForwardRange.hxx>
0021
0022
0023
0024
0025
0026
0027 class BRepGraph_SupplementIterator
0028 {
0029 public:
0030
0031
0032
0033 explicit BRepGraph_SupplementIterator(const BRepGraph& theGraph, const BRepGraph_NodeId theOwner)
0034 : myLayer(theGraph.LayerRegistry().FindLayer<BRepGraph_LayerTopoSupplement>()),
0035 myUids(myLayer.IsNull() ? nullptr : &myLayer->AttachedTo(theOwner))
0036 {
0037 skipInvalid();
0038 }
0039
0040
0041 [[nodiscard]] bool More() const
0042 {
0043 return myUids != nullptr && myEntry != nullptr && myIndex < myUids->Size();
0044 }
0045
0046
0047 void Next()
0048 {
0049 ++myIndex;
0050 skipInvalid();
0051 }
0052
0053
0054 [[nodiscard]] uint64_t Uid() const { return More() ? myUids->Value(myIndex) : uint64_t(0); }
0055
0056
0057 [[nodiscard]] const BRepGraph_LayerTopoSupplement::Entry& Value() const { return *myEntry; }
0058
0059
0060 NCollection_ForwardRangeIterator<BRepGraph_SupplementIterator> begin()
0061 {
0062 return NCollection_ForwardRangeIterator<BRepGraph_SupplementIterator>(this);
0063 }
0064
0065
0066 NCollection_ForwardRangeSentinel end() const { return NCollection_ForwardRangeSentinel{}; }
0067
0068 private:
0069
0070 Standard_EXPORT void skipInvalid();
0071
0072 private:
0073 occ::handle<BRepGraph_LayerTopoSupplement> myLayer;
0074 const NCollection_LinearVector<uint64_t>* myUids = nullptr;
0075 const BRepGraph_LayerTopoSupplement::Entry* myEntry = nullptr;
0076 size_t myIndex = 0;
0077 };
0078
0079 #endif