OpenSourceSimWheelESP32
Open-source wireless steering wheel/button box for ESP32 boards
Loading...
Searching...
No Matches
DependencyManager< Service > Struct Template Reference

Dependency Manager. More...

#include <InternalServices.hpp>

Static Public Member Functions

static Service & call ()
 Get the service provider implementing the service.
 
template<class Provider , typename... _Args>
static void inject (_Args &&...__args)
 Inject a service provider.
 
static void inject (Service *provider)
 Inject a service provider.
 
static void reset ()
 Remove the injected service provider (for testing)
 

Detailed Description

template<typename Service>
struct DependencyManager< Service >

Dependency Manager.

Template Parameters
ServiceService interface

Definition at line 32 of file InternalServices.hpp.

Member Function Documentation

◆ call()

template<typename Service >
static Service & DependencyManager< Service >::call ( )
inlinestatic

Get the service provider implementing the service.

Returns
Service& Service provider

Definition at line 39 of file InternalServices.hpp.

◆ inject() [1/2]

template<typename Service >
template<class Provider , typename... _Args>
static void DependencyManager< Service >::inject ( _Args &&... __args)
inlinestatic

Inject a service provider.

Template Parameters
ProviderService provider class
_ArgsConstructor parameter types
Parameters
__argsConstructor parameters

Definition at line 63 of file InternalServices.hpp.

◆ inject() [2/2]

template<typename Service >
static void DependencyManager< Service >::inject ( Service * provider)
inlinestatic

Inject a service provider.

Parameters
providerService provider instance. Must live forever.

Definition at line 77 of file InternalServices.hpp.

◆ reset()

template<typename Service >
static void DependencyManager< Service >::reset ( )
inlinestatic

Remove the injected service provider (for testing)

Warning
For testing only. Do not call in production code. May cause memory leaks.

Definition at line 97 of file InternalServices.hpp.


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