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 87 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::Strategy & m_strategy
SocketServer & m_server

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 )
inlineprivatevirtual

Implements FIX::SocketMonitor::Strategy.

Definition at line 76 of file SocketServer.cpp.

77 {
79 }
virtual void onError(SocketServer &)=0

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

◆ onError() [2/2]

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

Implements FIX::SocketMonitor::Strategy.

Definition at line 70 of file SocketServer.cpp.

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

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

Referenced by onEvent().

◆ onEvent()

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

Implements FIX::SocketMonitor::Strategy.

Definition at line 52 of file SocketServer.cpp.

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)
virtual void onConnect(SocketServer &, int acceptSocket, int socket)=0
virtual bool onData(SocketServer &, int socket)=0
int accept(int socket)

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

◆ onTimeout()

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

Reimplemented from FIX::SocketMonitor::Strategy.

Definition at line 81 of file SocketServer.cpp.

82 {
84 };
virtual void onTimeout(SocketServer &)

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

◆ onWrite()

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

Implements FIX::SocketMonitor::Strategy.

Definition at line 65 of file SocketServer.cpp.

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

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

Member Data Documentation

◆ m_server

SocketServer& FIX::ServerWrapper::m_server
private

Definition at line 90 of file SocketServer.cpp.

Referenced by onError(), 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(), onError(), onEvent(), onTimeout(), and onWrite().


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

Generated on Mon Mar 4 2024 21:10:02 for QuickFIX by doxygen 1.9.8 written by Dimitri van Heesch, © 1997-2001