RE: [Quickfix-developers] End of Day
Brought to you by:
orenmnero
From: <Sa...@uc...> - 2004-01-21 15:07:36
|
> Sa...@uc... wrote: > > I see... thanks. > > > > I was looking for something a little more programmatic. Sometime we are > > forced to reset our sequence numbers to match those who we are > connecting > > to. At least we have relied upon this kind of functionality in > the past. > > > > After looking at the docs more closely (which I am finally > starting to get > > the hang of) I could see that the 'Session' class defined > public methods to > > both 'get' and 'set' the sequence numbers. Unfortunately, only > the 'set' > > variants were implemented in the NET counterpart. With some > considerable > > trial and error on my part, I extended the NET interface to > include these > > two 'get' methods as well. > > Do you think you can post the changes you made to include them into the > CVS? Thanks. > Sure, I'd be glad to. It may take me a little while to get up to speed on the CVS and what it takes to post changes....so in the meantime, here are the changes I made... ...also, please tell me if my implimentation is not 'up to spec'. sm ----------------------------------------------------------- \QuickFix\src\NET\Session.h ----------------------------------------------------------- #pragma once using namespace System; using namespace System::IO; #include "quickfix_net.h" #include "Message.h" #include "SessionID.h" #include "quickfix/SessionID.h" #include "quickfix/Session.h" namespace QuickFix { public __gc class Session { public: static bool sendToTarget( Message* message ) throw( SessionNotFound* ); static bool sendToTarget( Message* message, SessionID* sessionID ) throw( SessionNotFound* ); static bool sendToTarget ( Message* message, String* senderCompID, String* targetCompID ) throw( SessionNotFound* ); static Session* lookupSession( SessionID* sessionID ); void reset() throw( IOException* ); void setNextSenderMsgSeqNum( int num ) throw( IOException* ); void setNextTargetMsgSeqNum( int num ) throw( IOException* ); ///////////////////// my changes long getExpectedSenderNum(void); long getExpectedTargetNum(void); ///////////////////// my changes private: Session(FIX::Session* unmanaged) : m_pUnmanaged(unmanaged) {} FIX::Session& unmanaged() { return * m_pUnmanaged; } FIX::Session* m_pUnmanaged; }; } -------------------------------------------------------------- ----------------------------------------------------------- \QuickFix\src\NET\Session.cpp ----------------------------------------------------------- #include "stdafx.h" #include "Session.h" #include "quickfix/CallStack.h" namespace QuickFix { bool Session::sendToTarget( Message* message ) throw( SessionNotFound* ) { QF_STACK_TRY try { return FIX::Session::sendToTarget( message->unmanaged() ); } catch ( FIX::SessionNotFound& ) { throw new SessionNotFound(); }; QF_STACK_CATCH } bool Session::sendToTarget( Message* message, SessionID* sessionID ) throw( SessionNotFound* ) { QF_STACK_TRY try { return FIX::Session::sendToTarget( message->unmanaged(), sessionID->unmanaged() ); } catch ( FIX::SessionNotFound& ) { throw new SessionNotFound(); } QF_STACK_CATCH } bool Session::sendToTarget ( Message* message, String* senderCompID, String* targetCompID ) throw( SessionNotFound* ) { QF_STACK_TRY try { return FIX::Session::sendToTarget ( message->unmanaged(), FIX::SenderCompID( convertString( senderCompID ) ), FIX::TargetCompID( convertString( targetCompID ) ) ); } catch ( FIX::SessionNotFound& ) { throw new SessionNotFound(); } QF_STACK_CATCH } Session* Session::lookupSession( SessionID* sessionID ) { QF_STACK_TRY FIX::Session* pSession = FIX::Session::lookupSession(sessionID->unmanaged()); if( !pSession ) return 0; return new Session(pSession); QF_STACK_CATCH } void Session::reset() throw( IOException* ) { QF_STACK_TRY try { unmanaged().reset(); } catch( FIX::IOException& ) { throw new IOException(); } QF_STACK_CATCH } ///////////////////// my changes long Session::getExpectedSenderNum( void ) { QF_STACK_TRY return unmanaged().getExpectedSenderNum(); QF_STACK_CATCH } long Session::getExpectedTargetNum( void ) { QF_STACK_TRY return unmanaged().getExpectedTargetNum(); QF_STACK_CATCH } ///////////////////// my changes void Session::setNextSenderMsgSeqNum( int num ) throw( IOException* ) { QF_STACK_TRY try { unmanaged().setNextSenderMsgSeqNum( num ); } catch( FIX::IOException& ) { throw new IOException(); } QF_STACK_CATCH } void Session::setNextTargetMsgSeqNum( int num ) throw( IOException* ) { QF_STACK_TRY try { unmanaged().setNextTargetMsgSeqNum( num ); } catch( FIX::IOException& ) { throw new IOException(); } QF_STACK_CATCH } } |