2 #include <samchon/API.hpp> 4 #include <samchon/protocol/IProtocol.hpp> 5 #include <samchon/templates/service/Service.hpp> 7 #include <samchon/protocol/WebClientDriver.hpp> 9 #define KEEP_CLIENT_ALIVE auto &__keeper = __keep_alive(); 47 std::shared_ptr<protocol::WebClientDriver> driver;
48 std::unique_ptr<Service> service;
63 Client(
User *user, std::shared_ptr<protocol::WebClientDriver> driver)
66 this->driver = driver;
86 auto __keep_alive()
const -> std::pair<std::shared_ptr<User>, std::shared_ptr<Client>>
88 return std::make_pair(user_weak_ptr.lock(), my_weak_ptr.lock());
114 return service.get();
149 service->user_weak_ptr = user_weak_ptr;
150 service->client_weak_ptr = my_weak_ptr;
164 virtual void sendData(std::shared_ptr<protocol::Invoke> invoke)
override 166 driver->sendData(invoke);
209 virtual void replyData(std::shared_ptr<protocol::Invoke> invoke)
212 service->replyData(invoke);
216 std::weak_ptr<User> user_weak_ptr;
217 std::weak_ptr<Client> my_weak_ptr;
void changeService(const std::string &path)
virtual void sendData(std::shared_ptr< protocol::Invoke > invoke) override
virtual void replyData(std::shared_ptr< protocol::Invoke > invoke)
auto getService() const -> Service *
virtual ~Client()=default
auto getUser() const -> User *
virtual auto createService(const std::string &) -> Service *=0
void changeService(Service *obj)
auto getNo() const -> size_t
Client(User *user, std::shared_ptr< protocol::WebClientDriver > driver)