...
This commit is contained in:
@@ -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>>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user