Samchon Framework for CPP
1.0.0
|
A server for (cloud) service. More...
#include <Server.hpp>
Public Member Functions | |
Server () | |
Default Constructor. More... | |
auto | size () const -> size_t |
Size of User(s). More... | |
auto | begin () const -> const_iterator |
A const iterator of begin. More... | |
auto | end () const -> const_iterator |
A const iterator of end. More... | |
![]() | |
IServer () | |
Default Constructor. More... | |
virtual void | open () |
Open the server. More... | |
virtual void | close () |
Close the server. More... | |
Protected Member Functions | |
virtual auto | NAME () const -> std::string=0 |
A name can be an identifier of a cloud server. More... | |
virtual auto | createUser () -> User *=0 |
Factory method of User. More... | |
virtual void | addClient (Socket *) override |
Handling connection of a client. More... | |
![]() | |
virtual auto | MY_IP () const -> std::string |
(optional) Server's IP More... | |
virtual auto | PORT () const -> int=NULL |
Port number of the server. More... | |
Protected Attributes | |
library::SQLi * | sqli |
SQLi for archiving log. More... | |
![]() | |
Acceptor * | acceptor |
An acceptor for clients. More... | |
Private Attributes | |
Dictionary< std::shared_ptr< IPUserPair > > | ipMap |
Dictionary of issuer of session ID of each ip. More... | |
size_t | sequence |
Sequence for issuing session ID. More... | |
Additional Inherited Members | |
![]() | |
auto | has (const _Kty &key) const -> bool |
Whether have the item or not. More... | |
auto | get (const _Kty &key) -> _Ty & |
Get element. More... | |
void | set (const _Kty &key, const _Ty &val) |
Set element. More... | |
auto | pop (const _Kty &key) -> _Ty |
Pop item. More... | |
A server for (cloud) service.
A server class representing the real physical server of a cloud.
The Server is very good for development of a cloud server. You can use web or flex as (physical) client. The usage is very simple. In the class Server, what you need to do are overriding getter of port number and factory method creating an User.
Definition at line 48 of file Server.hpp.
Server::Server | ( | ) |
|
protectedpure virtual |
A name can be an identifier of a cloud server.
auto Server::size | ( | ) | const -> size_t |
Size of User(s).
Definition at line 53 of file Server.cpp.
auto Server::begin | ( | ) | const -> const_iterator |
A const iterator of begin.
Definition at line 57 of file Server.cpp.
Referenced by samchon::example::chat_service::ChatRoomArray::notify().
auto Server::end | ( | ) | const -> const_iterator |
A const iterator of end.
Definition at line 61 of file Server.cpp.
Referenced by addClient(), and samchon::example::chat_service::ChatRoomArray::notify().
|
protectedpure virtual |
Factory method of User.
Implemented in samchon::example::chat_service::ChatServer.
Referenced by addClient().
|
overrideprotectedvirtual |
Handling connection of a client.
Implements samchon::protocol::IServer.
Definition at line 69 of file Server.cpp.
References createUser(), end(), samchon::SmartPointer< _Ty >::get(), samchon::Map< _Kty, _Ty, _Pr, _Alloc >::has(), samchon::protocol::service::IPUserPair::ip, ipMap, sequence, and samchon::protocol::service::IPUserPair::userSet.
|
protected |
|
private |
Dictionary of issuer of session ID of each ip.
Definition at line 75 of file Server.hpp.
Referenced by addClient().
|
private |
Sequence for issuing session ID.
Definition at line 80 of file Server.hpp.
Referenced by addClient(), and Server().