Loading...
Searching...
No Matches
ucxx::ListenerBuilder Class Referencefinal

Builder class for constructing std::shared_ptr<ucxx::Listener> objects. More...

#include <listener_builder.h>

Public Member Functions

 ListenerBuilder (std::shared_ptr< Worker > worker, uint16_t port, ucp_listener_conn_callback_t callback, void *callbackArgs)
 Constructor for ListenerBuilder.
 ~ListenerBuilder ()
 ListenerBuilder destructor.
 ListenerBuilder (const ListenerBuilder &other)
 Copy constructor (deep-copies internal state).
ListenerBuilder & operator= (const ListenerBuilder &other)
 Copy assignment operator (deep-copies internal state).
 ListenerBuilder (ListenerBuilder &&) noexcept
 Move constructor.
ListenerBuilder & operator= (ListenerBuilder &&) noexcept
 Move assignment operator.
 operator std::shared_ptr< Listener > ()
 Implicit conversion operator to shared_ptr<Listener>.
ListenerBuilder & host (std::string host)
 Set the hostname or IP address the listener should bind to.
std::shared_ptr< Listener > build ()
 Build and return the Listener.

Detailed Description

Builder class for constructing std::shared_ptr<ucxx::Listener> objects.

This class implements the builder pattern for std::shared_ptr<ucxx::Listener>. Construction happens when build() is called or when the builder is implicitly converted to std::shared_ptr<Listener>.

Constructor & Destructor Documentation

◆ ListenerBuilder()

ucxx::ListenerBuilder::ListenerBuilder ( std::shared_ptr< Worker > worker,
uint16_t port,
ucp_listener_conn_callback_t callback,
void * callbackArgs )

Constructor for ListenerBuilder.

Parameters
[in]workerworker from which to create the listener.
[in]portport which the listener should bind to.
[in]callbackcallback to execute on incoming connections.
[in]callbackArgsargument to pass to the callback.

Member Function Documentation

◆ build()

std::shared_ptr< Listener > ucxx::ListenerBuilder::build ( )
nodiscard

Build and return the Listener.

Each call to build() creates a new Listener instance with the current parameters.

Returns
The constructed shared_ptr<ucxx::Listener> object.

◆ host()

ListenerBuilder & ucxx::ListenerBuilder::host ( std::string host)

Set the hostname or IP address the listener should bind to.

By default the listener binds to all interfaces (wildcard). Use this to restrict the listener to a specific interface, e.g., "127.0.0.1" to accept connections from the local host only.

Parameters
[in]hosthostname or IP address the listener should bind to, an empty string binds to all interfaces.
Returns
Reference to this builder for method chaining.

◆ operator std::shared_ptr< Listener >()

ucxx::ListenerBuilder::operator std::shared_ptr< Listener > ( )

Implicit conversion operator to shared_ptr<Listener>.

Returns
The constructed shared_ptr<ucxx::Listener> object.

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