Loading...
Searching...
No Matches
endpoint_builder.h
1
5#pragma once
6
7#include <cstdint>
8#include <memory>
9#include <string>
10#include <utility>
11
12#include <ucp/api/ucp.h>
13
14namespace ucxx {
15
16class Address;
17class Endpoint;
18class Listener;
19class Worker;
20
28class EndpointBuilder final {
29 public:
37 EndpointBuilder(std::shared_ptr<Worker> worker, std::string ipAddress, uint16_t port);
38
45 EndpointBuilder(std::shared_ptr<Listener> listener, ucp_conn_request_h connRequest);
46
53 EndpointBuilder(std::shared_ptr<Worker> worker, std::shared_ptr<Address> address);
54
57
65 EndpointBuilder& operator=(EndpointBuilder&&) noexcept;
66
72 operator std::shared_ptr<Endpoint>();
73
81
89 [[nodiscard]] std::shared_ptr<Endpoint> build();
90
91 private:
92 struct Impl;
93 std::unique_ptr<Impl> _impl;
94};
95
104[[nodiscard]] inline EndpointBuilder endpointBuilder(std::shared_ptr<Worker> worker,
105 std::string ipAddress,
106 uint16_t port)
107{
108 return EndpointBuilder(std::move(worker), std::move(ipAddress), port);
109}
110
118[[nodiscard]] inline EndpointBuilder endpointBuilder(std::shared_ptr<Listener> listener,
119 ucp_conn_request_h connRequest)
120{
121 return EndpointBuilder(std::move(listener), connRequest);
122}
123
131[[nodiscard]] inline EndpointBuilder endpointBuilder(std::shared_ptr<Worker> worker,
132 std::shared_ptr<Address> address)
133{
134 return EndpointBuilder(std::move(worker), std::move(address));
135}
136
137} // namespace ucxx
Component encapsulating the address of a UCP worker.
Definition address.h:26
Builder class for constructing std::shared_ptr<ucxx::Endpoint> objects.
Definition endpoint_builder.h:28
EndpointBuilder & operator=(const EndpointBuilder &other)
Copy assignment operator (deep-copies internal state).
EndpointBuilder & endpointErrorHandling(bool enable=true)
Configure endpoint error handling.
EndpointBuilder(std::shared_ptr< Worker > worker, std::shared_ptr< Address > address)
Constructor for EndpointBuilder from a worker address.
EndpointBuilder(std::shared_ptr< Worker > worker, std::string ipAddress, uint16_t port)
Constructor for EndpointBuilder from hostname and port.
EndpointBuilder(EndpointBuilder &&) noexcept
Move constructor.
EndpointBuilder(const EndpointBuilder &other)
Copy constructor (deep-copies internal state).
~EndpointBuilder()
EndpointBuilder destructor.
std::shared_ptr< Endpoint > build()
Build and return the Endpoint.
EndpointBuilder(std::shared_ptr< Listener > listener, ucp_conn_request_h connRequest)
Constructor for EndpointBuilder from a connection request.
Component encapsulating a UCP endpoint.
Definition endpoint.h:69
Component encapsulating a UCP listener.
Definition listener.h:26
Component encapsulating a UCP worker.
Definition worker.h:62
Definition address.h:16
EndpointBuilder endpointBuilder(std::shared_ptr< Worker > worker, std::string ipAddress, uint16_t port)
Create an EndpointBuilder from hostname and port.
Definition endpoint_builder.h:104