template<typename Extra_Data_Factory = no_extra_data_factory_t>
class restinio::sync_chain::growable_size_chain_t< Extra_Data_Factory >
A holder of variable-size chain of synchronous handlers.
- Note
- Once a list of handler is filled and an instance of growable_size_chain_t is created that instance can't be changed: a new handler can't be added, and an old handler can be removed. The creation of growable_size_chain_t instance is performed by the help of growable_size_chain_t::builder_t class.
Usage example for the case when there is no extra-data in a request object.
};
{
...
}
{
...
}
{
...
}
if(config.force_headers_checking())
builder.
add(headers_checker);
if(config.force_user_authentification())
builder.
add(authentificator);
builder.
add(actual_handler);
on_thread_pool<my_traits>(16)
.address(...)
.port(...)
.request_handler(builder.
release())
);
Usage example for the case when some extra-data is incorporated into a request object.
struct my_extra_data_factory {
struct request_specific_fields_t {...};
struct user_info_t {...};
using data_t = std::tuple<
std::optional<request_specific_fields_t>,
std::optional<user_info_t>>;
}
};
using extra_data_factory_t = my_extra_data_factory;
extra_data_factory>;
};
using my_request_handle_t =
const my_request_handle_t & req )
{
...
}
const my_request_handle_t & req )
{
...
}
const my_request_handle_t & req )
{
std::optional<my_extra_data_factory::request_specific_fields_t>>(req->extra_data());
std::optional<my_extra_data_factory::user_info_t>>(req->extra_data());
...
}
if(config.force_headers_checking())
builder.
add(headers_checker);
if(config.force_user_authentification())
builder.
add(authentificator);
builder.
add(actual_handler);
on_thread_pool<my_traits>(16)
.address(...)
.port(...)
.request_handler(builder.
release())
);
- Template Parameters
-
| Extra_Data_Factory | The type of extra-data-factory specified in the server's traits. |
- Since
- v.0.6.13
- Examples:
- sample/extra_data_factory/main.cpp.
Definition at line 158 of file growable_size.hpp.