API New Year  1.0
API for the project ZIA, EPITECH 2017.
ApiNewYear::IServer Class Referenceabstract

Base class for the main loop of the ZIA server. More...

#include <IServer.h>

Collaboration diagram for ApiNewYear::IServer:
Collaboration graph

Public Member Functions

virtual int init (IExecutionLine &executionLine)=0
 Initializes IServer. More...
 
virtual int attach (IConnection *connection)=0
 Adds connection module. More...
 
virtual int detach (const std::string &name)=0
 Remvoes connection module. More...
 
virtual int run (void)=0
 Runs the main loop for the ZIA modules. More...
 
virtual IExecutionLinegetExecutionLine ()=0
 Getter for ExecutionLine. More...
 

Detailed Description

Base class for the main loop of the ZIA server.

Base class that englobes all types of modules, including the execution of the IExecutionLine.

Member Function Documentation

virtual int ApiNewYear::IServer::attach ( IConnection connection)
pure virtual

Adds connection module.

IServer adds modules to container of connection modules to be executed after server is initialized, after fork, and while a client is trying to connect.

Parameters
connectionEvent containing information for the module to run.
Returns
an int representing success or error code.
virtual int ApiNewYear::IServer::detach ( const std::string &  name)
pure virtual

Remvoes connection module.

IServer Removes the module by name from container of connection modules to be executed.

Parameters
namestring containing the name of the module to look for.
Returns
an int representing success or error code.
virtual IExecutionLine& ApiNewYear::IServer::getExecutionLine ( )
pure virtual

Getter for ExecutionLine.

IServer gets the ExectuionLine.

Returns
a reference to the ExecutionLine.
virtual int ApiNewYear::IServer::init ( IExecutionLine executionLine)
pure virtual

Initializes IServer.

IServer initializes IServer by giving access to IExecutionLine, for future run, and initializing the servers socket.

Parameters
executionLineexecutionLine containing attached modules.
Returns
int representing success or error code.
virtual int ApiNewYear::IServer::run ( void  )
pure virtual

Runs the main loop for the ZIA modules.

IServer Awaits for a client to try and connect, creates a child process, allocates an IHttpClient to be used by the ExecutionLine, executes connection modules, and then loops the ExectuionLine. When ExecutionLine has finished (client has disconnected, or timed out), deletes IHttpClient.

Returns
an int representing success or error code.

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