1
+ #pragma once
2
+
3
+ #include < ucp/api/ucp.h>
4
+
5
+ #include < utility>
6
+ #include < vector>
7
+
8
+ namespace ucxpp {
9
+
10
+ /* *
11
+ * @brief Represents a remote UCX address.
12
+ *
13
+ */
14
+ class remote_address {
15
+ std::vector<char > address_;
16
+
17
+ public:
18
+ /* *
19
+ * @brief Construct a new remote address object
20
+ *
21
+ * @param address The received address buffer
22
+ */
23
+ remote_address (std::vector<char > const &address) : address_(address) {}
24
+
25
+ /* *
26
+ * @brief Construct a new remote address object
27
+ *
28
+ * @param address Another remote address object to move from
29
+ */
30
+ remote_address (std::vector<char > &&address) : address_(std::move(address)) {}
31
+
32
+ /* *
33
+ * @brief Move construct a new remote address object
34
+ *
35
+ * @param other Another remote address object to move from
36
+ */
37
+ remote_address (remote_address &&other) = default ;
38
+
39
+ /* *
40
+ * @brief Construct a new remote address object
41
+ *
42
+ * @param other Another remote address object to copy from
43
+ */
44
+ remote_address (remote_address const &other) = default ;
45
+
46
+ /* *
47
+ * @brief Copy assignment operator
48
+ *
49
+ * @param other Another remote address object to copy from
50
+ * @return remote_address& This object
51
+ */
52
+ remote_address &operator =(remote_address const &other) = default ;
53
+
54
+ /* *
55
+ * @brief Move assignment operator
56
+ *
57
+ * @param other Another remote address object to move from
58
+ * @return remote_address& This object
59
+ */
60
+ remote_address &operator =(remote_address &&other) = default ;
61
+
62
+ /* *
63
+ * @brief Get the UCP address
64
+ *
65
+ * @return const ucp_address_t* The UCP address
66
+ */
67
+ const ucp_address_t *get_address () const {
68
+ return reinterpret_cast <const ucp_address_t *>(address_.data ());
69
+ }
70
+
71
+ /* *
72
+ * @brief Get the length of the address
73
+ *
74
+ * @return size_t The length of the address
75
+ */
76
+ size_t get_length () const { return address_.size (); }
77
+ };
78
+
79
+ } // namespace ucxpp
0 commit comments