RESTinio
Public Types | Public Member Functions | Private Member Functions | Friends | List of all members
restinio::async_chain::async_handling_controller_t< Extra_Data_Factory > Class Template Referenceabstract

Interface of a controller of an async chan. More...

#include <common.hpp>

Inheritance diagram for restinio::async_chain::async_handling_controller_t< Extra_Data_Factory >:
restinio::async_chain::fixed_size_chain_t< Size, Extra_Data_Factory >::actual_controller_t restinio::async_chain::growable_size_chain_t< Extra_Data_Factory >::actual_controller_t

Public Types

using actual_request_handle_t = generic_request_handle_t< typename Extra_Data_Factory::data_t >
 Short alias for request_handle type. More...
 
using actual_async_request_scheduler_t = generic_async_request_scheduler_t< typename Extra_Data_Factory::data_t >
 Short alias for async_request_scheduler type. More...
 
using actual_on_next_result_t = on_next_result_t< Extra_Data_Factory >
 Short alias for the result type of on_next method. More...
 

Public Member Functions

virtual ~async_handling_controller_t ()=default
 
virtual const actual_request_handle_trequest_handle () const noexcept=0
 Get reference to the source request. More...
 

Private Member Functions

virtual actual_on_next_result_t on_next ()=0
 Command to try find a next scheduler to be invoked. More...
 

Friends

template<typename Extra_Data_Factory_For_Next >
void next (unique_async_handling_controller_t< Extra_Data_Factory_For_Next > controller)
 

Detailed Description

template<typename Extra_Data_Factory>
class restinio::async_chain::async_handling_controller_t< Extra_Data_Factory >

Interface of a controller of an async chan.

All actual controllers have to implement this interface.

It's assumed that implementation of that interface won't be thread safe. It means that methods like request_handle() and on_next() must not be called in parallel.

Template Parameters
Extra_Data_FactoryType of factory for creation of extra data objects for every incoming request. Should be no_extra_data_factory_t if extra data for incoming requests is not needed.
Since
v.0.7.0

Definition at line 76 of file common.hpp.

Member Typedef Documentation

◆ actual_async_request_scheduler_t

template<typename Extra_Data_Factory >
using restinio::async_chain::async_handling_controller_t< Extra_Data_Factory >::actual_async_request_scheduler_t = generic_async_request_scheduler_t< typename Extra_Data_Factory::data_t >

Short alias for async_request_scheduler type.

Definition at line 159 of file common.hpp.

◆ actual_on_next_result_t

template<typename Extra_Data_Factory >
using restinio::async_chain::async_handling_controller_t< Extra_Data_Factory >::actual_on_next_result_t = on_next_result_t< Extra_Data_Factory >

Short alias for the result type of on_next method.

Definition at line 163 of file common.hpp.

◆ actual_request_handle_t

template<typename Extra_Data_Factory >
using restinio::async_chain::async_handling_controller_t< Extra_Data_Factory >::actual_request_handle_t = generic_request_handle_t< typename Extra_Data_Factory::data_t >

Short alias for request_handle type.

Definition at line 155 of file common.hpp.

Constructor & Destructor Documentation

◆ ~async_handling_controller_t()

template<typename Extra_Data_Factory >
virtual restinio::async_chain::async_handling_controller_t< Extra_Data_Factory >::~async_handling_controller_t ( )
virtualdefault

Member Function Documentation

◆ on_next()

template<typename Extra_Data_Factory >
virtual actual_on_next_result_t restinio::async_chain::async_handling_controller_t< Extra_Data_Factory >::on_next ( )
privatepure virtual

Command to try find a next scheduler to be invoked.

Implementation of async_handling_controller_t should switch to the next scheduler in the chain and return the scheduler to be called next. If there are no such schedulers, no_more_schedulers_t must be returned.

Note
This method is intended to be called by next() function.

Implemented in restinio::async_chain::growable_size_chain_t< Extra_Data_Factory >::actual_controller_t, and restinio::async_chain::fixed_size_chain_t< Size, Extra_Data_Factory >::actual_controller_t.

◆ request_handle()

template<typename Extra_Data_Factory >
virtual const actual_request_handle_t& restinio::async_chain::async_handling_controller_t< Extra_Data_Factory >::request_handle ( ) const
pure virtualnoexcept

Get reference to the source request.

Usage example:

{
// Get access to the source request.
const auto req = controller->request_handle();
if( restinio::http_method_get() == req->header().method() )
{
...
}
}

Implemented in restinio::async_chain::growable_size_chain_t< Extra_Data_Factory >::actual_controller_t, and restinio::async_chain::fixed_size_chain_t< Size, Extra_Data_Factory >::actual_controller_t.

Friends And Related Function Documentation

◆ next

template<typename Extra_Data_Factory >
template<typename Extra_Data_Factory_For_Next >
void next ( unique_async_handling_controller_t< Extra_Data_Factory_For_Next >  controller)
friend

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