File indexing completed on 2026-09-28 09:19:34
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef _BRepGraph_Cache_HeaderFile
0015 #define _BRepGraph_Cache_HeaderFile
0016
0017 #include <BRepGraph_ItemId.hxx>
0018 #include <BRepGraph_NodeId.hxx>
0019 #include <BRepGraph_RefId.hxx>
0020 #include <Standard_GUID.hxx>
0021 #include <Standard_Handle.hxx>
0022 #include <Standard_Transient.hxx>
0023 #include <TCollection_AsciiString.hxx>
0024
0025 #include <cstdint>
0026
0027 class BRepGraph;
0028 class BRepGraph_CacheRegistry;
0029 class BRepGraph_CopyRemap;
0030
0031
0032
0033
0034
0035
0036
0037 class BRepGraph_Cache : public Standard_Transient
0038 {
0039 public:
0040
0041 [[nodiscard]] virtual const Standard_GUID& ID() const = 0;
0042
0043
0044 [[nodiscard]] virtual const TCollection_AsciiString& Name() const = 0;
0045
0046
0047 Standard_EXPORT virtual void Clear() noexcept;
0048
0049
0050
0051 Standard_EXPORT virtual void CopyFreshTo(const BRepGraph_CopyRemap& theCopy) const;
0052
0053 DEFINE_STANDARD_RTTIEXT(BRepGraph_Cache, Standard_Transient)
0054
0055 protected:
0056
0057
0058
0059
0060
0061 class NodeEntry
0062 {
0063 public:
0064
0065 Standard_EXPORT void Reset() noexcept;
0066
0067
0068
0069 [[nodiscard]] Standard_EXPORT bool BindOwnGen(const BRepGraph_Cache& theCache,
0070 const BRepGraph_NodeId theNode) noexcept;
0071
0072
0073
0074 [[nodiscard]] Standard_EXPORT bool BindSubtreeGen(const BRepGraph_Cache& theCache,
0075 const BRepGraph_NodeId theNode) noexcept;
0076
0077
0078 [[nodiscard]] Standard_EXPORT bool IsFreshOwn(const BRepGraph_Cache& theCache,
0079 const BRepGraph_NodeId theNode) const noexcept;
0080
0081
0082 [[nodiscard]] Standard_EXPORT bool IsFreshSubtree(
0083 const BRepGraph_Cache& theCache,
0084 const BRepGraph_NodeId theNode) const noexcept;
0085
0086
0087 [[nodiscard]] Standard_EXPORT bool IsFresh(const BRepGraph_Cache& theCache) const noexcept;
0088
0089
0090 [[nodiscard]] bool IsBound() const noexcept { return myKind != GenKind::None; }
0091
0092
0093 [[nodiscard]] BRepGraph_NodeId Node() const noexcept { return myNode; }
0094
0095 private:
0096 enum class GenKind : uint8_t
0097 {
0098 None,
0099 Own,
0100 Subtree
0101 };
0102
0103 [[nodiscard]] Standard_EXPORT bool bind(const BRepGraph_Cache& theCache,
0104 const BRepGraph_NodeId theNode,
0105 const GenKind theKind) noexcept;
0106
0107 [[nodiscard]] Standard_EXPORT bool isFresh(const BRepGraph_Cache& theCache,
0108 const BRepGraph_NodeId theNode,
0109 const GenKind theKind) const noexcept;
0110
0111 BRepGraph_NodeId myNode;
0112 uint32_t myGeneration = 0;
0113 GenKind myKind = GenKind::None;
0114 };
0115
0116
0117 class RefEntry
0118 {
0119 public:
0120
0121 Standard_EXPORT void Reset() noexcept;
0122
0123
0124
0125 [[nodiscard]] Standard_EXPORT bool BindOwnGen(const BRepGraph_Cache& theCache,
0126 const BRepGraph_RefId theRef) noexcept;
0127
0128
0129 [[nodiscard]] Standard_EXPORT bool IsFreshOwn(const BRepGraph_Cache& theCache,
0130 const BRepGraph_RefId theRef) const noexcept;
0131
0132
0133 [[nodiscard]] Standard_EXPORT bool IsFresh(const BRepGraph_Cache& theCache) const noexcept;
0134
0135
0136 [[nodiscard]] bool IsBound() const noexcept { return myIsBound; }
0137
0138
0139 [[nodiscard]] BRepGraph_RefId Ref() const noexcept { return myRef; }
0140
0141 private:
0142 BRepGraph_RefId myRef;
0143 uint32_t myGeneration = 0;
0144 bool myIsBound = false;
0145 };
0146
0147
0148 class ItemEntry
0149 {
0150 public:
0151
0152 Standard_EXPORT void Reset() noexcept;
0153
0154
0155
0156 [[nodiscard]] Standard_EXPORT bool BindOwnGen(const BRepGraph_Cache& theCache,
0157 const BRepGraph_ItemId theItem) noexcept;
0158
0159
0160 [[nodiscard]] Standard_EXPORT bool IsFreshOwn(const BRepGraph_Cache& theCache,
0161 const BRepGraph_ItemId theItem) const noexcept;
0162
0163
0164 [[nodiscard]] Standard_EXPORT bool IsFresh(const BRepGraph_Cache& theCache) const noexcept;
0165
0166
0167 [[nodiscard]] bool IsBound() const noexcept { return myIsBound; }
0168
0169
0170 [[nodiscard]] BRepGraph_ItemId Item() const noexcept { return myItem; }
0171
0172 private:
0173 BRepGraph_ItemId myItem;
0174 uint32_t myGeneration = 0;
0175 bool myIsBound = false;
0176 };
0177
0178 Standard_EXPORT BRepGraph_Cache();
0179
0180
0181 [[nodiscard]] bool IsAttached() const noexcept { return myGraph != nullptr; }
0182
0183
0184 [[nodiscard]] Standard_EXPORT const BRepGraph& Graph() const;
0185
0186
0187 [[nodiscard]] BRepGraph* AttachedGraph() const noexcept { return myGraph; }
0188
0189
0190 Standard_EXPORT virtual void OnAttached() noexcept;
0191
0192
0193 Standard_EXPORT virtual void OnDetached() noexcept;
0194
0195
0196 [[nodiscard]] Standard_EXPORT bool NodeSubtreeGen(const BRepGraph_NodeId theNode,
0197 uint32_t& theGen) const noexcept;
0198
0199
0200 [[nodiscard]] Standard_EXPORT bool NodeOwnGen(const BRepGraph_NodeId theNode,
0201 uint32_t& theGen) const noexcept;
0202
0203
0204 [[nodiscard]] Standard_EXPORT bool RefOwnGen(const BRepGraph_RefId theRef,
0205 uint32_t& theGen) const noexcept;
0206
0207
0208 [[nodiscard]] Standard_EXPORT bool ItemOwnGen(const BRepGraph_ItemId theItem,
0209 uint32_t& theGen) const noexcept;
0210
0211
0212 [[nodiscard]] Standard_EXPORT bool ResolveActiveRefChild(
0213 const BRepGraph_RefId theRef,
0214 BRepGraph_NodeId& theNode) const noexcept;
0215
0216
0217 [[nodiscard]] Standard_EXPORT bool ResolveActiveFaceRef(const BRepGraph_FaceRefId theRef,
0218 BRepGraph_FaceId& theFace) const noexcept;
0219
0220 private:
0221 friend class ::BRepGraph_CacheRegistry;
0222
0223 Standard_EXPORT void attachGraph(BRepGraph* theGraph) noexcept;
0224 Standard_EXPORT void rebindGraph(BRepGraph* theGraph) noexcept;
0225 Standard_EXPORT void detachGraph() noexcept;
0226
0227 BRepGraph* myGraph = nullptr;
0228 };
0229
0230 #endif