Index  Source Files  Annotated Class List  Alphabetical Class List  Class Hierarchy  Graphical Class Hierarchy 

SocketConnector.h

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 
00003 /****************************************************************************
00004 ** Copyright (c) quickfixengine.org  All rights reserved.
00005 **
00006 ** This file is part of the QuickFIX FIX Engine
00007 **
00008 ** This file may be distributed under the terms of the quickfixengine.org
00009 ** license as defined by quickfixengine.org and appearing in the file
00010 ** LICENSE included in the packaging of this file.
00011 **
00012 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00013 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00014 **
00015 ** See http://www.quickfixengine.org/LICENSE for licensing information.
00016 **
00017 ** Contact ask@quickfixengine.org if any conditions of this licensing are
00018 ** not clear to you.
00019 **
00020 ****************************************************************************/
00021 
00022 #ifndef FIX_SOCKETCONNECTOR_H
00023 #define FIX_SOCKETCONNECTOR_H
00024 
00025 #ifdef _MSC_VER
00026 #pragma warning( disable : 4503 4355 4786 4290 )
00027 #endif
00028 
00029 #include "SocketMonitor.h"
00030 #include <string>
00031 
00032 namespace FIX
00033 {
00035 class SocketConnector
00036 {
00037 public:
00038   class Strategy;
00039 
00040   SocketConnector( int timeout = 0 );
00041 
00042   int connect( const std::string& address, int port, bool noDelay, 
00043                int sendBufSize, int rcvBufSize );
00044   int connect( const std::string& address, int port, bool noDelay, 
00045                int sendBufSize, int rcvBufSize, Strategy& );
00046   void block( Strategy& strategy, bool poll = 0, double timeout = 0.0 );
00047   SocketMonitor& getMonitor() { return m_monitor; }
00048 
00049 private:
00050   SocketMonitor m_monitor;
00051 
00052 public:
00053   class Strategy
00054   {
00055   public:
00056     virtual ~Strategy() {}
00057     virtual void onConnect( SocketConnector&, int socket ) = 0;
00058     virtual void onWrite( SocketConnector&, int socket ) = 0;
00059     virtual bool onData( SocketConnector&, int socket ) = 0;
00060     virtual void onDisconnect( SocketConnector&, int socket ) = 0;
00061     virtual void onError( SocketConnector& ) = 0;
00062     virtual void onTimeout( SocketConnector& ) {};
00063   };
00064 };
00065 }
00066 
00067 #endif //FIX_SOCKETCONNECTOR_H

Generated on Mon Apr 5 20:59:51 2010 for QuickFIX by doxygen 1.6.1 written by Dimitri van Heesch, © 1997-2001