Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
FIX::ServerWrapper Class Reference

Handles events from SocketMonitor for server connections. More...

Inheritance diagram for FIX::ServerWrapper:
Inheritance graph
[legend]
Collaboration diagram for FIX::ServerWrapper:
Collaboration graph
[legend]

Public Member Functions

 ServerWrapper (std::set< int > sockets, SocketServer &server, SocketServer::Strategy &strategy)
 
- Public Member Functions inherited from FIX::SocketMonitor::Strategy
virtual ~Strategy ()
 

Private Types

typedef std::set< int > Sockets
 

Private Member Functions

void onConnect (SocketMonitor &, int socket)
 
void onEvent (SocketMonitor &monitor, int socket)
 
void onWrite (SocketMonitor &, int socket)
 
void onError (SocketMonitor &monitor, int socket)
 
void onError (SocketMonitor &)
 
void onTimeout (SocketMonitor &)
 

Private Attributes

Sockets m_sockets
 
SocketServerm_server
 
SocketServer::Strategym_strategy
 

Detailed Description

Handles events from SocketMonitor for server connections.

Definition at line 40 of file SocketServer.cpp.

Member Typedef Documentation

◆ Sockets

typedef std::set<int> FIX::ServerWrapper::Sockets
private

Definition at line 84 of file SocketServer.cpp.

Constructor & Destructor Documentation

◆ ServerWrapper()

FIX::ServerWrapper::ServerWrapper ( std::set< int >  sockets,
SocketServer server,
SocketServer::Strategy strategy 
)
inline

Definition at line 43 of file SocketServer.cpp.

45 : m_sockets( sockets ), m_server( server ), m_strategy( strategy ) {}
SocketServer & m_server
SocketServer::Strategy & m_strategy

Member Function Documentation

◆ onConnect()

void FIX::ServerWrapper::onConnect ( SocketMonitor ,
int  socket 
)
inlineprivatevirtual

Implements FIX::SocketMonitor::Strategy.

Definition at line 48 of file SocketServer.cpp.

49  {
50  }

◆ onError() [1/2]

void FIX::ServerWrapper::onError ( SocketMonitor monitor,
int  socket 
)
inlineprivatevirtual

Implements FIX::SocketMonitor::Strategy.

Definition at line 70 of file SocketServer.cpp.

References FIX::SocketMonitor::drop(), m_server, m_strategy, and FIX::SocketServer::Strategy::onDisconnect().

Referenced by onEvent().

71  {
72  m_strategy.onDisconnect( m_server, socket );
73  monitor.drop( socket );
74  }
virtual void onDisconnect(SocketServer &, int socket)=0
SocketServer & m_server
SocketServer::Strategy & m_strategy

◆ onError() [2/2]

void FIX::ServerWrapper::onError ( SocketMonitor )
inlineprivatevirtual

Implements FIX::SocketMonitor::Strategy.

Definition at line 76 of file SocketServer.cpp.

References m_server, m_strategy, and FIX::SocketServer::Strategy::onError().

77  {
79  }
SocketServer & m_server
SocketServer::Strategy & m_strategy
virtual void onError(SocketServer &)=0

◆ onEvent()

void FIX::ServerWrapper::onEvent ( SocketMonitor monitor,
int  socket 
)
inlineprivatevirtual

Implements FIX::SocketMonitor::Strategy.

Definition at line 52 of file SocketServer.cpp.

References FIX::SocketServer::accept(), m_server, m_sockets, m_strategy, FIX::SocketServer::Strategy::onConnect(), FIX::SocketServer::Strategy::onData(), and onError().

53  {
54  if( m_sockets.find(socket) != m_sockets.end() )
55  {
56  m_strategy.onConnect( m_server, socket, m_server.accept(socket) );
57  }
58  else
59  {
60  if( !m_strategy.onData( m_server, socket ) )
61  onError( monitor, socket );
62  }
63  }
void onError(SocketMonitor &monitor, int socket)
SocketServer & m_server
virtual bool onData(SocketServer &, int socket)=0
SocketServer::Strategy & m_strategy
virtual void onConnect(SocketServer &, int acceptSocket, int socket)=0
int accept(int socket)

◆ onTimeout()

void FIX::ServerWrapper::onTimeout ( SocketMonitor )
inlineprivatevirtual

Reimplemented from FIX::SocketMonitor::Strategy.

Definition at line 81 of file SocketServer.cpp.

References m_server, m_strategy, and FIX::SocketServer::Strategy::onTimeout().

82  {
84  };
virtual void onTimeout(SocketServer &)
Definition: SocketServer.h:95
SocketServer & m_server
SocketServer::Strategy & m_strategy

◆ onWrite()

void FIX::ServerWrapper::onWrite ( SocketMonitor ,
int  socket 
)
inlineprivatevirtual

Implements FIX::SocketMonitor::Strategy.

Definition at line 65 of file SocketServer.cpp.

References m_server, m_strategy, and FIX::SocketServer::Strategy::onWrite().

66  {
67  m_strategy.onWrite( m_server, socket );
68  }
SocketServer & m_server
virtual void onWrite(SocketServer &, int socket)=0
SocketServer::Strategy & m_strategy

Member Data Documentation

◆ m_server

SocketServer& FIX::ServerWrapper::m_server
private

Definition at line 90 of file SocketServer.cpp.

Referenced by onError(), onEvent(), onTimeout(), and onWrite().

◆ m_sockets

Sockets FIX::ServerWrapper::m_sockets
private

Definition at line 89 of file SocketServer.cpp.

Referenced by onEvent().

◆ m_strategy

SocketServer::Strategy& FIX::ServerWrapper::m_strategy
private

Definition at line 91 of file SocketServer.cpp.

Referenced by onError(), onEvent(), onTimeout(), and onWrite().


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

Generated on Sun Apr 15 2018 21:44:06 for QuickFIX by doxygen 1.8.13 written by Dimitri van Heesch, © 1997-2001