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

/home/orenmnero/autobuild/quickfix/src/C++/ThreadedSocketInitiator.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_THREADEDSOCKETINITIATOR_H
00023 #define FIX_THREADEDSOCKETINITIATOR_H
00024 
00025 #ifdef _MSC_VER
00026 #pragma warning( disable : 4503 4355 4786 4290 )
00027 #endif
00028 
00029 #include "Initiator.h"
00030 #include "ThreadedSocketConnection.h"
00031 #include <map>
00032 
00033 namespace FIX
00034 {
00038 
00039 class ThreadedSocketInitiator : public Initiator
00040 {
00041 public:
00042   ThreadedSocketInitiator( Application&, MessageStoreFactory&,
00043                            const SessionSettings& ) throw( ConfigError );
00044   ThreadedSocketInitiator( Application&, MessageStoreFactory&,
00045                            const SessionSettings&,
00046                            LogFactory& ) throw( ConfigError );
00047 
00048   virtual ~ThreadedSocketInitiator();
00049 
00050 private:
00051   typedef std::map < int, int > SocketToThread;
00052   typedef std::map < SessionID, int > SessionToHostNum;
00053   typedef std::pair < ThreadedSocketInitiator*, ThreadedSocketConnection* > ThreadPair;
00054 
00055   void onConfigure( const SessionSettings& ) throw ( ConfigError );
00056   void onInitialize( const SessionSettings& ) throw ( RuntimeError );
00057 
00058   void onStart();
00059   bool onPoll();
00060   void onStop();
00061 
00062   bool doConnect( const SessionID& s, const Dictionary& d );
00063 
00064   void addThread( int s, int t );
00065   void removeThread( int s );
00066   static THREAD_PROC socketThread( void* p );
00067 
00068   void getHost( const SessionID&, const Dictionary&, std::string&, short& );
00069 
00070   SessionSettings m_settings;
00071   SessionToHostNum m_sessionToHostNum;
00072   time_t m_lastConnect;
00073   int m_reconnectInterval;
00074   bool m_noDelay;
00075   bool m_stop;
00076   SocketToThread m_threads;
00077   Mutex m_mutex;
00078 };
00080 }
00081 
00082 #endif //FIX_THREADEDSOCKETINITIATOR_H

Generated on Mon Jul 24 19:36:31 2006 for QuickFIX by doxygen 1.3.6-20040222 written by Dimitri van Heesch, © 1997-2001