2 #include <samchon/API.hpp> 4 #include <samchon/protocol/IProtocol.hpp> 5 #include <samchon/TreeMap.hpp> 6 #include <samchon/templates/service/Client.hpp> 11 #include <samchon/library/RWMutex.hpp> 49 :
public TreeMap<size_t, std::shared_ptr<Client>>,
62 std::string session_id;
81 this->server = server;
91 virtual ~User() =
default;
109 erase_user_function();
169 if (this->account == account)
171 else if (this->account.empty() ==
false)
175 account_map->erase(this->account);
179 this->account = account;
180 this->authority = authority;
184 account_map->set(account, my_weak_ptr.lock());
199 if (account.empty() ==
false)
200 account_map->erase(account);
229 virtual void sendData(std::shared_ptr<protocol::Invoke> invoke)
override 231 std::vector<std::thread> threadArray;
234 threadArray.reserve(size());
235 for (
auto it = begin(); it != end(); it++)
239 for (
auto it = threadArray.begin(); it != threadArray.end(); it++)
272 virtual void replyData(std::shared_ptr<protocol::Invoke>) = 0;
275 std::weak_ptr<User> my_weak_ptr;
280 std::function<void()> erase_user_function;
auto getServer() const -> Server *
auto getAuthority() const -> int
virtual void sendData(std::shared_ptr< protocol::Invoke > invoke) override
auto getAccount() const -> std::string
void unlock() const
Unlock of read.
virtual void replyData(std::shared_ptr< protocol::Invoke >)=0
void setAccount(const std::string &account, int authority)
Customized std::unordered_map.
virtual void sendData(std::shared_ptr< protocol::Invoke > invoke) override
virtual auto createClient() -> Client *=0