#include <rest_api_component.h>
 | 
| using  | JsonDocument = rapidjson::GenericDocument< rapidjson::UTF8<>, rapidjson::CrtAllocator > | 
|   | 
| using  | JsonValue = rapidjson::GenericValue< rapidjson::UTF8<>, JsonDocument::AllocatorType > | 
|   | 
| using  | JsonPointer = rapidjson::GenericPointer< JsonValue, JsonDocument::AllocatorType > | 
|   | 
| using  | SpecProcessor = void(*)(JsonDocument &spec_doc) | 
|   | processor for the RestAPI's spec.  More...
  | 
|   | 
◆ JsonDocument
◆ JsonPointer
◆ JsonValue
◆ SpecProcessor
processor for the RestAPI's spec. 
- Parameters
 - 
  
    | spec_doc | JSON document to modify  | 
  
   
 
 
◆ RestApiComponent() [1/2]
◆ RestApiComponent() [2/2]
  
  
      
        
          | RestApiComponent::RestApiComponent  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
privatedefault   | 
  
 
 
◆ add_path()
      
        
          | void RestApiComponent::add_path  | 
          ( | 
          const std::string &  | 
          path,  | 
        
        
           | 
           | 
          std::unique_ptr< BaseRestApiHandler >  | 
          handler  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
added handler for a path. 
path must be unique
- Parameters
 - 
  
    | path | regex for the path  | 
    | handler | handler for the path  | 
  
   
 
 
◆ get_instance()
get singleton instance of the component. 
 
 
◆ init()
      
        
          | void RestApiComponent::init  | 
          ( | 
          std::shared_ptr< RestApi >  | 
          srv | ) | 
           | 
        
      
 
initialize component. 
registers RestApi with the component and actives the processing of the backlogs for:
- try_process_spec()
 
- add_path() 
 
 
 
◆ operator=()
◆ remove_path()
      
        
          | void RestApiComponent::remove_path  | 
          ( | 
          const std::string &  | 
          path | ) | 
           | 
        
      
 
remove a path. 
must be called before the plugin gets unloaded that added the handler in the first place. 
 
 
◆ remove_process_spec()
      
        
          | void RestApiComponent::remove_process_spec  | 
          ( | 
          SpecProcessor  | 
          processor | ) | 
           | 
        
      
 
remove processor from backlog if exists. 
- Parameters
 - 
  
    | processor | document processor  | 
  
   
 
 
◆ try_process_spec()
      
        
          | bool RestApiComponent::try_process_spec  | 
          ( | 
          SpecProcessor  | 
          processor | ) | 
           | 
        
      
 
try to process the RestAPI's spec. 
if the component hasn't been initialized from the rest_api plugin yet, false is returned and the processor is added to a backlog which is processed when init() is called.
As the rest_api may fail to load, the caller should remove itself again with remove_process_spec() in that case.
That's not needed in case try_process_spec() returns true.
- Parameters
 - 
  
    | processor | document processor  | 
  
   
- Returns
 - success 
 
- Return values
 - 
  
    | true | spec was processed.  | 
    | false | processor added to backlog.  | 
  
   
 
 
◆ add_path_backlog_
  
  
      
        
          | std::vector<std::pair<std::string, std::unique_ptr<BaseRestApiHandler> > > RestApiComponent::add_path_backlog_ | 
         
       
   | 
  
private   | 
  
 
 
◆ spec_mu_
  
  
      
        
          | std::mutex RestApiComponent::spec_mu_ | 
         
       
   | 
  
private   | 
  
 
 
◆ spec_processors_
◆ srv_
  
  
      
        
          | std::weak_ptr<RestApi> RestApiComponent::srv_ | 
         
       
   | 
  
private   | 
  
 
 
The documentation for this class was generated from the following files: