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

RAII helper for scoped service registration. More...

#include <service_container.h>

Collaboration diagram for kcenon::thread::scoped_service< Interface >:
Collaboration graph

Public Member Functions

 scoped_service (std::shared_ptr< Interface > service)
 
 ~scoped_service ()
 

Detailed Description

template<typename Interface>
class kcenon::thread::scoped_service< Interface >

RAII helper for scoped service registration.

Definition at line 168 of file service_container.h.

Constructor & Destructor Documentation

◆ scoped_service()

template<typename Interface >
kcenon::thread::scoped_service< Interface >::scoped_service ( std::shared_ptr< Interface > service)
inline

Definition at line 170 of file service_container.h.

170 {
171 service_container::global().register_singleton<Interface>(service);
172 }
void register_singleton(std::shared_ptr< Implementation > instance)
Register a service with singleton lifetime.
static service_container & global()
Get the global service container instance.

References kcenon::thread::service_container::global(), and kcenon::thread::service_container::register_singleton().

Here is the call graph for this function:

◆ ~scoped_service()

template<typename Interface >
kcenon::thread::scoped_service< Interface >::~scoped_service ( )
inline

Definition at line 174 of file service_container.h.

174 {
175 // Note: In a real implementation, you might want to support unregistration
176 // For now, services remain registered for the application lifetime
177 }

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