context_builder.h
1 
5 #pragma once
6 
7 #include <memory>
8 
9 #include <ucxx/typedefs.h>
10 
11 namespace ucxx {
12 
13 // Forward declarations
14 class Context;
15 
16 namespace experimental {
17 
42 class ContextBuilder final {
43  public:
49  explicit ContextBuilder(uint64_t featureFlags);
50 
55 
63  ContextBuilder& operator=(ContextBuilder&&) noexcept;
64 
73  operator std::shared_ptr<Context>() const;
74 
82 
91  [[nodiscard]] std::shared_ptr<Context> build() const;
92 
93  private:
94  struct Impl;
95  std::unique_ptr<Impl> _impl;
96 };
97 
122 inline ContextBuilder createContext(uint64_t featureFlags) { return ContextBuilder(featureFlags); }
123 
124 } // namespace experimental
125 
126 } // namespace ucxx
Component encapsulating the UCP context.
Definition: context.h:35
Builder class for constructing std::shared_ptr<ucxx::Context> objects.
Definition: context_builder.h:42
ContextBuilder & operator=(const ContextBuilder &other)
Copy assignment operator (deep-copies internal state).
ContextBuilder(ContextBuilder &&) noexcept
Move constructor.
ContextBuilder(uint64_t featureFlags)
Constructor for ContextBuilder with required feature flags.
ContextBuilder & configMap(ConfigMap configMap)
Set the configuration map for the context.
~ContextBuilder()
ContextBuilder destructor.
ContextBuilder(const ContextBuilder &other)
Copy constructor (deep-copies internal state).
std::shared_ptr< Context > build() const
Build and return the Context.
Definition: address.h:16
std::unordered_map< std::string, std::string > ConfigMap
A UCP configuration map.
Definition: typedefs.h:89
std::shared_ptr< Context > createContext(const ConfigMap ucxConfig, const uint64_t featureFlags)
Constructor of shared_ptr<ucxx::Context> with parameters.