Public Member Functions | List of all members
ucxx::experimental::WorkerBuilder Class Reference

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

#include <worker_builder.h>

Public Member Functions

 WorkerBuilder (std::shared_ptr< Context > context)
 Constructor for WorkerBuilder with required context. More...
 
WorkerBuilderdelayedSubmission (bool enable=true)
 Configure delayed submission to the progress thread. More...
 
WorkerBuilderpythonFuture (bool enable=true)
 Configure Python future support. More...
 
std::shared_ptr< Workerbuild () const
 Build and return the Worker. More...
 
 operator std::shared_ptr< Worker > () const
 Implicit conversion operator to shared_ptr<Worker>. More...
 

Detailed Description

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

This class implements the builder pattern for std::shared_ptr<ucxx::Worker>, allowing optional parameters to be specified via method chaining. Construction happens when the builder expression completes (via implicit conversion) or when build() is called.

The context is required and must be provided to createWorker(). The enableDelayedSubmission() and enableFuture() methods are optional.

// Minimal usage (no options enabled)
auto worker = ucxx::experimental::createWorker(context).build();
// With optional parameters
auto worker = ucxx::experimental::createWorker(context)
.enableDelayedSubmission(true)
.enableFuture(true)
.build();
// Using implicit conversion
std::shared_ptr<ucxx::Worker> worker = ucxx::experimental::createWorker(context);
std::shared_ptr< Worker > build() const
Build and return the Worker.

Constructor & Destructor Documentation

◆ WorkerBuilder()

ucxx::experimental::WorkerBuilder::WorkerBuilder ( std::shared_ptr< Context context)
explicit

Constructor for WorkerBuilder with required context.

Parameters
[in]contextcontext from which the worker will be created (required).

Member Function Documentation

◆ build()

std::shared_ptr<Worker> ucxx::experimental::WorkerBuilder::build ( ) const

Build and return the Worker.

This method constructs the Worker with the specified parameters and returns it. Each call to build() creates a new Worker instance with the current parameters.

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

◆ delayedSubmission()

WorkerBuilder& ucxx::experimental::WorkerBuilder::delayedSubmission ( bool  enable = true)

Configure delayed submission to the progress thread.

Parameters
[in]enablewhether delayed submission is enabled (default: true).
Returns
Reference to this builder for method chaining.

◆ operator std::shared_ptr< Worker >()

ucxx::experimental::WorkerBuilder::operator std::shared_ptr< Worker > ( ) const

Implicit conversion operator to shared_ptr<Worker>.

This operator enables automatic construction of the Worker when the builder is used in a context requiring a shared_ptr<Worker>. This allows seamless use with auto variables.

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

◆ pythonFuture()

WorkerBuilder& ucxx::experimental::WorkerBuilder::pythonFuture ( bool  enable = true)

Configure Python future support.

Parameters
[in]enablewhether Python futures are enabled (default: true).
Returns
Reference to this builder for method chaining.

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