UCX++
address.h
1#pragma once
2
3#include <memory>
4#include <vector>
5
6#include <ucp/api/ucp.h>
7
8#include "ucxpp/task.h"
9
10#include "ucxpp/detail/noncopyable.h"
11namespace ucxpp {
12
13class worker;
14
19class local_address : public noncopyable {
20 std::shared_ptr<worker const> worker_;
21 ucp_address_t *address_;
22 size_t address_length_;
23 friend class endpoint;
24
25public:
33 local_address(std::shared_ptr<worker const> worker, ucp_address_t *address,
34 size_t address_length);
35
42
50
56 std::vector<char> serialize() const;
57
63 const ucp_address_t *get_address() const;
64
70 size_t get_length() const;
71
77};
78
84 std::vector<char> address_;
85
86public:
92 remote_address(std::vector<char> const &address);
93
99 remote_address(std::vector<char> &&address);
100
106 remote_address(remote_address &&other) = default;
107
113 remote_address(remote_address const &other) = default;
114
121 remote_address &operator=(remote_address const &other) = default;
122
130
136 const ucp_address_t *get_address() const;
137
143 size_t get_length() const;
144};
145
146} // namespace ucxpp
Abstraction for a UCX endpoint.
Definition: endpoint.h:27
Represents a local UCX address.
Definition: address.h:19
const ucp_address_t * get_address() const
Get the UCP address.
Definition: address.cc:43
local_address & operator=(local_address &&other)
Move assignment operator.
Definition: address.cc:28
local_address(std::shared_ptr< worker const > worker, ucp_address_t *address, size_t address_length)
Construct a new local address object.
Definition: address.cc:19
~local_address()
Destroy the local address object and release the buffer.
Definition: address.cc:47
std::vector< char > serialize() const
Serialize the address to a buffer ready to be sent to a remote peer.
Definition: address.cc:35
size_t get_length() const
Get the length of the address.
Definition: address.cc:45
Definition: noncopyable.h:5
Represents a remote UCX address.
Definition: address.h:83
remote_address(remote_address const &other)=default
Construct a new remote address object.
remote_address & operator=(remote_address const &other)=default
Copy assignment operator.
remote_address & operator=(remote_address &&other)=default
Move assignment operator.
remote_address(std::vector< char > const &address)
Construct a new remote address object.
Definition: address.cc:54
remote_address(remote_address &&other)=default
Move construct a new remote address object.
size_t get_length() const
Get the length of the address.
Definition: address.cc:64
const ucp_address_t * get_address() const
Get the UCP address.
Definition: address.cc:60
Abstraction for a UCX worker.
Definition: worker.h:20