Skip to content
Welcome to the new CppUtils documentation!

Graph node wrapper managing cyclic references deterministically via root-distance tracking.

Template parameterDescription
TPayload type stored inside the node.
using CppUtils::Container::NetworkPtr<T>::Value = T;
using CppUtils::Container::NetworkPtr<T>::SharedPtr = SafeShared<NetworkPtr<T>>;
using CppUtils::Container::NetworkPtr<T>::WeakPtr = SafeWeak<NetworkPtr<T>>;
using CppUtils::Container::NetworkPtr<T>::Accessor = Thread::Accessor<NetworkPtr<T>, Thread::SharedMutex>;
T value;
constexpr NetworkPtr::~NetworkPtr();

Detaches all children and parents upon destruction.

[[nodiscard]] constexpr auto NetworkPtr::isRoot() const noexcept -> bool;

Returns true if this node is marked as a root.

[[nodiscard]] constexpr auto NetworkPtr::isTemporary() const noexcept -> bool;

Returns true if this node is neither a root nor attached to any parent.

constexpr auto NetworkPtr::setRoot(bool isRoot) noexcept -> void;

Marks or unmarks this node as a root.

constexpr auto NetworkPtr::setWeakThis(WeakPtr pointer) noexcept -> void;

Stores the weak self-reference used when registering parent/child links.

[[nodiscard]] constexpr auto NetworkPtr::getDistanceFromRoot() const noexcept -> std::size_t;

Returns the shortest hop distance from any root node (or max() if unreachable).

constexpr auto NetworkPtr::attachChild(NetworkPtr& childValue) -> void;

Attaches childValue as a child of this node, promoting or demoting the link strength based on root distance.

ParameterDescription
std::logic_errorif the child handle is expired or this parent has no root path.
constexpr auto NetworkPtr::detachChild(NetworkPtr& childValue) -> void;

Detaches childValue from this node and updates root distances across affected descendants.

ParameterDescription
childValueChild node to unlink from this parent.
constexpr auto NetworkPtr::detachChildren() -> void;

Detaches all children from this node and updates root distances across affected descendants.

constexpr auto NetworkPtr::detachParent(SharedPtr& parent) -> void;

Detaches this node from parent.

ParameterDescription
parentParent node handle to unlink from.
constexpr auto NetworkPtr::detachParents() -> void;

Removes all back-references to this node from its registered parents.

[[nodiscard]] static constexpr auto NetworkPtr::make(auto&&... args) -> SharedPtr;

Allocates a non-root node wrapped in a SafeShared.

ParameterDescription
argsArguments forwarded to construct T.
[[nodiscard]] static constexpr auto NetworkPtr::makeRoot(auto&&... args) -> SharedPtr;

Allocates a root node wrapped in a SafeShared.

ParameterDescription
argsArguments forwarded to construct T.