1 #include <samchon/protocol/service/User.hpp> 2 # include <samchon/protocol/service/Server.hpp> 3 # include <samchon/protocol/service/Client.hpp> 5 #include <boost/asio.hpp> 8 #include <samchon/library/Semaphore.hpp> 9 #include <samchon/protocol/Invoke.hpp> 60 auto User::size()
const ->
size_t 64 auto User::begin()
const -> const_iterator
66 return super::begin();
68 auto User::end()
const -> const_iterator
80 size_t no = ++sequence;
85 client->socket = socket;
87 this->
set(no, client);
115 shared_ptr<Invoke> reply(
new Invoke(
"handleLogin"));
123 bool success =
doJoin(invoke);
125 shared_ptr<Invoke> reply(
new Invoke(
"handleJoin"));
135 shared_ptr<Invoke> invoke(
new Invoke(
"doLogout"));
147 for(
auto it = begin(); it != end(); it++)
154 if (invoke->getListener() ==
"goLogin")
158 else if(invoke->getListener() ==
"goJoin")
162 else if(invoke->getListener() ==
"goLogout")
virtual void replyData(std::shared_ptr< Invoke >) override
Reply a message.
void goLogin(std::shared_ptr< Invoke >)
Log-in.
void unlock()
Unlock on writing.
library::Semaphore * semaphore
Semaphore to limit number of thread.
void sendData(std::shared_ptr< Invoke >)
Send Invoke message to (physical) client.
auto getSemaphore() const -> library::Semaphore *
Get semaphore.
int authority
Authority allocated to user.
auto getID() const -> std::string
Get user's account id.
virtual auto doLogin(std::shared_ptr< Invoke >) -> bool=0
Login and return whether success.
Server * server
Server containing the user.
virtual void goLogout()
Log-out.
void addClient(Socket *)
Add a client in user.
auto getAuthority() const -> int
Get authority of user.
auto getServer() const -> Server *
Get server.
Package of cloud service as a server.
Package of network protocol and libraries.
A server for (cloud) service.
std::string sessionID
Session ID of the user.
virtual auto createClient() -> Client *=0
Factory method of a Client.
std::string id
Account id.
Standard message of network I/O.
A parameter of an Invoke.
void eraseClient(size_t)
Erase a Client.
library::RWMutex mtx
Mutex for container.
virtual void sendData(std::shared_ptr< Invoke >) override
Send a message.
Top level namespace of products built from samchon.
void goJoin(std::shared_ptr< Invoke >)
Join as a member.
virtual auto doJoin(std::shared_ptr< Invoke >) -> bool=0
Join and returns whether success.