Loading...
Searching...
No Matches
ucxx::Address Class Reference

Component encapsulating the address of a UCP worker. More...

#include <address.h>

Inheritance diagram for ucxx::Address:
ucxx::Component

Public Member Functions

 Address (const Address &)=delete
Address & operator= (Address const &)=delete
 Address (Address &&o)=delete
Address & operator= (Address &&o)=delete
ucp_address_t * getHandle () const
 Get the underlying ucp_address_t* handle.
size_t getLength () const
 Get the length of the ucp_address_t* handle.
std::string_view getStringView () const
 Get a non-owning view of the address as a string.
Public Member Functions inherited from ucxx::Component
void setParent (std::shared_ptr< Component > parent)
 Set the internal parent reference.
std::shared_ptr< Component > getParent () const
 Get the internal parent reference.

Friends

class detail::ConstructorFactory

Additional Inherited Members

Protected Attributes inherited from ucxx::Component
std::shared_ptr< Component > _parent {nullptr}
 A reference-counted pointer to the parent.

Detailed Description

Component encapsulating the address of a UCP worker.

A UCP worker has a unique address that can is contained in a ucp_address_t* object, this class encapsulates that object and provides methods to simplify its handling.

Member Function Documentation

◆ getHandle()

ucp_address_t * ucxx::Address::getHandle ( ) const
nodiscard

Get the underlying ucp_address_t* handle.

Lifetime of the ucp_address_t* handle is managed by the ucxx::Address object and its ownership is non-transferrable. Once the ucxx::Address is destroyed the handle is not valid anymore, it is the user's responsibility to ensure the owner's lifetime while using the handle.

// address is `std::shared_ptr<ucxx::Address>`
ucp_address_t* addressHandle = address->getHandle();
Returns
The underlying ucp_address_t handle.

◆ getLength()

size_t ucxx::Address::getLength ( ) const
nodiscard

Get the length of the ucp_address_t* handle.

Get the length of the ucp_address_t* handle, required to access the complete address and prevent reading out-of-bound.

Returns
The length of the ucp_address_t* handle in bytes.

◆ getStringView()

std::string_view ucxx::Address::getStringView ( ) const
nodiscard

Get a non-owning view of the address as a string.

Convenience method to view the underlying address as a std::string_view and return it as a single object.

Note
If the user would like to own the object, they can pass the result to std::string, which will copy the memory.
Returns
The underlying ucp_address_t handle.

The documentation for this class was generated from the following file: