This commit is contained in:
2024-06-18 17:30:11 +03:00
parent ebe93f1d74
commit 9f915d932f
3 changed files with 98 additions and 21 deletions

View File

@@ -44,6 +44,36 @@ concept adc_netserver_session_impl_c = requires(T t, const T t_const) {
/* Server session */
class AdcNetServerGenericSession
{
public:
struct Opt {
std::function<void()> startSess;
std::function<void()> stopSess;
std::function<void()> run;
};
AdcNetServerGenericSession(Opt&& opts) : _opts(std::move(opts)) {}
virtual void start()
{
_opts.startSess();
}
virtual void stop()
{
_opts.stopSess();
}
protected:
Opt _opts;
virtual void run()
{
_opts.run();
}
};
template <traits::adc_netserver_session_impl_c ImplT>
class AdcNetServerSession : std::enable_shared_from_this<AdcNetServerSession<ImplT>>
{