2018-04-18 15:57:06 +01:00
|
|
|
#pragma once
|
|
|
|
#include <switch.h>
|
|
|
|
#include <type_traits>
|
|
|
|
|
|
|
|
#include "iserviceobject.hpp"
|
2018-04-18 18:41:17 +01:00
|
|
|
#include "iwaitable.hpp"
|
2018-04-18 15:57:06 +01:00
|
|
|
#include "servicesession.hpp"
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
class ServiceSession;
|
|
|
|
|
|
|
|
template <typename T>
|
2018-04-18 18:41:17 +01:00
|
|
|
class ServiceServer : IWaitable {
|
2018-04-18 15:57:06 +01:00
|
|
|
static_assert(std::is_base_of<IServiceObject, T>::value, "Service Objects must derive from IServiceObject");
|
|
|
|
|
|
|
|
Handle port_handle;
|
|
|
|
unsigned int max_sessions;
|
2018-04-18 18:41:17 +01:00
|
|
|
unsigned int num_sessions;
|
2018-04-18 15:57:06 +01:00
|
|
|
ServiceSession<T> **sessions;
|
|
|
|
|
|
|
|
public:
|
|
|
|
ServiceServer(const char *service_name, unsigned int max_s);
|
2018-04-18 18:41:17 +01:00
|
|
|
virtual ~ServiceServer();
|
2018-04-18 15:57:06 +01:00
|
|
|
|
2018-04-18 18:41:17 +01:00
|
|
|
/* IWaitable */
|
|
|
|
virtual unsigned int get_num_waitables();
|
|
|
|
virtual void get_waitables(IWaitable **dst);
|
|
|
|
virtual void delete_child(IWaitable *child);
|
|
|
|
virtual Handle get_handle();
|
|
|
|
virtual Result handle_signaled();
|
2018-04-18 15:57:06 +01:00
|
|
|
};
|