move implementations for ASIO-library to net/asio subdirectory

This commit is contained in:
2024-09-14 16:21:03 +03:00
parent 9818b5f2b8
commit a7626bfe5e
3 changed files with 460 additions and 255 deletions

View File

@@ -84,39 +84,40 @@ template <typename SRVT,
typename RMSGT = std::string, // receiving message type
typename DURT = adc_common_duration_t // time duration type
>
concept adc_netservice_c = traits::adc_input_char_range<SMSGT> && traits::adc_output_char_range<RMSGT> && traits::adc_time_duration_c<DURT> &&
requires(SRVT srv, const SRVT srv_const) {
typename SRVT::netservice_ident_t;
concept adc_netservice_c =
traits::adc_input_char_range<SMSGT> && traits::adc_output_char_range<RMSGT> && traits::adc_time_duration_c<DURT> &&
requires(SRVT srv, const SRVT srv_const) {
typename SRVT::netservice_ident_t;
// netservice_ident_t ident() const
{ srv_const.ident() } -> std::same_as<typename SRVT::netservice_ident_t>;
// netservice_ident_t ident() const
{ srv_const.ident() } -> std::same_as<typename SRVT::netservice_ident_t>;
typename SRVT::async_ctx_t;
typename SRVT::endpoint_t;
typename SRVT::async_ctx_t;
typename SRVT::endpoint_t;
// asynchronous (non-blocking) operations
srv.asyncAccept(std::declval<const typename SRVT::endpoint_t&>(),
std::declval<typename SRVT::async_ctx_t&>(), std::declval<const DURT&>());
// asynchronous (non-blocking) operations
srv.asyncAccept(std::declval<const typename SRVT::endpoint_t&>(), std::declval<typename SRVT::async_ctx_t&>(),
std::declval<const DURT&>());
srv.asyncConnect(std::declval<const typename SRVT::endpoint_t&>(),
std::declval<typename SRVT::async_ctx_t&>(), std::declval<const DURT&>());
srv.asyncConnect(std::declval<const typename SRVT::endpoint_t&>(), std::declval<typename SRVT::async_ctx_t&>(),
std::declval<const DURT&>());
srv.asyncSend(std::declval<const SMSGT&>(), std::declval<typename SRVT::async_ctx_t&>(),
std::declval<const DURT&>());
srv.asyncSend(std::declval<const SMSGT&>(), std::declval<typename SRVT::async_ctx_t&>(),
std::declval<const DURT&>());
srv.asyncReceive(std::declval<typename SRVT::async_ctx_t&>(), std::declval<const DURT&>());
srv.asyncReceive(std::declval<typename SRVT::async_ctx_t&>(), std::declval<const DURT&>());
// synchronous (blocking) operations
srv.accept(std::declval<const typename SRVT::endpoint_t&>(), std::declval<const DURT&>());
// synchronous (blocking) operations
srv.accept(std::declval<const typename SRVT::endpoint_t&>(), std::declval<const DURT&>());
srv.connect(std::declval<const typename SRVT::endpoint_t&>(), std::declval<const DURT&>());
srv.connect(std::declval<const typename SRVT::endpoint_t&>(), std::declval<const DURT&>());
srv.send(std::declval<const SMSGT&>(), std::declval<const DURT&>());
srv.send(std::declval<const SMSGT&>(), std::declval<const DURT&>());
{ srv.receive(std::declval<const DURT &>()) } -> std::same_as<RMSGT>;
{ srv.receive(std::declval<const DURT&>()) } -> std::same_as<RMSGT>;
srv.shutdown();
};
srv.close();
};
/* NETWORK SESSION */
@@ -137,35 +138,34 @@ concept adc_netsession_c =
/* NETWORK SESSION-LEVEL PROTOCOL */
template <typename SESS_PROTOT,
typename BUFFT = std::string_view>
concept adc_netsession_proto_c = traits::adc_input_char_range<BUFFT> && requires(SESS_PROTOT proto, const SESS_PROTOT proto_const) {
typename SESS_PROTOT::proto_ident_t;
template <typename SESS_PROTOT, typename BUFFT = std::string_view>
concept adc_netsession_proto_c =
traits::adc_input_char_range<BUFFT> && requires(SESS_PROTOT proto, const SESS_PROTOT proto_const) {
typename SESS_PROTOT::proto_ident_t;
// proto_ident_t ident() const (const method)
{ proto_const.ident() } -> std::same_as<typename SESS_PROTOT::proto_ident_t>;
// proto_ident_t ident() const (const method)
{ proto_const.ident() } -> std::same_as<typename SESS_PROTOT::proto_ident_t>;
// typename SESS_PROTOT::search_result_t;
// typename SESS_PROTOT::search_result_t;
// search for the first occurence of valid protocol sequence in input user byte sequence
// the method must return std::tuple<begin, end, flag>:
// start - input range iterator of the sequence first byte
// stop - input range iterator of the sequence end ("after-the-last" byte!!!)
// flag - true if valid sequence was found, false - otherwise
{
proto.search(std::declval<const BUFFT&>())
} -> std::same_as<std::tuple<std::ranges::iterator_t<BUFFT>, std::ranges::iterator_t<BUFFT>, bool>>;
// search for the first occurence of valid protocol sequence in input user byte sequence
// the method must return std::tuple<begin, end, flag>:
// start - input range iterator of the sequence first byte
// stop - input range iterator of the sequence end ("after-the-last" byte!!!)
// flag - true if valid sequence was found, false - otherwise
{
proto.search(std::declval<const BUFFT&>())
} -> std::same_as<std::tuple<std::ranges::iterator_t<BUFFT>, std::ranges::iterator_t<BUFFT>, bool>>;
// construct netsession protocol representation of input user byte sequence
// the method must return a range of char range views or output char range
{ proto.toProto(std::declval<const BUFFT &>()) } -> traits::adc_range_of_view_or_output_char_range;
// construct netsession protocol representation of input user byte sequence
// the method must return a range of char range views or output char range
{ proto.toProto(std::declval<const BUFFT&>()) } -> traits::adc_range_of_view_or_output_char_range;
// return user byte sequence from input netsession protocol representation
// the method must return a view of char range or output char range
{ proto.fromProto(std::declval<const BUFFT &>()) } -> traits::adc_view_or_output_char_range;
};
// return user byte sequence from input netsession protocol representation
// the method must return a view of char range or output char range
{ proto.fromProto(std::declval<const BUFFT&>()) } -> traits::adc_view_or_output_char_range;
};
} // namespace adc::interfaces