#include <userver/utils/resource_scopes.hpp>
Smart collection of ScopePtr. It is a helper class used in component system or in a component-less unit tests.
Definition at line 68 of file resource_scopes.hpp.
Public Member Functions | |
| template<typename AfterConstructionCallback> | |
| void | Register (AfterConstructionCallback after_construction) |
| Registers a functor to register some resource that will be called after the component is successfully created (including all class descendants) or after the component creation is emulated in unit tests. The functor must return a RAII-style handle object that unregisters the previously registered resource. The returned handle's destructor is called just before the component destructor is called. | |
| void | AfterConstruction () |
| Call all registered functors. | |
| void | BeforeDestruction () |
| Free all unregister previously rgistered resources. | |
|
inline |
Registers a functor to register some resource that will be called after the component is successfully created (including all class descendants) or after the component creation is emulated in unit tests. The functor must return a RAII-style handle object that unregisters the previously registered resource. The returned handle's destructor is called just before the component destructor is called.
Definition at line 83 of file resource_scopes.hpp.