Thread System 0.3.1
High-performance C++20 thread pool with work stealing and DAG scheduling
Loading...
Searching...
No Matches
kcenon::thread::thread_context_builder Class Reference

Builder for thread_context with fluent interface. More...

#include <thread_context.h>

Collaboration diagram for kcenon::thread::thread_context_builder:
Collaboration graph

Public Member Functions

thread_context_builderwith_logger (std::shared_ptr< ILogger > logger)
 
thread_context_builderwith_monitoring (std::shared_ptr< IMonitor > monitoring)
 
thread_context_builderfrom_global_registry ()
 
thread_context build () const
 

Private Attributes

std::shared_ptr< ILoggerlogger_
 
std::shared_ptr< IMonitormonitoring_
 

Detailed Description

Builder for thread_context with fluent interface.

Note
Issue #261: Updated to use common_system's ILogger interface.
Issue #312: Updated to use common_system's IMonitor interface.

Definition at line 310 of file thread_context.h.

Member Function Documentation

◆ build()

thread_context kcenon::thread::thread_context_builder::build ( ) const
inline

Definition at line 328 of file thread_context.h.

328 {
329 return thread_context(logger_, monitoring_);
330 }
std::shared_ptr< ILogger > logger_
std::shared_ptr< IMonitor > monitoring_

References logger_, and monitoring_.

◆ from_global_registry()

thread_context_builder & kcenon::thread::thread_context_builder::from_global_registry ( )
inline

Definition at line 322 of file thread_context.h.

322 {
323 logger_ = common::interfaces::GlobalLoggerRegistry::instance().get_default_logger();
324 monitoring_ = service_container::global().resolve<common::interfaces::IMonitor>();
325 return *this;
326 }
static service_container & global()
Get the global service container instance.
std::shared_ptr< Interface > resolve()
Resolve a service.

References kcenon::thread::service_container::global(), logger_, monitoring_, and kcenon::thread::service_container::resolve().

Here is the call graph for this function:

◆ with_logger()

thread_context_builder & kcenon::thread::thread_context_builder::with_logger ( std::shared_ptr< ILogger > logger)
inline

Definition at line 312 of file thread_context.h.

312 {
313 logger_ = std::move(logger);
314 return *this;
315 }

References logger_.

◆ with_monitoring()

thread_context_builder & kcenon::thread::thread_context_builder::with_monitoring ( std::shared_ptr< IMonitor > monitoring)
inline

Definition at line 317 of file thread_context.h.

317 {
318 monitoring_ = std::move(monitoring);
319 return *this;
320 }

References monitoring_.

Member Data Documentation

◆ logger_

std::shared_ptr<ILogger> kcenon::thread::thread_context_builder::logger_
private

Definition at line 333 of file thread_context.h.

Referenced by build(), from_global_registry(), and with_logger().

◆ monitoring_

std::shared_ptr<IMonitor> kcenon::thread::thread_context_builder::monitoring_
private

Definition at line 334 of file thread_context.h.

Referenced by build(), from_global_registry(), and with_monitoring().


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