All Classes Namespaces Functions Variables Typedefs Enumerations Friends
address.h
1 
5 #pragma once
6 
7 #include <memory>
8 #include <string>
9 
10 #include <ucp/api/ucp.h>
11 
12 #include <ucxx/component.h>
13 #include <ucxx/worker.h>
14 
15 namespace ucxx {
16 
23 class Address : public Component {
24  private:
25  ucp_address_t* _handle{nullptr};
26  size_t _length{0};
27 
45  Address(std::shared_ptr<Worker> worker, ucp_address_t* address, size_t length);
46 
47  public:
48  Address() = delete;
49  Address(const Address&) = delete;
50  Address& operator=(Address const&) = delete;
51  Address(Address&& o) = delete;
52  Address& operator=(Address&& o) = delete;
53 
54  ~Address();
55 
66  [[nodiscard]] friend std::shared_ptr<Address> createAddressFromWorker(
67  std::shared_ptr<Worker> worker);
68 
79  [[nodiscard]] friend std::shared_ptr<Address> createAddressFromString(std::string addressString);
80 
96  [[nodiscard]] ucp_address_t* getHandle() const;
97 
106  [[nodiscard]] size_t getLength() const;
107 
116  [[nodiscard]] std::string getString() const;
117 };
118 
119 } // namespace ucxx
Component encapsulating the address of a UCP worker.
Definition: address.h:23
size_t getLength() const
Get the length of the ucp_address_t* handle.
friend std::shared_ptr< Address > createAddressFromString(std::string addressString)
Constructor for shared_ptr<ucxx::Address> from string.
ucp_address_t * getHandle() const
Get the underlying ucp_address_t* handle.
friend std::shared_ptr< Address > createAddressFromWorker(std::shared_ptr< Worker > worker)
Constructor for shared_ptr<ucxx::Address> from worker.
std::string getString() const
Get the address as a string.
A UCXX component class to prevent early destruction of parent object.
Definition: component.h:17
Definition: address.h:15