Samchon Framework for CPP  1.0.0
samchon::protocol::service::Server Class Referenceabstract

A server for (cloud) service. More...

#include <Server.hpp>

Collaboration diagram for samchon::protocol::service::Server:

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...
 
- Public Member Functions inherited from samchon::protocol::IServer
 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...
 
- Protected Member Functions inherited from samchon::protocol::IServer
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::SQLisqli
 SQLi for archiving log. More...
 
- Protected Attributes inherited from samchon::protocol::IServer
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

- Private Member Functions inherited from samchon::Map< _Kty, _Ty, _Pr, _Alloc >
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...
 

Detailed Description

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.

protocol_service.png
Note
Override those methods.
See also
samchon::protocol
samchon::protocol::service
Author
Jeongho Nam http://samchon.org

Definition at line 48 of file Server.hpp.

Constructor & Destructor Documentation

Server::Server ( )

Default Constructor.

Definition at line 31 of file Server.cpp.

References sequence, and sqli.

Member Function Documentation

virtual auto samchon::protocol::service::Server::NAME ( ) const -> std::string
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.

Note
Be careful about concurrency

Definition at line 57 of file Server.cpp.

Referenced by samchon::example::chat_service::ChatRoomArray::notify().

Here is the caller graph for this function:

auto Server::end ( ) const -> const_iterator

A const iterator of end.

Note
Be careful about concurrency

Definition at line 61 of file Server.cpp.

Referenced by addClient(), and samchon::example::chat_service::ChatRoomArray::notify().

Here is the caller graph for this function:

virtual auto samchon::protocol::service::Server::createUser ( ) -> User *
protectedpure virtual

Factory method of User.

Implemented in samchon::example::chat_service::ChatServer.

Referenced by addClient().

Here is the caller graph for this function:

void Server::addClient ( Socket *  socket)
overrideprotectedvirtual

Member Data Documentation

library::SQLi* samchon::protocol::service::Server::sqli
protected

SQLi for archiving log.

Definition at line 67 of file Server.hpp.

Referenced by Server().

Dictionary<std::shared_ptr<IPUserPair> > samchon::protocol::service::Server::ipMap
private

Dictionary of issuer of session ID of each ip.

Definition at line 75 of file Server.hpp.

Referenced by addClient().

size_t samchon::protocol::service::Server::sequence
private

Sequence for issuing session ID.

Definition at line 80 of file Server.hpp.

Referenced by addClient(), and Server().


The documentation for this class was generated from the following files: