Class to retrieve other components.  
 More...
#include <userver/components/component_context.hpp>
 | 
| template<typename T >  | 
| T &  | FindComponent () const | 
|   | Finds a component of type T with specified name (if any) and returns the component after it was initialized.  
  | 
|   | 
| template<typename T >  | 
| T &  | FindComponent (std::string_view name) const | 
|   | 
| template<typename T >  | 
| T &  | FindComponent (std::string_view={}) | 
|   | 
| template<typename T >  | 
| T *  | FindComponentOptional () const | 
|   | If there's no component with specified type and name return nullptr; otherwise behaves as FindComponent().  
  | 
|   | 
| template<typename T >  | 
| T *  | FindComponentOptional (std::string_view name) const | 
|   | 
| template<typename T >  | 
| T &  | FindComponentOptional (std::string_view={}) | 
|   | 
| 
engine::TaskProcessor &  | GetTaskProcessor (const std::string &name) const | 
|   | Returns an engine::TaskProcessor with the specified name. 
  | 
|   | 
| template<typename T >  | 
| engine::TaskProcessor &  | GetTaskProcessor (const T &) | 
|   | 
| 
const Manager &  | GetManager () const | 
|   | 
| bool  | IsAnyComponentInFatalState () const | 
|   | 
Class to retrieve other components. 
Only the const member functions of this class are meant for usage in component constructor (because of that this class is always passed as a const reference to the constructors).
- See also
 - Components 
 
- Examples
 - components/component_sample_test.cpp, components/component_sample_test.hpp, postgresql/functional_tests/basic_chaos/postgres_service.cpp, samples/config_service/config_service.cpp, samples/flatbuf_service/flatbuf_service.cpp, samples/grpc_service/grpc_service.cpp, samples/http_caching/http_caching.cpp, samples/mongo_service/mongo_service.cpp, samples/postgres_service/postgres_service.cpp, samples/redis_service/redis_service.cpp, samples/tcp_full_duplex_service/tcp_full_duplex_service.cpp, samples/tcp_service/tcp_service.cpp, samples/testsuite-support/src/metrics.cpp, samples/testsuite-support/src/metrics.hpp, and samples/testsuite-support/src/tasks.cpp.
 
Definition at line 64 of file component_context.hpp.
 
◆ FindComponent() [1/3]
template<typename T > 
  
  
      
        
          | T & components::ComponentContext::FindComponent  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
 
◆ FindComponent() [2/3]
template<typename T > 
  
  
      
        
          | T & components::ComponentContext::FindComponent  | 
          ( | 
          std::string_view  | 
          name | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
 
◆ FindComponent() [3/3]
template<typename T > 
  
  
      
        
          | T & components::ComponentContext::FindComponent  | 
          ( | 
          std::string_view  | 
           = {} | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
 
◆ FindComponentOptional() [1/3]
template<typename T > 
  
  
      
        
          | T * components::ComponentContext::FindComponentOptional  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
 
◆ FindComponentOptional() [2/3]
template<typename T > 
  
  
      
        
          | T * components::ComponentContext::FindComponentOptional  | 
          ( | 
          std::string_view  | 
          name | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
 
◆ FindComponentOptional() [3/3]
template<typename T > 
  
  
      
        
          | T & components::ComponentContext::FindComponentOptional  | 
          ( | 
          std::string_view  | 
           = {} | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
 
◆ GetTaskProcessor()
template<typename T > 
  
  
      
        
          | engine::TaskProcessor & components::ComponentContext::GetTaskProcessor  | 
          ( | 
          const T &  | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
 
◆ IsAnyComponentInFatalState()
      
        
          | bool components::ComponentContext::IsAnyComponentInFatalState  | 
          ( | 
           | ) | 
           const | 
        
      
 
 
◆ Manager
The documentation for this class was generated from the following file: