Samchon Framework for CPP  1.0.0
samchon::example::interaction::ChiefDriver Class Reference

A boundary class interacting with a Chief system. More...

#include <ChiefDriver.hpp>

Collaboration diagram for samchon::example::interaction::ChiefDriver:

Public Member Functions

 ChiefDriver (IProtocol *master, int port)
 Construct from master and port number. More...
 
virtual void addClient (Socket *socket) override
 Handling connection of a physical client. 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...
 
- Public Member Functions inherited from samchon::protocol::IClient
 IClient ()
 Default Constructor. More...
 
virtual void listen ()
 Listens message from a related system. More...
 
virtual void sendData (std::shared_ptr< Invoke >)
 Sends message to a related system. More...
 
- Public Member Functions inherited from samchon::protocol::IProtocol
 IProtocol ()
 Default Constructor. More...
 
virtual void replyData (std::shared_ptr< Invoke >)
 Reply a message. More...
 

Protected Member Functions

virtual auto PORT () const -> int override
 Port number of the server. More...
 
- Protected Member Functions inherited from samchon::protocol::IServer
virtual auto MY_IP () const -> std::string
 (optional) Server's IP More...
 
- Protected Member Functions inherited from samchon::protocol::IClient
virtual auto BUFFER_SIZE () const -> size_t
 Buffer size of network I/O. More...
 
virtual void _replyData (std::shared_ptr< Invoke >)
 A method for pre-processing replied Invoke message. More...
 

Protected Attributes

IProtocolmaster
 A Master object containing the ChiefDriver. More...
 
int port
 A port number to open for the Chief system. More...
 
mutex mtx
 A mutex for realizing 1:1 server. More...
 
- Protected Attributes inherited from samchon::protocol::IServer
Acceptor * acceptor
 An acceptor for clients. More...
 
- Protected Attributes inherited from samchon::protocol::IClient
Socket * socket
 Socket for network I/O. More...
 
std::mutex * sendMtx
 A mutex for sending message. More...
 

Detailed Description

A boundary class interacting with a Chief system.

ChiefDriver is a boundary class interacting with a chief system as a server. However, the ChiefDriver represents a weird server that accepts only a client, the chief system.

The ChiefDriver is built for providing a guidance for designing a boundary class which is representing an unusual system within framework of OOD, handling a network system like a software class of Object-Oriented Design.

example_interaction.png
example_interaction_network_diagram.png
[Inherited] IServer
[Inherited] IClient
See also
protocol
Author
Jeongho Nam http://samchon.org

Definition at line 46 of file ChiefDriver.hpp.

Constructor & Destructor Documentation

samchon::example::interaction::ChiefDriver::ChiefDriver ( IProtocol master,
int  port 
)
inline

Construct from master and port number.

Parameters
masterA master object associated with the chief system.
portA port number to open for chief system.

Definition at line 76 of file ChiefDriver.hpp.

Member Function Documentation

virtual void samchon::example::interaction::ChiefDriver::addClient ( Socket *  )
inlineoverridevirtual

Handling connection of a physical client.

Implements samchon::protocol::IServer.

Reimplemented in samchon::example::interaction::Reporter.

Definition at line 85 of file ChiefDriver.hpp.

References samchon::protocol::IProtocol::replyData().

Here is the call graph for this function:

virtual auto samchon::example::interaction::ChiefDriver::PORT ( ) const -> int
inlineoverrideprotectedvirtual

Port number of the server.

Reimplemented from samchon::protocol::IServer.

Definition at line 99 of file ChiefDriver.hpp.

Member Data Documentation

IProtocol* samchon::example::interaction::ChiefDriver::master
protected

A Master object containing the ChiefDriver.

Definition at line 57 of file ChiefDriver.hpp.

int samchon::example::interaction::ChiefDriver::port
protected

A port number to open for the Chief system.

Definition at line 62 of file ChiefDriver.hpp.

mutex samchon::example::interaction::ChiefDriver::mtx
protected

A mutex for realizing 1:1 server.

Definition at line 67 of file ChiefDriver.hpp.


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