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 
43 class ContextBuilder final {
44  public:
50  explicit ContextBuilder(uint64_t featureFlags);
51 
56 
64  ContextBuilder& operator=(ContextBuilder&&) noexcept;
65 
74  operator std::shared_ptr<Context>();
75 
83 
92  [[nodiscard]] std::shared_ptr<Context> build();
93 
94  private:
95  struct Impl;
96  std::unique_ptr<Impl> _impl;
97 };
98 
123 [[nodiscard]] inline ContextBuilder contextBuilder(uint64_t featureFlags)
124 {
125  return ContextBuilder(featureFlags);
126 }
127 
128 } // namespace ucxx
Builder class for constructing std::shared_ptr<ucxx::Context> objects.
Definition: context_builder.h:43
~ContextBuilder()
ContextBuilder destructor.
ContextBuilder(uint64_t featureFlags)
Constructor for ContextBuilder with required feature flags.
ContextBuilder & configMap(ConfigMap configMap)
Set the configuration map for the context.
ContextBuilder & operator=(const ContextBuilder &other)
Copy assignment operator (deep-copies internal state).
std::shared_ptr< Context > build()
Build and return the Context.
ContextBuilder(const ContextBuilder &other)
Copy constructor (deep-copies internal state).
ContextBuilder(ContextBuilder &&) noexcept
Move constructor.
Component encapsulating the UCP context.
Definition: context.h:35
Definition: address.h:16
std::unordered_map< std::string, std::string > ConfigMap
A UCP configuration map.
Definition: typedefs.h:89
ContextBuilder contextBuilder(uint64_t featureFlags)
Create a ContextBuilder for constructing a shared_ptr<ucxx::Context>.
Definition: context_builder.h:123