Component#

2026-03-31

2 min read time

Applies to Linux

The ucxx::Component class is the base class for all UCXX objects that participate in the ownership hierarchy. It provides parent-child relationship management to ensure correct lifetime ordering of UCXX objects.

#include <ucxx/component.h>

namespace ucxx

class Component : public std::enable_shared_from_this<Component>#

A UCXX component class to prevent early destruction of parent object.

A UCXX component class storing a pointer of its parent to prevent it from being destroyed while child is still alive.

Subclassed by ucxx::Address, ucxx::Context, ucxx::Endpoint, ucxx::Listener, ucxx::MemoryHandle, ucxx::RemoteKey, ucxx::Request, ucxx::Worker

Public Functions

void setParent(
std::shared_ptr<Component> parent
)#

Set the internal parent reference.

Set the internal parent reference.

Parameters:

parent[in] the reference-counted pointer to the parent.

std::shared_ptr<Component> getParent(
) const#

Get the internal parent reference.

Get the internal parent reference.

Returns:

the reference-counted pointer to the parent.